Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread Aaron Meurer
I did not see that this thread was continued under a different subject. Yes, unfortunately, there are currently a lot of bugs related to pickling and unpickling SymPy expressions. We need to make a concerted effort to iron them all out. I would also suggest using cloudpickle, as it works better

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread Oscar Benjamin
On Wed, 7 Apr 2021 at 14:55, Oscar Benjamin wrote: > > On Wed, 7 Apr 2021 at 14:43, 'Bruce Allen' via sympy > wrote: > > > > David, Oscar, > > > > Thank you for your help. > > > > Oscar, the list 'u' was created in the course of a calculation, and > > saved as a .pkl file. I then reloaded it and

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread David Bailey
On 07/04/2021 15:27, 'Bruce Allen' via sympy wrote: Dear Oscar, Thank you. On the upside, this shows that sympy has a robust user base -- the bug was picked up just 20 days ago and here I am stumbling on it independently. On the downside, this makes it hard to work on a calculation which

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread Chris Smith
Assuming symbols with the same names but different assumptions are not being used, couldn't one just "refresh" the unpickled expression by pairing the pickled symbols with current session variables by name? Does this work? unpickle = a # an expression that was unpickled reps= {} for i in

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread Oscar Benjamin
On Wed, 7 Apr 2021 at 15:27, 'Bruce Allen' via sympy wrote: > > On the downside, this makes it hard to work on a calculation which > requires large numbers of CPU hours and needs to be checkpointed and saved. > > Do you know of any workarounds? Or is there an alternative to > pickle.save() and

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread 'Bruce Allen' via sympy
Dear Oscar, Thank you. On the upside, this shows that sympy has a robust user base -- the bug was picked up just 20 days ago and here I am stumbling on it independently. On the downside, this makes it hard to work on a calculation which requires large numbers of CPU hours and needs to be

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread Oscar Benjamin
On Wed, 7 Apr 2021 at 14:43, 'Bruce Allen' via sympy wrote: > > David, Oscar, > > Thank you for your help. > > Oscar, the list 'u' was created in the course of a calculation, and > saved as a .pkl file. I then reloaded it and want to manipulate the > saved equations, of which u[7] is an example.

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread 'Bruce Allen' via sympy
David, Oscar, Thank you for your help. Oscar, the list 'u' was created in the course of a calculation, and saved as a .pkl file. I then reloaded it and want to manipulate the saved equations, of which u[7] is an example. I found an even cleaner example, see below. I have the impression

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread David Bailey
On 07/04/2021 12:28, Oscar Benjamin wrote: In Bruce's example both symbols seem to have the same assumptions so this shouldn't be the issue. Oscar I just checked and you can make two non-identical symbols that way: Symbol('a')+Symbol('a',Positive=True) a + a I almost wonder if that should

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread Oscar Benjamin
On Wed, 7 Apr 2021 at 12:24, David Bailey wrote: > > On 07/04/2021 11:59, Oscar Benjamin wrote: > > On Wed, 7 Apr 2021 at 10:28, 'Bruce Allen' via sympy > > wrote: > >> > >> Why does subs() work in one case, and not in the other? > > I'm not sure. I can't reproduce this without u though. I tried

Re: [sympy] Why does subs() not work as expected - a related question ?

2021-04-07 Thread David Bailey
On 07/04/2021 11:59, Oscar Benjamin wrote: On Wed, 7 Apr 2021 at 10:28, 'Bruce Allen' via sympy wrote: I have a very basic sympy question, which has me stumped, and am hoping that someone here can set me straight. I have an expression for which subs() seems to have no effect: >>>