defint.lisp bug - was: new defint.lisp andradexpand:false?
- Subject: defint.lisp bug - was: new defint.lisp andradexpand:false?
- From: Aleksas Domarkas
- Date: Fri, 13 Jan 2012 10:53:26 +0200
About integrate(exp(x)*x^k,x,a,b)
We discus problems from
http://www.math.utexas.edu/pipermail/maxima/2012/027431.html
A.Domarkas
From Oiler's formula exp(i*x)=cos(x)+i*sin(x). Then exp(i*pi)=-1.
Maxima wrong compute
(%i1) (-1)^(4/5);
(%o1) 1
Should be
(%i2) polarform(-1)^(4/5);
(%o2) %e^((4*%i*%pi)/5)
(%i3) float(%), numer;
(%o3) 0.587785252292473*%i-0.809016994374947
This is same as Mathematica gives.
Theorem. For any real k, a, b
integrate(exp(x)*x^k,x,a,b)=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a))
Proof.
(%i4) S:'integrate(exp(x)*x^k,x);
(%o4) integrate(x^k*%e^x,x)
(%i5) S1:ev(S, nouns);
(%o5) -gamma_incomplete(k+1,-x)*(-x)^(-k-1)*x^(k+1)
(%i6) subst(-x=exp(%i*pi)*x,S1);
(%o6) -gamma_incomplete(k+1,%e^(%i*pi)*x)*x^(k+1)*(%e^(%i*pi)*x)^(-k-1)
Froom Newton-Leibnitz formula S is equal
(%i7) subst(x=b,%)-subst(x=a,%);
(%o7)
a^(k+1)*gamma_incomplete(k+1,a*%e^(%i*pi))*(a*%e^(%i*pi))^(-k-1)-b^(k+1)*gamma_incomplete(k+1,b*%e^(%i*pi))*(b*%e^(%i*pi))^(-k-1)
(%i8) radcan(%);
(%o8)
-(gamma_incomplete(k+1,b*%e^(%i*pi))-gamma_incomplete(k+1,a*%e^(%i*pi)))*%e^(-(%i*k+%i)*pi)
(%i9) subst(pi=%pi,%);
(%o9) %e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a))
(%i10) define(F(k,a,b),%);
(%o10)
F(k,a,b):=%e^(-%i*%pi*k)*(gamma_incomplete(k+1,-b)-gamma_incomplete(k+1,-a))
q.e.d.
-->
Example 1. integrate(exp(y)/y^(4/5),y,1,2);
(%i11) F(-4/5,1,2);
(%o11) %e^((4*%i*%pi)/5)*(gamma_incomplete(1/5,-2)-gamma_incomplete(1/5,-1))
(%i12) expand(float(rectform(%)));
(%o12) 3.319281956502161-4.440892098500626*10^-16*%i
(%i13) realpart(%);
(%o13) 3.319281956502161
(%i14) /*test*/
first(quad_qags(exp(y)/y^(4/5),y,1,2));
(%o14) 3.319281956502171
Example 2. integrate(exp(x)*x^(1/2),x,0,2);
(%i15) F(1/2,0,2);
(%o15) -%i*(gamma_incomplete(3/2,-2)-sqrt(%pi)/2)
(%i16) expand(float(rectform(%)));
(%o16) 7.105860585432373-1.4432899320127035*10^-15*%i
(%i17) realpart(%);
(%o17) 7.105860585432373
(%i18) /*test*/
first(quad_qags(exp(x)*x^(1/2),x,0,2));
(%o18) 7.105860585432362
Example 3. integrate(exp(x)*x^(1/2),x,1,4);
(%i19) F(1/2,1,4);
(%o19) -%i*(gamma_incomplete(3/2,-4)-gamma_incomplete(3/2,-1))
(%i20) expand(float(rectform(%)));
(%o20) 91.48804221822935-1.6764367671839864*10^-14*%i
(%i21) realpart(%);
(%o21) 91.48804221822935
(%i22) /*test*/
first(quad_qags(exp(x)*x^(1/2),x,1,4));
(%o22) 91.4880422182294
Example 3. integrate(exp(x)*x^3,x,1,4);
(%i23) F(3,1,4);
(%o23) gamma_incomplete(4,-1)-gamma_incomplete(4,-4)
(%i24) expand(float(rectform(%)));
(%o24) 1861.773664783822-9.119759437093765*10^-13*%i
(%i25) realpart(%);
(%o25) 1861.773664783822
(%i26) /*test*/
first(quad_qags(exp(x)*x^3,x,1,4));
(%o26) 1861.773664783822
Example 4. integrate(exp(x)*x^3,x,-1,1);
(%i27) F(3,-1,1);
(%o27) gamma_incomplete(4,1)-gamma_incomplete(4,-1)
(%i28) expand(float(rectform(%)));
(%o28) 0.449507401824987-2.759950902850205*10^-16*%i
(%i29) realpart(%);
(%o29) 0.449507401824987
(%i30) /*test*/
first(quad_qags(exp(x)*x^3,x,-1,1));
(%o30) 0.449507401824987
Example 5. integrate(exp(x)*x^4,x,-1,1);
(%i31) F(4,-1,1);
(%o31) gamma_incomplete(5,-1)-gamma_incomplete(5,1)
(%i32) expand(float(rectform(%)));
(%o32) 0.552372779987653-2.844371478803256*10^-16*%i
(%i33) realpart(%);
(%o33) 0.552372779987653
(%i34) /*test*/
first(quad_qags(exp(x)*x^4,x,-1,1));
(%o34) 0.552372779987656
Example 6. integrate(exp(x)*x^sqrt(2),x,0,1);
(%i35) F(sqrt(2),0,1);
(%o35)
%e^(-sqrt(2)*%i*%pi)*(gamma_incomplete(sqrt(2)+1,-1)-gamma(sqrt(2)+1))
(%i36) expand(float(rectform(%)));
(%o36) 0.858969157722264-5.551115123125783*10^-17*%i
(%i37) realpart(%);
(%o37) 0.858969157722264
(%i38) /*test*/
first(quad_qags(exp(x)*x^sqrt(2),x,0,1));
(%o38) 0.85896915771574
Example 7. integrate(exp(x)*x^4,x,-2,-1);
(%i39) F(4,-2,-1);
(%o39) gamma_incomplete(5,1)-gamma_incomplete(5,2)
(%i40) expand(float(rectform(%)));
(%o40) 1.175836092392821
(%i41) /*test*/
first(quad_qags(exp(x)*x^4,x,-2,-1));
(%o41) 1.175836092392819
Example 8. integrate(exp(x)*x^3,x,-2,-1);
(%i42) F(3,-2,-1);
(%o42) gamma_incomplete(4,2)-gamma_incomplete(4,1)
(%i43) expand(float(rectform(%)));
(%o43) -0.743330295751795
(%i44) /*test*/
first(quad_qags(exp(x)*x^3,x,-2,-1));
(%o44) -0.743330295751795
(%i45) build_info()$
Maxima version: 5.25.1
Maxima build date: 9:23 9/6/2011
Host type: i686-pc-mingw32
Lisp implementation type: Clozure Common Lisp
Lisp implementation version: Version 1.7-r14925M (WindowsX8632)
Aleksas D.