On 2020-03-07, Eric Gourgoulhon <[email protected]> wrote:
> You should use simplify_full() instead of simplify():
Or you should rather use *polynomials* instead of general symbolic
variables, provided of course that all your expressions are multivariate
rational functions (which is the case here):
> sage: var('s t')
> (s, t)
sage: R.<s,t> = QQ[]
> sage: thirdroot = ((s^2 - 1)*t^2 - s^2 + 1)/(s^2 + 2*s*t + t^2)
sage: thirdroot = ((s^2 - 1)*t^2 - s^2 + 1)/(s^2 + 2*s*t + t^2)
> sage: factor(thirdroot + 1)
> (s*t + 1)^2/(s + t)^2
sage: factor(thirdroot + 1)
(s + t)^-2 * (s*t + 1)^2
> sage: a = thirdroot + 1 - (s*t + 1)^2/(s+t)^2
> sage: a
> ((s^2 - 1)*t^2 - s^2 + 1)/(s^2 + 2*s*t + t^2) - (s*t + 1)^2/(s + t)^2 + 1
> sage: a.simplify_full()
> 0
sage: a = thirdroot + 1 - (s*t + 1)^2/(s+t)^2; a
0
That's because thirdroot is an element of the quotient field of a
polynomial ring, which does automatic simplifications (which in the
special context of polynomials is a lot easier than in the general
context of symbolic variables).
Best regards,
Simon
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/sage-support/r40ug5%241rii%241%40ciao.gmane.io.