FindRoot/NDSolve problem in VS5
- To: mathgroup at smc.vnet.net
- Subject: [mg54822] FindRoot/NDSolve problem in VS5
- From: "Dr A.H. Harker" <a.harker at ucl.ac.uk>
- Date: Wed, 2 Mar 2005 22:29:11 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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