>>>>> "Raymond" == Raymond Toy <toy.raymond at gmail.com> writes:
>>>>> "Martin" == Martin Kraska <kraska at fh-brandenburg.de> writes:
Martin> Hi,
Martin> using Maxima 5.31.2 I tried this:
Martin> integrate(sqrt(1+cos(x)^2),x) and get nothing but the input.
Martin> When loading abs_integrate, the result is an error:
Martin> sign: argument cannot be imaginary; found %i
Martin> #0:
Martin> intfudu(exp=sqrt(6*%e^-(2*%i*x)+%e^-(4*%i*x)+1)*%e^(%i*x),%voi=x)(partition.
Martin> mac line 95)
Martin> #1: extra_integrate(q=sqrt(6*%e^-(2*%i*x)+%e^-(4*%i*x)+1)*%e^(%i*x),x=x)
Martin> -- an error. To debug this try: debugmode(true);
Martin> Maple gives:
Martin> {sqrt(sin(x)^2)*EllipticE(cos(x),i)}/sin(x)
Martin> Can this be done in Maxima?
Raymond> As you've discovered, Maxima cannot do this integral. Maxima
Raymond> currently has no support for elliptic integrals.
Raymond> I've done a little work on this, but have never finished it. It
Raymond> definitely won't recognize this integral, but it might recognize the
Raymond> equivalent integrate(sqrt(1+x^2)/sqrt(1-x^2),x). I didn't try it,
Raymond> however.
Here we go. The elliptic integral package is available at
https://github.com/rtoy/maxima-hacks in specfun/ellint.mac.
If we write sqrt(1+x^2)/sqrt(1-x^2) as (1+x^2)/sqrt(1-x^2)/sqrt(1+x^2)
= (1+x^2)/sqrt((1-x^2)*(1+x^2)), we can use ellintreduce:
ellintreduce((1+x^2)/y, x, y, 1-x^2, 1+x^2, u);
-sqrt(2)*(-elliptic_eu(inverse_jacobi_sd(sqrt(2)*x,1/2),1/2)
+inverse_jacobi_sd(sqrt(2)*x,1/2)/2
+x*sqrt(1-2*x^2/(x^2+1))/(sqrt(2)*sqrt(x^2+1)*sqrt(1-x^2/(x^2+1))))
ratsimp(make_elliptic_e(%));
-((-sqrt(2)*x^2-sqrt(2))*elliptic_e(asin(sqrt(2)*x/sqrt(x^2+1)),1/2)
+x*sqrt(1-x^2)*sqrt(x^2+1))
Not quite the same. Let's check the value of
integrate(sqrt(1+t^2)/sqrt(1-t^2),t,0,1):
subst(x=1,%) - subst(x=0,%);
sqrt(2)*elliptic_ec(1/2);
float(%);
1.910098894513856
quad_qags(sqrt(1+t^2)/sqrt(1-t^2),t,0,1);
[1.910098894513844,7.721934203175351e-11,315,0]
So it looks reasonably correct. And if we take the derivative of the
result from make_elliptic_e, we get
ratsimp(diff(<result>, x));
-sqrt(1-x^2)/sqrt(x^2+1)/(x^2-1)
Which is the same as the original integrand.
Ray