# Crank-Nicolson with NDSolve?

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:

NDSolveImplicitRungeKuttaLobattoIIIACoefficients[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:

NDSolveImplicitRungeKutta::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.)

-
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

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.

-