Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: FindRoot/NDSolve problem in VS5

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54851] Re: FindRoot/NDSolve problem in VS5
  • From: bghiggins at ucdavis.edu
  • Date: Fri, 4 Mar 2005 05:07:47 -0500 (EST)
  • References: <d060tf$kpt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Tony, Due to changes in FindRoot in version 5 you need  to add the
following line to your code

BC[s_?NumericQ] := ((y[x] /. eqsol[s][[1]] ) /. x -> 1)

Then the algorithm for the shooting method is

deq = y''[x] - x^2 y[x] == x + x^3;
eqsol[s_] := NDSolve[{deq, y[-1] == 0, y'[-1] == s}, y[x], {x, -1, 1}]
y[x] /. eqsol[1][[1]] /. x -> 1;
BC[s_?NumericQ] := ((y[x] /. eqsol[s][[1]] ) /. x -> 1)
ss = FindRoot[BC[s] == 0, {s, 0, 10}]
ysol[x_] = y[x] /. eqsol[s /. ss][[1]]

Out[5]=
{s -> 0.5197957482122294}

Out[6]=
InterpolatingFunction[][x]

Cheers,

Brian


  • Prev by Date: Re: Goto Line ?
  • Next by Date: Re: Goto Line ?
  • Previous by thread: FindRoot/NDSolve problem in VS5
  • Next by thread: FindRoot/NDSolve problem in VS5