       I can plot a function but when I try FindRoot it complains

• To: mathgroup at smc.vnet.net
• Subject: [mg92678] I can plot a function but when I try FindRoot it complains
• From: Toan <nguyenthetoan at gmail.com>
• Date: Fri, 10 Oct 2008 04:35:02 -0400 (EDT)

```Hi all,

I have a problem with Mathematica error that I don't know how to fix.
I define a function
f2 [L,ds(L)]  where ds(L) is found by solving f1(L,ds)==1.

When I plot f2 [L, ds(L)] as a function of L, everything is good.
However, when I try to
find the value of L where f2 ==1, Mathematica complains that f2 is not
a number?!

The mathematica cell is listed below.

Could someone help me with this error? I thank you in advance, a lot.

Toan

=================================
k5.62; Ro = 27.2; Ltotal = 13509.0; F0 = 1.2*10^4; c = 0.30;

R[L_, ds_] = Sqrt[Ro^2 - ((3 Sqrt)/(8 Pi) ds^2  L)^(2/3)];

f1[L_, ds_] := (k/(R[L, ds]^2 ds^2) +
3 k/
ds^2 (1/((Ro^2) - (R[L, ds]^2) ) +
Ro/(Ro^2 - R[L, ds]^2)^(3/2)
Log[(Ro - Sqrt[Ro^2 - R[L, ds]^2])/R[L, ds]]))/(Sqrt
F0 Exp[-ds/c]);

f2[L_, ds_] := (Sqrt F0 Exp[-(ds/c)] (c^2 + c ds) + k/(
2 (R[L, ds]^2) ))/(Pi);

myDs[p_] := ( result = FindRoot[f1[Ltotal*p, ds] - 1,  {ds, 2.5}];
result[[1, 2]]  )

Plot[f2[Ltotal*p, myDs[p]], {p, 0.01, 1.0}, PlotRange -> {0, 1}, Frame
-> True]

FindRoot[ f2[Ltotal*p, myDs[p] ]-1, {p,0.8}]

```

• Prev by Date: Re: Can Mathematica NIntegrate a Log-type singularity?
• Next by Date: Re: Math Formulas
• Previous by thread: Re: Why is this integral hard for mathematica?
• Next by thread: Re: I can plot a function but when I try FindRoot it complains