ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 05 Nov 2022 23:51:28 +0100exp(x/(x+1)+1/(x+1)) fails to be simplifiedhttps://ask.sagemath.org/question/64770/expxx11x1-fails-to-be-simplified/I have tried simplify and simplify_full on exp(x/(x+1)+1/(x+1)), expecting e as the result, but sage does not simplify it.
Curiously, simplify_full works on log(x/(x+1)+1/(x+1)), and returns 0.
Also (x/(x+1)+1/(x+1)).simplify_full() returns 1.
By the way, this is just the simplest example I could come up with, originally I have noticed in much more complicated expressions that sage failed to simplify them, because it failed to simplify inside the exponents.Sat, 05 Nov 2022 18:00:37 +0100https://ask.sagemath.org/question/64770/expxx11x1-fails-to-be-simplified/Answer by tolga for <p>I have tried simplify and simplify_full on exp(x/(x+1)+1/(x+1)), expecting e as the result, but sage does not simplify it.
Curiously, simplify_full works on log(x/(x+1)+1/(x+1)), and returns 0.
Also (x/(x+1)+1/(x+1)).simplify_full() returns 1.
By the way, this is just the simplest example I could come up with, originally I have noticed in much more complicated expressions that sage failed to simplify them, because it failed to simplify inside the exponents.</p>
https://ask.sagemath.org/question/64770/expxx11x1-fails-to-be-simplified/?answer=64772#post-id-64772Try
(exp(x/(x+1)+1/(x+1))).canonicalize_radical()Sat, 05 Nov 2022 19:18:14 +0100https://ask.sagemath.org/question/64770/expxx11x1-fails-to-be-simplified/?answer=64772#post-id-64772Answer by Emmanuel Charpentier for <p>I have tried simplify and simplify_full on exp(x/(x+1)+1/(x+1)), expecting e as the result, but sage does not simplify it.
Curiously, simplify_full works on log(x/(x+1)+1/(x+1)), and returns 0.
Also (x/(x+1)+1/(x+1)).simplify_full() returns 1.
By the way, this is just the simplest example I could come up with, originally I have noticed in much more complicated expressions that sage failed to simplify them, because it failed to simplify inside the exponents.</p>
https://ask.sagemath.org/question/64770/expxx11x1-fails-to-be-simplified/?answer=64773#post-id-64773An alternative to @tolga's answer (which solves well this particular problem) is to define a recursive version of `simplify_full`. Very roughly :
sage: def rsf(x):
----: "Recursive full_simplify-ication"
....: ops=x.operands()
....: if len(ops)==0: return x
....: sops=list(map(rsf, ops))
....: return x.operator()(*sops).simplify_full()
....:
sage: rsf(exp(x/(x+1)+1/(x+1)))
e
No guarantee on performance, though...
Other alternatives :
sage: (exp(x/(x+1)+1/(x+1)))._sympy_().simplify()._sage_()
e
sage: giac.simplify(exp(x/(x+1)+1/(x+1))).sage()
e
sage: fricas.simplify(exp(x/(x+1)+1/(x+1))).sage()
e
sage: mathematica.FullSimplify(exp(x/(x+1)+1/(x+1))).sage()
e
Sat, 05 Nov 2022 23:51:28 +0100https://ask.sagemath.org/question/64770/expxx11x1-fails-to-be-simplified/?answer=64773#post-id-64773