[Date Index]
[Thread Index]
[Author Index]
Re: NDSolve
*To*: mathgroup at smc.vnet.net
*Subject*: [mg65714] Re: NDSolve
*From*: "atul" <atulksharma at yahoo.com>
*Date*: Sun, 16 Apr 2006 01:45:20 -0400 (EDT)
*References*: <e1nnch$lnr$1@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
In terms of pure functions, just continue as for y[x] i.e.
y[0.5] /. sol
Out[1]= {2.}
D[y[x] /. sol, x] /. x -> 0.5
Out[2]= {4.00004}
(aesthetically nicer to use sol[[1]] or First[sol] to get rid of those pesky
brackets :)
Another way is to first convert the solution to a regular expression (though
this assigns y and it needs to be cleared before re-using it later)
y[x_]=y[x]/.sol
Out[3]= InterpolatingFunction[{{0.,3.}},<>][x]
You can now apply Plot, D etc to y[x] as you usually do
dy[x_]=D[y[x],x]
Out[4]= InterpolatingFunction[{{0.,3.}},<>][x]
dy[0.5]
Out[5]= {4.00004}
Plot[{y[x], dy[x]}, {x, 0, 1}, PlotStyle -> {Yellow, Black}]
HTH
"Subbu" <subbaraokommuri at gmail.com> wrote in message
news:e1nnch$lnr$1 at smc.vnet.net...
> Hi,
>
> I have a question regarding usage of solution given by NDSolve function
>
> Suppose We have solved one ODE with NDSolve, it will give the solution
> as interpolating function. Suppose I am solving a ODE for solution of y
> as a function of x, I will get solution like
> {y -> InterpolatingFunction[{{0., 1.}}, <>]}.
>
> Now I can get the values of y at any x using y[x]/.sol/.x->0.5
>
> But Suppose I want to evaluate the y' [x](Derivative of y) how can we
> get it that from the solution of NDSolve
>
> Thank you
>
Prev by Date:
**Re: List Operations**
Next by Date:
**problems with sum functions/ factoring the factorial**
Previous by thread:
**Re: NDSolve**
Next by thread:
**NDSolve**
| |