3
$\begingroup$

When I select the "Adams" method in NDSolve what is the default order? And how may I change the order?

$\endgroup$
3
$\begingroup$

The order is variable. Based on What's inside InterpolatingFunction[{{1., 4.}}, <>]?, the following shows the order at each step. Note that the first few steps are NDSolve getting its bearings before the first Adams steps (order 4). With InterpolationOrder -> All, the solution is returned with local series for the Adams steps. Their length should be one more than the order of the step, I think. The documentation says it should be the "same order as the underlying method used."

adamssol = NDSolve[{x''[t] + x[t]^3 == t, x[0] == 1, x'[0] == 0}, 
   x, {t, 0, 3 π}, Method -> "Adams", InterpolationOrder -> All];
adamsifn = x /. First@adamssol

ListPlot[
 {Transpose@{Flatten@adamsifn["Grid"],
    Map[Length, adamsifn[[4]]] - 1},    (* ifn[[4]] = local series coefficients *)
  Transpose@{Flatten@adamsifn["Grid"], 
    Rescale[#, MinMax[#], {0, 12}] &@adamsifn["ValuesOnGrid"]}
  },
 Joined -> {False, True},
 Frame -> True, FrameLabel -> {"t", "order"}, 
 FrameTicks -> {Automatic, Range@12}, GridLines -> {None, Automatic}
 ]

Mathematica graphics

The order of each step (in blue), with the rescaled solution plotted over it (in gold).

The maximum order may be limited with the submethod option "MaxDifferenceOrder", which must be set to an integer from 1 through 12; the minimum order cannot be set:

NDSolve[{x''[t] + x[t]^3 == t, x[0] == 1, x'[0] == 0}, x,
 {t, 0, 3 π}, Method -> {"Adams", "MaxDifferenceOrder" -> 6}, 
 InterpolationOrder -> All]

Mathematica graphics

The order of each step with "MaxDifferenceOrder" -> 6 (in blue), with the rescaled solution plotted over it (in gold).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.