RE: The equivalent of FindRoot for an interpolating function
- To: mathgroup at smc.vnet.net
- Subject: [mg37476] RE: [mg37470] The equivalent of FindRoot for an interpolating function
- From: "Florian Jaccard" <jaccardf at eicn.ch>
- Date: Fri, 1 Nov 2002 01:42:44 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello Philip !
You can do it like this :
In[1]:=NDSolve[{y'[t] == 1-y[t], y[0]==0}, y[t], {t, 0, 20}]
In[2]:=y[t_]=y[t]/.%[[1]]
In[3]:=Plot[y[t],{t,0,10},PlotRange->{0,2}]
In[4]:=FindRoot[y[t]==.999,{t,1}]
Meilleures salutations
Florian Jaccard
EICN-HES
e-mail : jaccardf at eicn.ch
-----Message d'origine-----
De : Philip M. Howe [mailto:pmhowe at lanl.gov]
Envoyé : jeu., 31. octobre 2002 10:42
À : mathgroup at smc.vnet.net
Objet : [mg37470] The equivalent of FindRoot for an interpolating
function
Hi Folks,
I wish to find the value of the independent variable in an
interpolating function that makes the dependent variable assume some
value of interest. For example,
sol = NDSolve[{y'[t] == 1-y[t], y[0]==0}, y, {t, 0, 20}]
fy = y/.sol[[1]]
produces an interpolating function. I would like to extract the
value of t that yields a value of 0.99 or 0.9999 (say) for y. Is
there a straightforward way of doing this?
Thanks in advance for the help.
Regards,
Phil
--
Philip M. Howe
Program Manager, Stockpile Surety
Los Alamos National Laboratory
(505) 665-5332
(505) 667-9498
Fax: 505-665-5249
email pmhowe at lanl.gov
Mail Stop P945