On Wed, Sep 11, 2013 at 11:23 AM, Aaron Meurer <[email protected]> wrote: > On Wed, Sep 11, 2013 at 10:37 AM, Ondřej Čertík <[email protected]> > wrote: >> Hi Peter! >> >> On Wed, Sep 11, 2013 at 7:19 AM, Peter Luschny <[email protected]> >> wrote: >>> Consider >>> >>> (F1) sqrt(1+x^3)/x >>> (F2) sqrt(1+1/x^3)*sqrt(x) >>> >>> According to Mathematica's online integrator >>> >>> (I1) integral F1 dx = (2/3)*(sqrt(x^3+1)-arctanh(sqrt(x^3+1))) >>> (I2) integral F2 dx = >>> (2*sqrt(1/x^3+1)*x^(3/2)*(sqrt(x^3+1)-arctanh(sqrt(x^3+1))))/(3*sqrt(x^3+1)) >>> >>> SymPy Live computes (I1) as >>> (S) 2*x**(3/2)/(3*sqrt(1 + x**(-3))) - 2*asinh(x**(-3/2))/3 + >>> 2/(3*x**(3/2)*sqrt(1 + x**(-3))) >>> >>> SymPy Live timed out with (I2). SymPy 0.7.3 computes (I2) as >>> (S) 2*x**(3/2)/(3*sqrt(1 + x**(-3))) - 2*asinh(x**(-3/2))/3 + >>> 2/(3*x**(3/2)*sqrt(1 + x**(-3))) >>> >>> The derivative of (S) is (F2) and not (F1). So I am inclined to >>> say that SymPy computes (I1) not correctly. >> >> >> Thanks for reporting this. Here is what I tried: >> >> In [1]: x = Symbol("x", real=True) >> >> In [2]: f = integrate(sqrt(1+x**3)/x, x) >> >> In [3]: e = f.diff(x).simplify().expand().factor().cancel() >> >> In [4]: print e >> (x**3 + 1)/(x**(5/2)*sqrt(1 + x**(-3))) >> >> It's kind of a pain to simplify "f", but at the end, the expression [4] is >> equal >> to sqrt(1+x^3)/x, as you can check by hand, at least for x > 0. >> >> How did you make it equal to (F2)? > > F1 and F2 are equal for x > 0.
Ah right! I see, so the problem is with proper handling of sqrt() for general (complex) symbols inside integrate. As far as I know, sympy should otherwise by handling sqrt() properly. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
