# exp(x/(x+1)+1/(x+1)) 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.

edit retag close merge delete

Sort by ยป oldest newest most voted

Try

(exp(x/(x+1)+1/(x+1))).canonicalize_radical()

more

An 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

more