MathGroup Archive 2006

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

Search the Archive

Re: NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65687] Re: NDSolve
  • From: bghiggins at ucdavis.edu
  • Date: Sun, 16 Apr 2006 01:44:44 -0400 (EDT)
  • References: <e1nnch$lnr$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

You can evaluate the derivate from the solution in several ways. The
first way (not the most convenient) is

sol1 = NDSolve[{y''[x] == Cos[y[x]], y[0] == 1, y'[0] == 0}, y[x], {x,
1, 10}]

{{y[x] -> InterpolatingFunction[{{1., 10.}}, <>][x]}}

Then to determine the derivative at a point

D[y[x]/.sol1,x]/.x->2.

{0.519544}

If you are interested in the value of the derivative and plotting the
derivative (i.e a phase plot), then it is more convienet to get the
rule for the solution in the form  y->InterpolationFunction rather than
y[x]->InterpolationFunction as follows:

sol2 = NDSolve[{y''[x] == Cos[y[x]], y[0] == 1, y'[0] == 0}, y, {x, 1,
10}]

{{y -> InterpolatingFunction[{{1., 10.}}, <>]}}

Then to find the derivative we simply evaluate

y'[2.]/.sol2

{0.519544}

Hope this helps,

Cheers,

Brian


  • Prev by Date: Re: NDSolve
  • Next by Date: Re: Problems with DirectoryName
  • Previous by thread: Re: NDSolve
  • Next by thread: Re: NDSolve