Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » sci.math.* » sci.math.symbolic.independent

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.