[Date Index]
[Thread Index]
[Author Index]
Re: I can plot a function but when I try FindRoot it
*To*: mathgroup at smc.vnet.net
*Subject*: [mg92697] Re: [mg92678] I can plot a function but when I try FindRoot it
*From*: Bob Hanlon <hanlonr at cox.net>
*Date*: Sat, 11 Oct 2008 06:41:12 -0400 (EDT)
*Reply-to*: hanlonr at cox.net
You have a bad definition for k and should restrict myDs to numeric arguments.
myDs[p_?NumericQ] := FindRoot[f1[Ltotal*p, ds] - 1, {ds, 2.5}][[1, 2]]
Bob Hanlon
---- Toan <nguyenthetoan at gmail.com> wrote:
=============
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[3])/(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[3]
F0 Exp[-ds/c]);
f2[L_, ds_] := (Sqrt[3] 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}]
--
Bob Hanlon
Prev by Date:
**Re: Finite difference method with mathematica**
Next by Date:
**Inconsistent syntax for Row and Column?**
Previous by thread:
**Re: Export as PDF without " for strings**
Next by thread:
**Inconsistent syntax for Row and Column?**
| |