Re: Integrate vs NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg89161] Re: [mg89129] Integrate vs NIntegrate
- From: danl at wolfram.com
- Date: Tue, 27 May 2008 07:16:39 -0400 (EDT)
- References: <200805261023.GAA15126@smc.vnet.net>
> Dear group,
>
> Why do I get different results (Res1, Res2) in Mathematica 6.0.1.0?
>
> *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}]*
Why do you put in these asterisks? They make cut-and-paste a real pest.
> **
>
> *Res1 = -2.55387-2.42865 i*
>
> *Res2 = 1.65267*
>
> I'm assuming that Res2 is the correct answer.
>
> Regards,
>
> Armen
The antiderivative, f[x], has a jump discontinuity due to a branch cut
that is either at or very near to x=2 (probably at). Have a look at
Plot[{Re[f[x]], Im[f[x]]}, {x, 0, 3}]
Thus evaluation at the endpoints will fail to recover the definite
integral. Integrate[h[x], {x, a, b}] will give a more plausible result, in
accord with the NIntegrate value.
Daniel Lichtblau
Wolfram Research
- References:
- Integrate vs NIntegrate
- From: "Armen Kocharyan" <armen.kocharyan@gmail.com>
- Integrate vs NIntegrate