       Re: NDSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg65712] Re: NDSolve
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sun, 16 Apr 2006 01:45:18 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <e1nnch\$lnr\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Subbu wrote:
> 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
>
Hi,

Just use the prime symbol to get the value of the derivative at a given
point. For example,

In:=
eqns = {Derivative[y][x] == y[x] + Sin[x],
y == 2};

In:=
sol = NDSolve[eqns, y, {x, 0, 1}]

Out=
{{y -> InterpolatingFunction[]}}

In:=
y[x] /. sol /. x -> 0.5

Out=
{3.4432988011900783}

In:=
Derivative[y][x] /. sol /. x -> 0.5

Out=
{3.9227506080049612}

In:=
Plot[{y[x] /. sol, Derivative[y][x] /. sol},
{x, 0, 1}, PlotStyle -> {Blue, Red}];

Best regards,
Jean-Marc

```

• Prev by Date: Fitting a complex Function with FindMinimum
• Next by Date: Re: List Operations
• Previous by thread: Re: NDSolve
• Next by thread: Re: NDSolve