Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*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 2003

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

Search the Archive

Re: NDSolve does not work in shooting method

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44143] Re: NDSolve does not work in shooting method
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 24 Oct 2003 04:24:12 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <bn8du7$nfi$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

system[a_?NumericQ] := {y1'[x] == y2[x], y2'[x] == -Sin[y2[x]] +
Cos[5x],
y1[-1] == 0,
      y2[-1] == a};
myODEsoln[a_?NumericQ] := NDSolve[system[a], {y1[x], y2[x]}, {x, -1, 1}]
yend[a_?NumericQ] := (y1[x] /. myODEsoln[a]) /. x -> 1
bc = FindRoot[First[yend[a]] == 0, {a, -2, 2}];
Plot[Evaluate[y1[x] /. myODEsoln[a /. bc]], {x, -1, 1},
    AxesLabel -> {"x", "y1(x)"}];

Regards
  Jens

Alexander Koulidis wrote:
> 
> This comes from a newbie in Mathematica, so have some mercy....
> 
> I'm trying to reproduce some examples of the shooting method that have been
> published in this forum, but Mathematica 5.0 shows some strange behavior
> with NDSolve.
> 
> In http://forums.wolfram.com/mathgroup/archive/2001/Aug/msg00128.html Brian
> wrote:
> 
> The following code implements the shooting technique
> 
> system[a_] := {y1'[x] == y2[x], y2'[x] == -Sin[y2[x]] + Cos[5x],
> y1[-1] == 0,
>       y2[-1] == a};
> myODEsoln[a_] := NDSolve[system[a], {y1[x], y2[x]}, {x, -1, 1}]
> yend[a_] := (y1[x] /. myODEsoln[a]) /. x -> 1
> bc = FindRoot[First[yend[a]] == 0, {a, -2, 2}];
> Plot[Evaluate[y1[x] /. myODEsoln[a /. bc]], {x, -1, 1},
>     AxesLabel -> {"x", "y1(x)"}];
> 
> While the code was working fine in v. 4.2, now it produces warnings of
> "NDSolve::ndinnt :" or "RuleDelayed::rhs".
> Can someone test this code in v5.0? Does anyone have some idea of what is
> happening and should I implement a typical shooting method?
> Thanks in advance.
> Alexander Koulidis, Athens, Greece


  • Prev by Date: Re: How do I make Combinatorica graphs of publishable quality?
  • Next by Date: Re: New version, old bugs
  • Previous by thread: NDSolve does not work in shooting method
  • Next by thread: Re: NDSolve does not work in shooting method