time consumption FindRoot

• To: mathgroup at yoda.physics.unc.edu
• Subject: time consumption FindRoot
• From: wiawmat at dutiws.twi.tudelft.nl (R.Schotting.AW-tel-5044)
• Date: Thu, 26 Nov 92 18:11:33 +0100

```Hi MathGroup

recently I stumbled into the folowing problem:

I tried to find the root of a certain function (repeatedly, with different
arguments) and wondered what was taking Mma so long.After I traced the part
where it was going wrong, I figured out that FindRoot took more time, each time
it was called! Even for the same arguments!
Has anyone an idea why?, and how I might avoid this?
(Making plots and tables using this function, evaluation times become far too
long).

Thanks for any help on this,

Ted van der Togt,
Delft, the Netherlands
email wiawmat at dutiws.twi.tudelft.nl

===========================================================

In[1]=
z[Pr_,Tr_]:=
Module[{rho,rhoR},
rhoR=FindRoot[
0.06423 rho^6 + rho^3 (-0.6123 + 0.5353 Tr) +
rho^2 (-1.0467 - 0.5783/Tr^2 + 0.3151 Tr) +
rho Tr + (0.6816 rho^3 (1 + 0.6845 rho^2))/
(Exp[0.6845 rho^2] Tr^2)  -0.27 Pr==0,
{rho,0.27 Pr/Tr}][[1,2]];
0.27 Pr/(rhoR Tr)]

In[2]=
z[2,2]//Timing
Out[2]=
{1.58333 Second, 0.945576}

In[3]=
z[2,2]//Timing
Out[3]=
{1.68333 Second, 0.945576}

|
|

In[20]=
z[2,2]//Timing
Out[4]=
{10.18333 Second, 0.945576}

(Timimgs on MacII / System 7.1 / Mma 2.102 Enhanced)

```

• Prev by Date: Re: Font problem and Postscr
• Next by Date: solving large (53000 equations) systems of linear ODEs with Mma
• Previous by thread: A List of Mathematica Functions
• Next by thread: solving large (53000 equations) systems of linear ODEs with Mma