Re: Integrate vs NIntegrate

*To*: mathgroup at smc.vnet.net*Subject*: [mg89144] Re: [mg89129] Integrate vs NIntegrate*From*: DrMajorBob <drmajorbob at att.net>*Date*: Tue, 27 May 2008 07:13:31 -0400 (EDT)*References*: <9489155.1211802216995.JavaMail.root@m08>*Reply-to*: drmajorbob at longhorns.com

The fundamental theorem of calculus frequently does not apply when, as in your example, Integrate is free to return a Complex-valued function. (A better question is why you put in all those extraneous stars to inhibit copy/pasting the code.) Despite that, here's a slightly different approach where the FTC does apply: q = -1/2; a = 0; b = 3; h[x_] = (1 + x^3)^q; f[x_] = Integrate[h[t], {t, 0, x}] If[x >= -1, (x^3)^(1/3) Hypergeometric2F1[1/3, 1/2, 4/3, -x^3], Integrate[1/Sqrt[1 + t^3], {t, 0, x}, Assumptions -> x < -1]] Res1 = N[f[b] - f[a]] Res2 = NIntegrate[h[x], {x, a, b}] 1.65267 1.65267 Contrast that definition of f with yours: Integrate[h[x], x] (1/(3^(1/4) Sqrt[1 + x^3]))2 (-1)^( 1/6) Sqrt[-(-1)^(1/6) ((-1)^(2/3) + x)] Sqrt[ 1 + (-1)^(1/3) x + (-1)^(2/3) x^2] EllipticF[ArcSin[Sqrt[-(-1)^(5/6) (1 + x)]/3^(1/4)], (-1)^(1/3)] If you plot both versions from a to b (use PlotRange->All to be sure), you'll find that your version is complex on part of the range (between 2 and 3), but mine is real. Bobby On Mon, 26 May 2008 05:23:35 -0500, Armen Kocharyan <armen.kocharyan at gmail.com> wrote: > *q=-1/2; a=0; b=3;* > *h[x_]=(1+x^3)^q;* > *f[x_]=Integrate[h[x],x];* > *Res1=N[f[b]-f[a]]* > *Res2=NIntegrate[h[x],{x,a,b}]* -- DrMajorBob at longhorns.com