Status: Accepted
Owner: mrock...@gmail.com
Labels: Type-Defect Priority-Medium
New issue 2536 by mrock...@gmail.com: exp(-stuff) should be in the numerator
http://code.google.com/p/sympy/issues/detail?id=2536
Pretty and Latex printing give different results for the following common
expression.
2**(1/2)*exp(-(-mu + x3)**2/(2*sigma_1**2))/(2*pi**(1/2)*sigma_1)
Pretty:
2
-(-μ + x₃)
───────────
2
⎽⎽⎽ 2⋅σ₁
╲╱ 2 ⋅ℯ
──────────────────
⎽⎽⎽
2⋅╲╱ π ⋅σ₁
Hopefully this comes out. If not go here http://pastebin.com/qbd8HB3e
Latex:
http://latex.codecogs.com/png.latex?\huge%20\fn_cm%20\frac{\sqrt{2}}{2%20\sqrt{\pi}%20\sigma_{1}%20e^{\frac{\left(-%20\mu%20+%20x_{3}\right)^{2%20}}{2%20\sigma_{1}^{2}}}}
In the latex version the exponent term is placed in the denominator because
it has a negative exponent. It makes this decision in the function
<<sympy.simplify.fraction>> where it decides which parts of a Mul should be
top and which should be on the bottom
Code snippet is here:
for term in Mul.make_args(expr):
if term.is_Pow or term.func is exp:
If we remove the special casing of exp
for term in Mul.make_args(expr):
if term.is_Pow:
Then everything works swimingly except for one test in test_simplify
assert(simplify(exp(1)+exp(-exp(1)))) == (1 + exp(1 + E))*exp(-E)
With the change the expression on the left doesn't change, it stays
exp(1)+exp(-exp(1))) , which, to my eyes at least, seems simpler.
-ℯ
ℯ + ℯ
⎛ 1 + ℯ⎞ -ℯ
⎝1 + ℯ ⎠⋅ℯ
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.