Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

As far as I understand, the Crank-Nicolson method (a.k.a. trapezoidal method) can be expressed as a second order implicit Runge-Kutta method. It's Butcher tableau is:

 0 |  0    0
 1 | 1/2  1/2
---|----------
   | 1/2  1/2

And yes these coefficients can be found in:

NDSolve`ImplicitRungeKuttaLobattoIIIACoefficients[2, Infinity]
{{{0, 0}, {1/2, 1/2}}, {1/2, 1/2}, {0, 1}}

But when I try:

NDSolve[{y'[x] == Cos[x], y[0] == 0}, y, {x, 0, 1},
  Method -> {"FixedStep", Method -> {"ImplicitRungeKutta", "DifferenceOrder" -> 2, 
             "Coefficients" -> ImplicitRungeKuttaLobattoIIIACoefficients}},
  StartingStepSize -> 0.1]

I get an error warning:

NDSolve`ImplicitRungeKutta::cmsing:
  Singular coefficient matrix encountered for
  NDSolve`ImplicitRungeKuttaLobattoIIIACoefficients, which is not suitable for stiff systems.

Question: Why this?

(I have Mathematica 8. Also tested on Mathematica 9, same behavior.)

share|improve this question
1  
This might have some useful info: reference.wolfram.com/mathematica/tutorial/… It doesn't answer the questions about the error message, but it might provide a path to implement a Crank-Nicolson method to use with NDSolve. –  chuy Aug 5 '13 at 20:47

1 Answer 1

up vote 0 down vote accepted

I am quite blind. That was not an error, just a warning. After the warning, Mathematica also gives the solution:

{{y -> InterpolatingFunction[{{0., 1.}}, <>]}}

and that works just fine.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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