Thanks Aaron. The evaluate context is incredibly useful...

Another interesting I've noted is that equality checking of expressions 
(using == operator, not equals) seem to fail if one subexpression has 
evaluate set to False whereas an identical expression has the same 
subexpression set to True. Is this by design -- for more complicated core 
types -- or a bug?

Here's some sample code to reproduce the issue:

>>> expr_eval_false = sympify('2*x-4', evaluate=False)

>>> expr_eval_false

2*x - 4

>>> expr_eval_true = sympify('2*x-4', evaluate=True)

>>> expr_eval_false == expr_eval_true

False

>>> expr_eval_false.equals(expr_eval_true)

True


I'm interested in comparing sympy expression trees so look forward to some 
independent work in that area.

On Friday, October 7, 2016 at 4:17:14 PM UTC-4, Aaron Meurer wrote:
>
> You can use with evaluate(False): 
>
> In [11]: with evaluate(False): 
>    ....:     print(x - sin(x - x)) 
>    ....: 
> x - sin(-x + x) 
>
> Aaron Meurer 
>
> On Fri, Oct 7, 2016 at 3:29 PM, Robert Lee <[email protected] 
> <javascript:>> wrote: 
> > I want the ability to be able to recursively pass flags like 
> evaluate=False 
> > through all the sub-expressions. Is this currently possible? The best 
> hack I 
> > have is actually going through and reforming each sub-expression 
> recursively 
> > and setting the appropriate flags. 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sympy" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sympy. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/sympy/2a4ab16d-7eef-42e7-94ec-bad9c62aadf3%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/04053b81-d139-49a1-9b27-43f88b594be7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to