# Implicit iterative methods oscillating?

1. Aug 18, 2015

### maistral

I'm under the impression that any implicit method for numerically solving ODE should be providing high stability in exchange for accuracy.

I'm trying to solve the differential equation:
dy/dx = -1000y + 3000 - 2000exp(-x) with intial conditions (0,0).

I still can't understand how come the numerical solution using the Implicit Midpoint is oscillating if it is supposed to be a stable method. Judging from the values, they oscillate between ~0 and~2.

Am I missing something here?

2. Aug 19, 2015

### BvU

Seems to me your initial step is relatively big: dy/dx (0) = 1000 so 0.05 makes y shoot off.
You sure there aren't any conditions at all for the stability ?

 perhaps this helps -- but your midpoint is left as an exercise (nr 3 on p. 64....)

3. Aug 20, 2015

### maistral

I see. The implicit midpoint requiring an initial evaluation at dy/dx(0) at the evaluation (y0 + y1)/2 makes it shoot off. Thanks. Is it safe for me to say that implicit methods do strengthen stability, but not guarantee stability? (unless its backward Euler.. that thing is a tank)

I guess I'm really better off with the Gauss-Legendre RK or that BDF thing. Thanks!

4. Aug 20, 2015

### BvU

I think I can agree with your statement. I think that's exactly the subject of the link I gave you.

I don't know what line of work/study you are in, but I find it very useful to check derivative absolute values, no matter which integrator is at work in the program I'm using.
Big values means you want to try small step sizes, but once the values are comparable and relatively smaller you want bigger steps to make reasonable progress.
For your expression I would say that's a 'stiff' ODE and the Gear method comes to mind. Sometimes you have a choice and you simply try one or two.

There's a truckload of litterature on this subject to be found on the internet nowadays, so: happy hunting !

5. Aug 20, 2015

### Staff: Mentor

The solution oscillating between 0 and 2 does not mean that it is unstable. It's just not a good approximation. An unstable solution grows without bound.

Chet