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: NDSolve, FindRoot and shooting method - PROBLEM SOLVED

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57503] Re: [mg57430] NDSolve, FindRoot and shooting method - PROBLEM SOLVED
  • From: <topolog at gazeta.pl>
  • Date: Sun, 29 May 2005 21:00:23 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

For those who are interested: an hour ago I manage to implement
shooting method in v. 5.1. Valid code lines look as follows

dYdX = EQJ;
Y1X1 = {v[z1] == BCV1, v'[z2] == BCV1};
eqset = Join[{dYdX == 0.}, Y1X1];
ndsolut[w_?NumericQ] := NDSolve[eqset /. {W -> w}, v, {z, z1, z2},
SolveDelayed -> True][[1, 1, 2]];

FindRoot[(ndsolut[w])[z2] == BCV3, {w, wdef[[1]], wdef[[2]]}]

Regards


>
> On 5/28/05, topolog at gazeta.pl <topolog at gazeta.pl> wrote:
> > Dear Mathematica Users,
> >
> > This is a valid part of a code that provides shooting method to
> > solve equation EQJ = J1(W,z)*v(z) + J2(W,z)*v'(z) + J3(W,z)*v''(z)
> > == 0 (--THIS IS THE CORRECT FORM!!--)
> > with W - an eigenvalue:
> >
> > dYdX[W_?NumericQ] := EQJ; (* the equation *)
> > Y1X1[W_?NumericQ] := {v[z1] == BCV1, v'[z2] == BCV2}; (* boundary
> > conditions, BCV2 is W-dependent *)
> > eqset[W_?NumericQ] := Join[{dYdX[W] == 0.}, Y1X1[W]]; (* the set of
> > the above *)
> >
> > (* function that solves eqset for the specified W *)
> > ndsolut[W_?NumberQ] := NDSolve[eqset[W], v, {z, z1, z2}][[1, 1, 2]];
> >
> > (* searching for W that satisfies another boundary condition *)
> > FindRoot[ndsolut[W][z2] == BCV3, {W, W1, W2}]
> >
> > While in version 4.0 of Mathematica similar code was able to find
> > solutions quickly and accurately, the 5.1 version breaks after 100
> > iterations in FindRoot:
> >
> > FindRoot::cvmit: Failed to converge to the requested accuracy or
> > precision within 100 iterations
> >
> > Any sugestion, please.
> >
> > Rafal Kosinski
> >
> > P.S. The J-functions are rather complex so I do not present them
> > here. They are dependent of z-coordinate through
> > InterpolatingFunction[{{0., 3000.}}, <>][z] and of W in powers from
> > 1 to 10.




  • Prev by Date: Creating hyperlinks from text?
  • Next by Date: Re: How to get decent quality plots.
  • Previous by thread: Creating hyperlinks from text?
  • Next by thread: Re: Re: FindRoot: Failed to converge to the