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: [mg54848] Re: FindRoot/NDSolve problem in VS5
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 4 Mar 2005 05:07:44 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <d060tf$kpt$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a) this is not a multiple shooting solution, this is a simple shooting
   because a multiple shooting would have additional inner points.
b) Try
deq = y''[x] - x^2 y[x] == x + x^3;

Remove[eqsol]
eqsol[s_?NumericQ] := (y[x] /.
NDSolve[{deq, y[-1] == 0, y'[-1] == s}, y[x], {x, -1, 1}][[1]])
eqsol[s_?NumericQ, endp_?NumericQ] := eqsol[s] /. x -> endp



ss = FindRoot[eqsol[s, 1] == 0, {s, 0, 10}]
ysol[x_] = eqsol[s /. ss]


Regards

  Jens



"Dr A.H. Harker" <a.harker at ucl.ac.uk> schrieb im Newsbeitrag 
news:d060tf$kpt$1 at smc.vnet.net...
>
>  Can anybody explain why the following simple illustration of a multiple
> shooting solution works under Mathematica V4, but fails under V5.0?
>
> 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;
> ss = FindRoot[((y[x] /. eqsol[s][[1]] ) /. x -> 1) == 0, {s, 0, 10}]
> ysol[x_] = y[x] /. eqsol[s /. ss][[1]]
>
>  To add to the confusion, the following is fine in both versions.
>
> ch[k_] = y''[x] - k Sqrt[1 + y'[x]^2] == 0
> guess[s_] := NDSolve[{ch[.35], y[0] == 0, y'[0] == s}, y[x], {x, 0, 10}]
> ssol = FindRoot[((y[x] /. guess[s][[1]]) /. x -> 10) == 0, {s, -1, -10}]
> soln[x_] = y[x] /. guess[s /. ssol][[1]]
>
> Tony Harker
> Department of Physics and Astronomy
> University College London
> Gower Street
> LONDON
> WC1E  6BT
> (44)(0)207 679 3404
> a.harker at ucl.ac.uk
>
>
> 



  • Prev by Date: Re: Rearranging a data array containing calendrical as well as data entries.
  • Next by Date: Re: Re: computing residues
  • Previous by thread: FindRoot/NDSolve problem in VS5
  • Next by thread: Contexts and DumSave