MathGroup Archive 2005

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

Search the Archive

NDSolve, FindRoot and shooting method

  • To: mathgroup at smc.vnet.net
  • Subject: [mg57430] NDSolve, FindRoot and shooting method
  • From: <topolog at gazeta.pl>
  • Date: Fri, 27 May 2005 04:58:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Dear Mathematica Users!

In Mathematica 4.0 I was able to implement the shooting method to
solve the following equation:

EQJ = J1(W,z)*v(z) + J2(W,z)*v(z) + J3(W,z)*v(z) == 0,

where v(z) is the function to be found, and J1, J2, J3 are
coefficients dependent of z-coordinate and a parameter W.

In Mathematica 5.1 valid lines of the code should be modified and
look like:

dYdX[W_?NumberQ] := EQJ;  (* the equation *)
Y1X1 = {v[z1] == BCV1, v'[z2] == BCV2};  (* boundary conditions *)
eqset = Join[{dYdX[W] == 0.}, Y1X1];  (* the set of the above *)

(* function that solves eqset for the specified W *)
ndsolut[W_?NumberQ] := NDSolve[eqset, v, {z, z1, z2}][[1, 1, 2]];    

(* searching for W that satisfies another boundary condition *)
FindRoot[ndsolut[W][z2] == BCV3, {W, W1, W2}] 

Unfortunately I get messages of sort

SetDelayed::write: Tag Plus in [...] is Protected.
NDSolve::ndode: Input is not an ordinary differential equation.

And I am confused ... Could you help me, please?

Thank you and kind regards.

Rafal Kosinski






  • Prev by Date: Re: How to get decent quality plots.
  • Next by Date: a dangerous feature of Module[]?
  • Previous by thread: A suggestion regarding Initial Conditions in ODEs.
  • Next by thread: a dangerous feature of Module[]?