Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: An integral: Which one is wrong, Mathematica or sympy?
Replies: 4   Last Post: Apr 20, 2013 11:34 AM

 Messages: [ Previous | Next ]
 sergio_r@mail.com Posts: 14 Registered: 10/22/07
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*(1-a*(1-x)))

In[2]:= res=Integrate[g,x]

In[3]:= TeXForm[res]

Out[3]//TeXForm= \frac{\log (a (x-1)+1)-\log (x)}{a-1}

into sympy ( which can be tried online at [ http://live.sympy.org/
] )
to obtain

In [1]: a = Symbol('a')

In [2]: g = 1/(x*(1-a*(1-x)))

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

Date Subject Author
4/19/13 sergio_r@mail.com
4/19/13 Nasser Abbasi
4/20/13 sergio_r@mail.com
4/20/13 sergio_r@mail.com
4/20/13 Richard Fateman