Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10653 > unrolled thread
| Started by | "djmpark" <djmpark@comcast.net> |
|---|---|
| First post | 2012-06-27 08:14 +0000 |
| Last post | 2012-06-28 08:00 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: needed. "djmpark" <djmpark@comcast.net> - 2012-06-27 08:14 +0000
Re: needed. awnl <awnl@gmx-topmail.de> - 2012-06-28 08:00 +0000
| From | "djmpark" <djmpark@comcast.net> |
|---|---|
| Date | 2012-06-27 08:14 +0000 |
| Subject | Re: needed. |
| Message-ID | <jsefcl$i9u$1@smc.vnet.net> |
You could try this:
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,
WorkingPrecision -> 6]
And then maybe someone can explain why MachinePrecision fails but a
WorkingPrecision as low as 6 works.
David Park
djmpark@comcast.net
http://home.comcast.net/~djmpark/index.html
From: Cyril [mailto:cyril.stephanos@gmail.com]
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
[toc] | [next] | [standalone]
| From | awnl <awnl@gmx-topmail.de> |
|---|---|
| Date | 2012-06-28 08:00 +0000 |
| Message-ID | <jsh2vp$sb6$1@smc.vnet.net> |
| In reply to | #10653 |
Hi,
> 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,
> WorkingPrecision -> 6]
>
> And then maybe someone can explain why MachinePrecision fails but a
> WorkingPrecision as low as 6 works.
I think that's because Mathematica will use "arbitrary precision
numbers" (software emulated) instead of "machine precision numbers"
whenever WorkingPrecision is set to something different than
MachinePrecision, most probably using completely different algorithms
for anything related to tracking precision.
It's probably even more surprising if you compare
WorkingPrecision->MachinePrecision with WorkingPrecision->$MachinePrecision
hth,
albert
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web