Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: Higher precision in Error function Erf[] needed.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127043] Re: Higher precision in Error function Erf[] needed.
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Wed, 27 Jun 2012 04:05:58 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jsbt4i$6pq$1@smc.vnet.net>

On Jun 26, 1:50 am, Cyril <cyril.stepha... at gmail.com> wrote:
> Hi everyone
>
> I am using the error function as part of differential equations I am solving with NDSolve.
> Unfortunately, for certain parameters, the error function Erf[] starts oscillating and yielding wrong values.
>
> The oscillation does not show when I plot the error function itself, but when I plot this expression
>
> Plot[Exp[8*(10 - Abs[10 - 20000*x])]*(1 - Erf[(8*(10 - Abs[10 - 20000*x]))^(1/2)]), {x, 0, 1*10^(-3)}, PlotRange -> Full]
>
> it becomes visible.
>
> When I do the integration for error function with NDSolve manually and plot the expression, the oscillation vanishes for high values of PrecisionGoal and WorkingPrecision, e.g.
>
> Plot[ Exp[8*(10 - Abs[10 - 20000*x])]*(1 - NIntegrate[ 2/Sqrt[Pi] Exp[-t^2], {t, 0, (8*(10 - Abs[10 - 20000*x]))^(1/2)}, PrecisionGoal -> 40, WorkingPrecision -> 40]), {x, 0, 1*10^(-3)}, PlotRange -> Full]
>
> The oscillation of Erf[] is not only visible in the plot, it also leads to wrong results in my calculations.
>
> I tried to increase the precision of Erf[] by using N[Erf[],n] with very high values for n - as described in the Mathematica help - but it does not change anything.
>
> Solving the Integral for the error function manually with NDSolve yields two problems. It is very slow - it takes about three minutes on my computer (I have to solve many equations) - whereas Erf[] is much faster. And it seems that I cannot use NDSolve as part of an equation I want to solve with NDSolve itself.
>
> Is there a possibility to increase the precision of Erf[] and obtain more accurate results?
>
> Thank you in advance for your help.
>
> Best regards
> Cyril

Change  (1 - Erf[...])  to  Erfc[...] .



  • Prev by Date: Re: Combining Two Lists
  • Next by Date: Re: Default path for opening files
  • Previous by thread: Higher precision in Error function Erf[] needed.
  • Next by thread: Re: Higher precision in Error function Erf[] needed.