Re: Getting the value of the independent var from the dep.var using NDSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg63684] Re: Getting the value of the independent var from the dep.var using NDSolve
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 10 Jan 2006 01:48:39 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <dptd4r$be$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
pradeep suresh wrote: > Hi all, > i have a specific problem of finding the point at which the dependent > variable takes on a particular value in teh solution of a differential > equation. > e.g. for simplicity > we have the equation y'[t]==t, and the initial cond. y[0]==0.y is the > dep. variable and t is the independent variable. > i want to find out the 't' at which y[t]==p(p is known, say 8) > and since i am already using NDSolve to solve this and other equations > i'd like to achieve this working around NDSolve, > could anyone suggets a solution to this problem?? > thanks a ton! > Pradeep > Hi Pradeep, Is something like the following lines may help you? In[1]:= sol=NDSolve[{y'[t]\[Equal]t,y[0]\[Equal]0}, y, {t, 0, 10}] Out[1]= {{y\[Rule]InterpolatingFunction[{{0.,10.}},<>]}} In[2]:= FindRoot[Evaluate[y[t]/.sol[[1,1]]]\[Equal]8,{t,7}] Out[2]= {t\[Rule]4.} In[3]:= y[4]/.sol[[1,1]] Out[3]= 8. Best regards, /J.M.