Re: [sympy] Comparing a cse'd expr with the original

2020-10-23 Thread Jason Moore
David, I'm not sure I understand what algebraic manipulations you are referring to. In the example, the algebraic manipulation is done with sympy variables. Only the final expressions are evaluated with floating point numbers substituted in. The substitutions of floating point numbers do have to o

Re: [sympy] Comparing a cse'd expr with the original

2020-10-23 Thread David Bailey
On 23/10/2020 11:59, Oscar Benjamin wrote: Hi Jason, I'm approaching this from the perspective that this is a bug in cse/lambdify and that you want to identify which part of a large expression tree triggers the bug. Since evaluating the whole expression is slow I would start by testing smaller s

Re: [sympy] Comparing a cse'd expr with the original

2020-10-23 Thread Jason Moore
Also, if anyone is curious what prompted this question, I do now have a nice example running in the pydy docs for this problem: https://pydy.readthedocs.io/en/latest/examples/carvallo-whipple.html There are still some things that are incorrect in the derivation (the warning boxes) but the simulat

Re: [sympy] Comparing a cse'd expr with the original

2020-10-23 Thread Jason Moore
Oscar, Yes, this is what I want to check. Thanks for taking the time to write this code. I'll give it a try. In the meantime I did get my code to run. I think Python was actually being "Killed" by trying to lambdify an expression with thousands of operations. I then switched to expr.evalf(subs=)

Re: [sympy] Comparing a cse'd expr with the original

2020-10-23 Thread Oscar Benjamin
Hi Jason, I'm approaching this from the perspective that this is a bug in cse/lambdify and that you want to identify which part of a large expression tree triggers the bug. Since evaluating the whole expression is slow I would start by testing smaller subexpressions and work up from there. You can

Re: [sympy] Comparing a cse'd expr with the original

2020-10-23 Thread Jason Moore
Oscar, Yes I can try evaluating in different orders. That's an interesting idea. I also may be breaking lambdify with too many arguments. I can store the numerical results of each subexpression in a dictionary, then identify the minimal set of variables in each subsequent subexpression, and only