[Date Index]
[Thread Index]
[Author Index]
Re: The strange behaviour of NIntegrate
*To*: mathgroup at smc.vnet.net
*Subject*: [mg53527] Re: [mg53508] The strange behaviour of NIntegrate
*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>
*Date*: Sat, 15 Jan 2005 21:08:01 -0500 (EST)
*References*: <200501150644.BAA25316@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On 15 Jan 2005, at 07:44, Zaeem Burq wrote:
>
> Dear all,
>
> I'll describe the problem briefly first as follows:
>
> I am trying to NIntegrate a nice function (which I know is
> integrable), of
> the form
>
> K[s] = h[s]/[(1-s)^1.5] from 0 to 1.
>
> The function is real, but Mathematica spits out a COMPLEX answer!!
> Admittedly, the complex part is very small, and if I truncate the
> integral
> just below 1, the complex bit disappears and changes the real part very
> slightly.
>
> It seems obvious that Math'ca is choosing the last s value just beyond
> 1,
> producing the Sqrt of a negative number in the denominator.
>
> If interested, here are the calculations and results. Read on if you
> think
> you can help. Thanx.
>
> \!\(\(\[CurlyPhi][
> x_] := \[ExponentialE]\^\(\(-x\^2\)/2\)\/\@\(2 \[Pi]\);\)\n
> \(K[s_] := \(\(\ \)\(\((1 - \@s)\)\ \[CurlyPhi][\(1 - \@s\)\/\@\(1 -
> s\)]\)\
> \)\/\((1 - s)\)\^1.5`;\)\)
>
> NIntegrate[K[s], {s, 0, 1}]
>
> gives \!\(\(\(0.4206155890394436`\)\(\[InvisibleSpace]\)\) -
> 3.304807577181973`*^-49\ \[ImaginaryI]\)
>
> and
>
> NIntegrate[K[s], {s, 0, .999999}]
>
> results in
>
> 0.420217
>
> Any thoughts?
>
> Zaeem.
>
>
> Zaeem Burq
> PhD Stochastic Processes,
> Dept. of Mathematics and Statistics,
> Unimelb.
>
> Room 201, Richard Berry Building
> University of Melbourne,
> Parkville, VIC 3052.
>
> ph: 8344 4248.
>
> http://www.ms.unimelb.edu.au/~zab
>
>
This is completely normal and is exactly what Chop is for:
$B&U(B[x_] := 1/(E^(x^2/2)*Sqrt[2*Pi]);
K[s_] := ((1 - Sqrt[s])*$B&U(B[(1 - Sqrt[s])/Sqrt[1 - s]])/
(1 - s)^1.5;
Chop[NIntegrate[K[s], {s, 0, 1}]]
0.4206155890394436
Andrzej Kozlowski
Chiba, Japan
http://www.akikoz.net/~andrzej/
http://www.mimuw.edu.pl/~akoz/
Prev by Date:
**Re: The strange behaviour of NIntegrate**
Next by Date:
**Re: The strange behaviour of NIntegrate**
Previous by thread:
**The strange behaviour of NIntegrate**
Next by thread:
**Re: The strange behaviour of NIntegrate**
| |