## #628 Trig integral error

closed
nobody
5
2008-02-23
2004-10-21
No

The integral of
2*COT(x)^2*COS(2*x)/(CSC(2*x)+COT(2*x));
is wrong for maxima-5.9.1

(%i1) display2d:false;
(%o1) FALSE
(%i2) h: 2*COT(x)^2*COS(2*x)/(CSC(2*x)+COT(2*x));
(%o2) 2*COT(x)^2*COS(2*x)/(CSC(2*x)+COT(2*x))
(%i3) ih:integrate(h,x);
(%o3) (2*LOG(SIN(x)^2+COS(x)^2+2*COS(x)+1)
+2*LOG(SIN(x)^2+COS(x)^2-2*COS(x)+1)
+COS(2*x))
/2
(%i4) ev(ih,x=1.0,numer)-ev(ih,x=0.5,numer);
(%o4) .6469013090248041
(%o5) [.1686767378171631,3.37999776996994E-
15,21,0]
(%i6) h2:trigsimp(trigexpand(h));
(%o6) (4*COS(x)^3-2*COS(x))/SIN(x)
(%i7) ih2:integrate(h2,x);
(%o7) LOG(COS(x)+1)+LOG(COS(x)-1)+2*COS(x)^2
(%i8) ev(ih2,x=1.0,numer)-ev(ih2,x=0.5,numer);
(%o8) .1686767378171636

The integral over 0.5 < x < 1.0 at %o4 differs from the
numerical integral %o5 and the analytic integral of an
equivalent expression %o8.

## Discussion

• Logged In: YES
user_id=365569

Once this is fixed, activate equation (22) in
share/contrib/diffequations/tests/rtestode_murphy1.mac

• Raymond Toy - 2006-02-16

Logged In: YES
user_id=28849

This seems to be a bug in the Risch integrator. If you
trace(?rischint), you can see h is converted to exponential
form and the Risch integrator returns
log(exp(%i*x)+1)+log(exp(%i*x)-1)+(exp(2*%i*x)-4*%i*x)/4.

However

integrate(trigsimp(exponentialize(h)),x);

(which uses the Risch integrator too!) returns

2*log(%e^(%i*x)+1)+2*log(%e^(%i*x)-1)+%e^(2*%i*x)/2+%e^-(2*%i*x)/2-2*%i*x

I think this simplifies to

log(2*cos(x)+2)+log(2-2*cos(x))+cos(2*x)

Differentiating this produces something equal to h.

• Robert Dodier - 2006-04-10
• labels: --> Lisp Core - Integration

• Dan Gildea - 2008-02-23

Logged In: YES
user_id=1797506
Originator: NO

Fixed in risch.lisp rev 1.15.

(%i4) h : 2*cot(x)^2*cos(2*x)/(csc(2*x)+cot(2*x));
(%o4) 2*cot(x)^2*cos(2*x)/(csc(2*x)+cot(2*x))
(%i5) ih:integrate(h,x);
(%o5) log(sin(x)^2+cos(x)^2+2*cos(x)+1)+log(sin(x)^2+cos(x)^2-2*cos(x)+1)
+cos(2*x)
(%i6) ev(ih,x=1.0,numer)-ev(ih,x=0.5,numer);
(%o6) 0.168676737817163

• Dan Gildea - 2008-02-23
• status: open --> closed