Re: Integrate vs NIntegrate
- To: mathgroup at smc.vnet.net
- Subject: [mg89158] Re: [mg89129] Integrate vs NIntegrate
- From: "W_Craig Carter" <ccarter at mit.edu>
- Date: Tue, 27 May 2008 07:16:06 -0400 (EDT)
- References: <200805261023.GAA15126@smc.vnet.net>
Hello Armen,
Here are a few changes to your code:
q = -1/2; a = 0; b = 3;
h[x_] := (1 + x^3)^q (* delayed evaluation := *)
f[x_] := Integrate[h[z], {z, 0, x}]; (*z is an integration variable...
the integration is a function of its limits*)
Res1 = N[f[b] - f[a]]
Res2 = NIntegrate[h[x], {x, a, b}]
Craig
On Mon, May 26, 2008 at 6:23 AM, Armen Kocharyan
<armen.kocharyan at gmail.com> wrote:
> 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}]*
--
W. Craig Carter
- References:
- Integrate vs NIntegrate
- From: "Armen Kocharyan" <armen.kocharyan@gmail.com>
- Integrate vs NIntegrate