MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How can I get this spiked Integral evaluated???


Zeno wrote:
> This is an integral with a spike that is not in the middle of the
> integral range. Here is the integral...
> 
> NIntegrate[Exp[-x^2], {x, -900, 1000}]
> 
> Mathemtaica 5.2.2 gives this error message....
> 
>  "Numerical \integration stopping due to loss of precision. Achieved
> neither the requested \PrecisionGoal nor AccuracyGoal; suspect one of
> the following: highly \oscillatory integrand or the true value of the
> integral is 0. If your \integrand is oscillatory on a (semi-)infinite
> interval try using the option \Method->Oscillatory in NIntegrate. 
> More?
> 
> However, to use the option "Method->Oscillatory" one of the bounds of
> the integral must be infinity, so that would not work here. How do I
> get it to to the integral in the range -900 to 1000??
> The correct answer is 1.77245.
> 

Do you have any particular reason for not doing a symbolic integration 
(returning an exact result) first, then asking for a numeric result to 
any precision you might want?

In[1]:=
Integrate[Exp[-x^2], {x, -900, 1000}]

Out[1]=
1
- Sqrt[Pi] (Erf[900] + Erf[1000])
2

In[2]:=
N[%]

Out[2]=
1.77245

In[3]:=
N[%%, 30]

Out[3]=
1.77245385090551602729816748334

Regards,
Jean-Marc


  • Prev by Date: Re: how to sort integers and sparsearrays ?
  • Next by Date: Re: radical equation
  • Previous by thread: Re: How can I get this spiked Integral evaluated???
  • Next by thread: radical equation