using WorkingPrecision and AccuracyGoal to control the error of estim.

• To: mathgroup at smc.vnet.net
• Subject: [mg17068] using WorkingPrecision and AccuracyGoal to control the error of estim.
• From: Jan Krupa <krupa at alpha.sggw.waw.pl>
• Date: Fri, 23 Apr 1999 02:32:08 -0400
• Organization: NewsServer at NASK N.O.C.
• Sender: owner-wri-mathgroup at wolfram.com

```Probably this is a basic problem in general numeric computation
not only in Mathematica3.0.

Suppose I would like to find numerically, using the FindRoot built in
function,
the root of the equation x^4-16=0. Let f[x]=x^2-16 and
"ex" the exact solution
"ax" the approximated solution obtained by FindRoot.

Is there an ability (rule) to choose proper WorkingPrecision,
AccuracyGoal
(in some other function PrecisionGoal) and MaxIteration
to obtain the solution which fulfil the following condition:
cond1: er1=Abs[ex-ax]<epsilon  and
cond2: er2=Abs[f[ax]]<epsilon,
as an example put say epsilon=10^(-6).

Should I first to set AccuracyGoa->at least 6 and WorkingPrecision-> at
least 6 ?
Now FinRoot will of course only attempts to get the condition cond1 to
be
fulfilled (thanks to WorkingPrecision->6) but there is no option in
FindRoot
to control the cond2 (am I right?). Are there any rules how to choose
WorkingPrecision and AccuracyGoal  to achieve er1 and er2 < 10^-6
(e.g.WorkingPrecision>=AccuracyGoal>=6?)

Ot[1]:=f[x_]:=x^4-16;

In[2]:=sol=FindRoot[f[x]==0,{x,1},WorkingPrecision->25, AccuracyGoal->6]

Out[2]={x->2.000000000000000000001097}

In[3]:=f[x]/.sol
Out[3]=3.51x10^-20

We see that we got much smaller er1 and er1 then 10^-6.

But how to set WorkingPrecision and AccuracyGoal
to solve the following (and to get er1<10^-6)

In[1]:=g[x_]:=Exp[-x]-x;
In[2]:=solg=FindRoot[g[x]==0,{x,1},WorkingPrecision->25,
AccuracyGoal->6]
Out[2]={x->0.567143290409783869463836}

In[3]:=g[x]/.solg
Out[3]=5.541626=D710^-18
?

How can I ensure that er1 is really less then 10^-6 ? Should I write
own procedure with special stopping criteria?

What about the other numeric functions in MA?
e.g. NDSolve:

od1=NDSolve[{x'[t]==x[t],x[0]==1},x[t],{t,0,2},WorkingPrecision ->30,
AccuracyGoal->6]

How to set WorkingPrecision and AccuracyGoal
to solve the od1  and to get er1=Abs[xe[t]-xa[t]] < 10^-6?

Could someone please suggest book, article or url where could be found
description of the strategies how to obtain numerical solution
using all the mathematica3.0 (or more general book on numerical
computations)
function with given an arbitrary error or
how to estimate the error after calculation?