Difference between area under curve and integrate
- Subject: Difference between area under curve and integrate
- From: Aleksas Domarkas
- Date: Mon, 9 Jan 2012 21:28:47 +0200
from http://www.math.utexas.edu/pipermail/maxima/2012/027370.html
Problem. Compute inntegrate(f,x,-1,2), where
(%i1) f:exp(-signum(x-1)*x^3);
(%o1) %e^(-x^3*signum(x-1))
More shorter solution:
(%i2) wxplot2d([f], [x,-1,2])$
(%t2) << Graphics >>
Let
integrate(f,x,-1,2)=
integrate(f,x,-1,0)+integrate(f,x,0,1)+integrate(f,x,1,2)
(%i3) integrate(f,x,-1,0)+integrate(f,x,0,1)+integrate(f,x,1,2)$
(%i4) float(%),expand;
(%o4) 2.234857932271296-3.33066907387547*10^-16*%i
Solution:
(%i5) sol:realpart(%);
(%o5) 2.234857932271296
(%i6) /* test */
first(quad_qags(f,x,-1,2));
(%o6) 2.234857932271401
Sorry, integrate(exp(x^3),x,0,1) Maxima compute correct.
But wrong
(%i7) integrate(exp(x^4),x,0,1);
(%o7) (%i*((-1)^(3/4)*gamma_incomplete(1/4,-1)-(-1)^(3/4)*gamma(1/4)))/4
(%i8) float(%),expand;
(%o8) 0.898935732712736*(-1)^(3/4)-0.898935732712736*(-1)^(3/4)*%i
(%i9) float(rectform(%));
(%o9) 1.271287104904147*%i+7.850462293418875*10^-17
(%i10) /* test */
first(quad_qags(exp(x^4),x,0,1));
(%o10) 1.271287104904147
Aleksas D.