On Sunday, May 31, 2015 at 8:08:52 AM UTC-7, David Einstein wrote:
>
> Given a symbolic expression u is there some way to tell if u.simplify() 
> accomplished something?  All I can think of is comparing the string 
> representations, and that seems a bit silly.
>
> For example, 
> sage: u = sin(x)^2 + cos(x)^2
> sage: u.simplify()
> cos(x)^2 + sin(x)^2
> sage: u.full_simplify()
> 1
>
> I'd like to be able to tell that simplify did nothing, but that 
> full_simplify did something.
>

You can glean some information from:

var('old_u')
u_simp = u.simplify()
u_fullsimp = u.full_simplify()
sage: u_simp.subs({u:old_u})
old_u
sage: u_fullsimp.subs({u:old_u})
1

which makes use of the fact that substitution uses the kind of equality 
test you want to do. Internally, sage has the equality test you want to use 
readily available. It just hasn't been exposed.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" 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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to