Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



An integral: Which one is wrong, Mathematica or sympy?
Posted:
Apr 19, 2013 8:27 PM


Hello all,
Just for fun a plug the following mathematica integral
In[1]:= g = 1/(x*(1a*(1x)))
In[2]:= res=Integrate[g,x]
In[3]:= TeXForm[res]
Out[3]//TeXForm= \frac{\log (a (x1)+1)\log (x)}{a1}
into sympy ( which can be tried online at [ http://live.sympy.org/ ] ) to obtain
In [1]: a = Symbol('a')
In [2]: g = 1/(x*(1a*(1x)))
In [3]: u=simplify(integrate(g,x))
In [5]: latex(u) Out[5]: \frac{ \log{\left (2 x \right )} + \log{\left (\frac{ a^{2} + 2 a x \left(a  1\right)  a \left(a  1\right) + 3 a  2}{a \left(a  1\right)} \right )}}{ a  1}
Surprisingly, sympy seems to give the right result without any assumption, while mathematica's result seems to assume a>1, which is not specified. Also for this case (a>1) sympy gives an extra constant which is not present in the mathematica result.
Is there a way to (1) make mathematica to output a general result like sympy and (2) decide which one is really the correct result?
Sergio



