MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NDSolve

  • To: mathgroup at
  • Subject: [mg65714] Re: NDSolve
  • From: "atul" <atulksharma at>
  • Date: Sun, 16 Apr 2006 01:45:20 -0400 (EDT)
  • References: <e1nnch$lnr$>
  • Sender: owner-wri-mathgroup at

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)

Out[3]= InterpolatingFunction[{{0.,3.}},<>][x]

You can now apply Plot, D etc to y[x] as you usually do

Out[4]= InterpolatingFunction[{{0.,3.}},<>][x]

Out[5]= {4.00004}

Plot[{y[x], dy[x]}, {x, 0, 1}, PlotStyle -> {Yellow, Black}]


"Subbu" <subbaraokommuri at> wrote in message
news:e1nnch$lnr$1 at
> 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