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

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

Search the Archive

Re: FindRoot in Version 5: corrected code

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46299] Re: FindRoot in Version 5: corrected code
  • From: bghiggins at ucdavis.edu (Brian Higgins)
  • Date: Fri, 13 Feb 2004 21:57:09 -0500 (EST)
  • References: <c0fh4j$9ls$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, Opps , the code I posted got warped when I copied it from the
notebook. The "?" should have been a omega. The correct code is given
below

It should have read:

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

Sorry for the confusion

Brian

 bghiggins at ucdavis.edu (Brian Higgins) wrote in message news:<c0fh4j$9ls$1 at smc.vnet.net>...
> Hi,
> 
> In version 4 I used the following code to solve nonlinear BVP using
> NDSolve
> 
> system[?_] := {y1'[x] == y2[
>     x], y2'[x] == -Sin[y2[x]] + Cos[5x], y1[-1] == 0, y2[-1] == ?};
> myODEsoln[?_] := NDSolve[system[?], {y1[x], y2[x]}, {x, -1, 1}]
> yend[?_] := (y1[x] /. myODEsoln[?]) /. x -> 1
> bc = FindRoot[First[yend[?]] == 0, {?, -2, 2}];
> Plot[Evaluate[y1[x] /. myODEsoln[? /. bc]], {
>       x, -1, 1}, AxesLabel -> {"x", "y1(x)"}];
> 
> In Version 5 is does not work. I have read on this group that FindRoot
> was modified so that it now requires that in the above code I replace
> yend[Q_] with yend[Q_?NumericQ]. But now the problem is that FindRoot
> fails to converge.
> 
> So my question: Does anyone know what other modifications have been
> made to FindRoot so that I can get this code and many others like it
> to work again?
> 
> Thanks much
> 
> Brian


  • Prev by Date: Re: How does one export a DXF file with PolygonsOnly set to true?
  • Next by Date: Fw: Re: oo system for Mathematica
  • Previous by thread: RE: question: How to get Mathematica to show more than one value of a complex valued function?
  • Next by thread: Re: Problem with FullSimplify in Version 5: Rationals are converted to Reals