Thanks. I'll look inside subst
The reason I ask is that I've been looking at `floor` and deep inside there
is a line
return floor(SR(x).full_simplify().canonicalize_radical())
Now, if x is some complicated expression that maxima does not simplify, but
is equivalent to an integer (or very very very close to one), we are down
the infinite recursion rabbit hole. I know of no such expression offhand,
but would be quite surprised if none existed.
if would be nice to replace that with something like
y = SR(x).full_simplify().canonicalize_radical()
if SR(x).is_different_from(y):
return floor(y)
else:
give up
I suspect that code like this would be fairly common in the _eval methods
of new functions.
On Sunday, May 31, 2015 at 11:47:15 AM UTC-4, Nils Bruin wrote:
>
> 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.