MathGroup Archive 2004

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

Search the Archive

Re: Iteration of Initial Conditions for required Boundary Value with NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52862] Re: Iteration of Initial Conditions for required Boundary Value with NDSolve
  • From: "Narasimham" <mathma18 at hotmail.com>
  • Date: Wed, 15 Dec 2004 04:26:23 -0500 (EST)
  • References: <cpejtd$6vr$1@smc.vnet.net><cpjqm8$nt4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

bghiggins at ucdavis.edu wrote:
> If I understand your problem correctly,  believe the problem as
stated
> is overspecified. You cannot  specify smax and then search for a
value
> of sz such that x(smax)=3 and y(smax)=2. What you need to do is
search
> for both sz and smax . One way to do this is to use a shooting
method.
> The following code does the task automatically given initial guesses
> for sz and smax. I should point out that the solution space has a
> turning point(limit point) so there are likely two solutions.
depending
> on what your initial guesses are for sz and smax. I have a web site
> that has a notebook that discusses the shooting method in some
detail:
> http://www.higgins.ucdavis.edu/chemmath.php
>
> Here is the code for your problem
>
> kgi = 3 10^-3; soln[sz1_, smax1_] := NDSolve[{ph''[
> s] == ph'[s]/s, ph[sz1] == 10^-7, ph'[sz1] == kgi,
> x'[s] == Cos[ph[s]], x[sz1] == 0, y'[s] == Sin[ph[s]], y[sz1] == 0},
> {ph, x, y}, {s, sz1, smax1}];
>
> yend[sz1_?NumericQ, smax1_?NumericQ] := First[y[smax1] /. soln[sz1,
> smax1]]
> xend[sz1_?NumericQ, smax1_?NumericQ] := First[x[smax1] /. soln[sz1,
> smax1]]
>
> val = {sz1,
> smax1} /. FindRoot[Evaluate[{yend[sz1, smax1] == 2, xend[
> sz1, smax1] == 3}], {sz1, 0.01, 0.02}, {smax1, 3.5, 4}];
>
> xyplot[{sz1_,
> smax1_}] := ParametricPlot[Evaluate[{x[s], y[s]} /. soln[sz1,
> smax1]], {s, sz1, smax1}]
> xyplot[val]

Many thanks. Just some arbitrary values were assigned for sz and smax
to start with in iteration/perturbation. Furthermore,is it possible to
trace sz and smax using a shooting iteration index so that we can see
how it happened a in diverging case? It may help in proper choice of
initial/boundary constants.


  • Prev by Date: Re: Re: multiple outputs from a function
  • Next by Date: Re: Intersection of two surfaces in 3D
  • Previous by thread: Re: Iteration of Initial Conditions for required Boundary Value with NDSolve
  • Next by thread: How input stacked characters with vertical bar