Message Boards Message Boards

How can I solve a system of ODE system using RKF45 method with shoting technique?

Posted 22 days ago

I tried to solve a system of ordinary differential equations in Mathematica, I got a reults in "ExplicitRungeKutta" method. But I want a results in RKF45 method with shoting technique. How to solve the system?

POSTED BY: J Prakash

RKF45 is shown in http://reference.wolfram.com/language/tutorial/NDSolveExplicitRungeKutta.html:

Fehlbergamat = {
   {1/4},
   {3/32, 9/32},
   {1932/2197, -7200/2197, 7296/2197}, {439/216, -8, 
    3680/513, -845/4104}, {-8/27, 2, -3544/2565, 1859/4104, -11/40}};
Fehlbergbvec = {25/216, 0, 1408/2565, 2197/4104, -1/5, 0};
Fehlbergcvec = {1/4, 3/8, 12/13, 1, 1/2};
Fehlbergevec = {-1/360, 0, 128/4275, 2197/75240, -1/50, -2/55};
FehlbergCoefficients[4, p_] :=
  N[{Fehlbergamat, Fehlbergbvec, Fehlbergcvec, Fehlbergevec}, p];

Simple examples:

sol = NDSolve[{y'[x] == y[x]/2, y[0] == 1}, y, {x, 0, 10}
   , Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 4, 
     "Coefficients" -> FehlbergCoefficients}
   (*,MaxStepFraction->1*)];
ListLinePlot[y /. sol, Mesh -> All, PlotRange -> All]

(* uses shooting method for bvp *)
sol = NDSolve[{y''[x] == y[x], y[0] == 1, y[10] == 0}, y, {x, 0, 10}
   , Method -> {"ExplicitRungeKutta", "DifferenceOrder" -> 4, 
     "Coefficients" -> FehlbergCoefficients}
   (*,MaxStepFraction->1*)];
ListLinePlot[y /. sol, Mesh -> All, PlotRange -> All]
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract