integrate bug
- Subject: integrate bug
- From: Aleksas Domarkas
- Date: Wed, 1 Feb 2012 19:49:10 +0200
On 02/01/2012 12:04 PM, Aleksas Domarkas wrote:
> Integrate bug:
>
> (%i1) integrate(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2);
> (%o1) -%pi/4
> (%i2) float(%), numer;
> (%o2) -0.78539816339745
>
> (%i3) quad_qags(acos((x-1/2)/sqrt(1-x^2)), x, 0, 1/2);
> (%o3) [0.9161228399914,1.0171006703434392*10^-14,21,0]
And:
(%i2) integrate (acos ((x-1/2)/sqrt (1-x^2)), x);
(%o2) -%pi*x/2
which is obviously wrong.
Jaime
*****************************************************************************************************************
Let
(%i1) f:acos((x-1/2)/sqrt(1-x^2))$
We prove that
(%i2)
'integrate(f,x,0,1/2)=asin(1/sqrt(7))/sqrt(2)-asin((752*sqrt(3))/2401)/4+%pi/4;
(%o2)
integrate(acos((x-1/2)/sqrt(1-x^2)),x,0,1/2)=asin(1/sqrt(7))/sqrt(2)-asin((752*sqrt(3))/2401)/4+%pi/4
proof:
(%i3) load(bypart)$
(%i4) assume(abs(x)<1)$
(%i5) byparts(f,x,f,1),factor$
(%i6) F:ev(%, nouns),factor;
(%o6)
(2^(3/2)*x*acos((2*x-1)/(2*sqrt(1-x^2)))-sqrt(2)*asin((10*x+1)/(2*sqrt(7)*(x+1)))-sqrt(2)*asin((6*x-5)/(2*sqrt(7)*(x-1)))+asin((4*x-1)/sqrt(7)))/2^(3/2)
Solution:
(%i7) sol:ev(F,x=1/2)-ev(F,x=0),expand;
(%o7)
asin(5/(2*sqrt(7)))/2-asin(2/sqrt(7))+asin(1/sqrt(7))/sqrt(2)+asin(1/(2*sqrt(7)))/2+%pi/4
Next we simplify
(%i8) ratsimp(sol*sqrt(2))/sqrt(2);
(%o8)
(2*asin(5/(2*sqrt(7)))-4*asin(2/sqrt(7))+2^(3/2)*asin(1/sqrt(7))+2*asin(1/(2*sqrt(7)))+%pi)/4
We contract terms
(%i9) f1:2*asin(5/(2*sqrt(7)))-4*asin(2/sqrt(7))+2*asin(1/(2*sqrt(7)))$
(%i10) sin(f1)$
(%i11) trigexpand(%)$
(%i12) trigexpand(%)$
(%i13) radcan(%);
(%o13) -(752*sqrt(3))/2401
Therefore, it is true equality
(%i14) T:f1=asin(%);
(%o14)
2*asin(5/(2*sqrt(7)))-4*asin(2/sqrt(7))+2*asin(1/(2*sqrt(7)))=-asin((752*sqrt(3))/2401)
(%i15) ratsubst(rhs(T),lhs(T),sol);
(%o15)
(4*asin(1/sqrt(7))-sqrt(2)*asin((752*sqrt(3))/2401)+sqrt(2)*%pi)/2^(5/2)
(%i16) solution:expand(%);
(%o16) asin(1/sqrt(7))/sqrt(2)-asin((752*sqrt(3))/2401)/4+%pi/4
q.e.d.
Test:
(%i17) float(solution), numer;
(%o17) 0.9161228399914
(%i18) quad_qags(f, x, 0, 1/2);
(%o18) [0.9161228399914,1.0171006703434392*10^-14,21,0]
Aleksas D