Ask Your Question
0

exp(x/(x+1)+1/(x+1)) fails to be simplified

asked 2022-11-05 18:00:37 +0100

Roland765 gravatar image

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2022-11-05 19:18:14 +0100

tolga gravatar image

Try

(exp(x/(x+1)+1/(x+1))).canonicalize_radical()
edit flag offensive delete link more
1

answered 2022-11-05 23:51:28 +0100

Emmanuel Charpentier gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-11-05 18:00:37 +0100

Seen: 320 times

Last updated: Nov 05 '22