analytical integrate

82 views
Skip to first unread message

Denis Akhiyarov

unread,
Jul 23, 2015, 1:31:41 PM7/23/15
to sympy
Sympy cannot do this?

integrate(sqrt(x+sqrt(x)))

BTW, this is computed by SAGE:

-1/12*(3*(sqrt(x) + 1)^(5/2)/x^(5/4) - 8*(sqrt(x) + 1)^(3/2)/x^(3/4) - 3*sqrt(sqrt(x) + 1)/x^(1/4))/((sqrt(x) + 1)^3/x^(3/2) - 3*(sqrt(x) + 1)^2/x + 3*(sqrt(x) + 1)/sqrt(x) - 1) + 1/8*log(sqrt(sqrt(x) + 1)/x^(1/4) + 1) - 1/8*log(sqrt(sqrt(x) + 1)/x^(1/4) - 1)

Ondřej Čertík

unread,
Jul 23, 2015, 2:58:18 PM7/23/15
to sympy
On Thu, Jul 23, 2015 at 11:31 AM, Denis Akhiyarov
<denis.a...@gmail.com> wrote:
> Sympy cannot do this?
>
> integrate(sqrt(x+sqrt(x)))

Looks like it cannot, thanks for letting us know. Would you mind
creating an issue for this?

Thanks,
Ondrej

>
> BTW, this is computed by SAGE:
>
> -1/12*(3*(sqrt(x) + 1)^(5/2)/x^(5/4) - 8*(sqrt(x) + 1)^(3/2)/x^(3/4) -
> 3*sqrt(sqrt(x) + 1)/x^(1/4))/((sqrt(x) + 1)^3/x^(3/2) - 3*(sqrt(x) + 1)^2/x
> + 3*(sqrt(x) + 1)/sqrt(x) - 1) + 1/8*log(sqrt(sqrt(x) + 1)/x^(1/4) + 1) -
> 1/8*log(sqrt(sqrt(x) + 1)/x^(1/4) - 1)
>
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/833581e7-3bc3-43b1-afa4-5b9391956124%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Kalevi Suominen

unread,
Jul 23, 2015, 3:37:45 PM7/23/15
to sympy, denis.a...@gmail.com

I Is it possible to verify that this really is a solution. The integrand seems to belong to an elliptic function field where integration rarely succeeds in terms of algebraic expressions.
 

Aaron Meurer

unread,
Jul 23, 2015, 3:42:40 PM7/23/15
to sy...@googlegroups.com, denis.a...@gmail.com
I think it is correct, at least algebraically:

In [6]: a = S("-1/12*(3*(sqrt(x) + 1)^(5/2)/x^(5/4) - 8*(sqrt(x) + 1)^(3/2)/x^(3/4) - 3*sqrt(sqrt(x) + 1)/x^(1/4))/((sqrt(x) + 1)^3/x^(3/2) - 3*(sqrt(x) + 1)^2/x + 3*(sqrt(x) + 1)/sqrt(x) - 1) + 1/8*log(sqrt(sqrt(x) + 1)/x^(1/4) + 1) - 1/8*log(sqrt(sqrt(x) + 1)/x^(1/4) - 1)")

In [7]: print(simplify(a.diff(x)))
x**(1/4)*sqrt(sqrt(x) + 1)

(if you distribute sqrt(sqrt(x)) inside the sqrt(sqrt(x) + 1) you get sqrt(x + sqrt(x))

Aaron Meurer

--
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 sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.

Aaron Meurer

unread,
Jul 23, 2015, 3:46:05 PM7/23/15
to sy...@googlegroups.com, denis.a...@gmail.com
It's worth pointing out that computing this integral is very likely going to require the algebraic Risch algorithm. Maybe a pattern matching case for it can be added to something like Rubi or manulaintegrate (I'm actually curious if Rubi can do this), but the solution, at least as Sage has presented it, looks rather complicated (e.g., the fact that the result has logarithms means that pattern matching integrators are going to be limited without at least *some* Risch algorithm).

Aaron Meurer

Aaron Meurer

unread,
Jul 23, 2015, 3:50:43 PM7/23/15
to sy...@googlegroups.com, denis.a...@gmail.com
Oh, I take that back:

In [16]: print(integrate(sqrt(sqrt(x))*sqrt(1 + sqrt(x))))
2*x**(7/4)/(3*sqrt(sqrt(x) + 1)) + 5*x**(5/4)/(6*sqrt(sqrt(x) + 1)) - x**(3/4)/(12*sqrt(sqrt(x) + 1)) - x**(1/4)/(4*sqrt(sqrt(x) + 1)) + asinh(x**(1/4))/4

(this is coming from the meijerg algorithm). And I wouldn't be surprised if some rewriting of it made heurisch handle it as well. The real power of the full Risch algorithm is that it uses canonical forms of algebraic functions, so it is immune to simple rewrites like this one. 

Aaron Meurer

Kalevi Suominen

unread,
Jul 23, 2015, 4:07:36 PM7/23/15
to sympy, denis.a...@gmail.com, asme...@gmail.com
Surprising, but satisfactory. I had forgotten that the meijerg method would work for some elliptic integrals, though in this case none of those remain in the solution.

Denis Akhiyarov

unread,
Jul 23, 2015, 4:34:50 PM7/23/15
to sympy, asme...@gmail.com, jks...@gmail.com

Francesco Bonazzi

unread,
Jul 24, 2015, 5:05:07 AM7/24/15
to sympy, denis.a...@gmail.com, asme...@gmail.com


On Thursday, 23 July 2015 21:46:05 UTC+2, Aaron Meurer wrote:
(I'm actually curious if Rubi can do this)

With RUBI I get this output:

2/3 Sqrt[x+Sqrt[x]] x+1/6 Sqrt[x+Sqrt[x]] Sqrt[x]-Sqrt[x+Sqrt[x]]/4+1/4 tanh^-1(Sqrt[x]/Sqrt[x+Sqrt[x]])

Reply all
Reply to author
Forward
0 new messages