# how can i solve stiff differential equations in C#? • ### Question

• which method in Microsoft Oslo Library can solve the Stiff ordinary differential Equations? is there another way to solve them at all?

Is there any limit for number of equations (dimension of matrix) in Oslo's Method?

Thursday, November 16, 2017 8:15 AM

### All replies

• which method in Microsoft Oslo Library can solve the Stiff ordinary differential Equations? is there another way to solve them at all?

Is there any limit for number of equations (dimension of matrix) in Oslo's Method?

Hi, I dont know of that library but for solving stiff differential equations with difference methods I would use an implicit method. That means some real-solving at each iteration, so you would end up doing some more computations. You could test eg the Trapezoidal Method (sometimes called (2 stage) Adams-Moulton Method). also there are  implicit Runge Kutta and Rosenbrock Wanner methods [etc]).

[Of course there are other methods to solve such equations, a Finite Element Method, with a simple linear interpolation base ("hat"-functions) for the function-space the Galerkin approximation takes place, will be exact at the nodes - if this base is a possible choice.]

https://ocw.mit.edu/courses/mathematics/18-085-computational-science-and-engineering-i-fall-2008/video-lectures/lecture-10-finite-differences-in-time/

as one lecture of the very good course:

https://ocw.mit.edu/courses/mathematics/18-085-computational-science-and-engineering-i-fall-2008/video-lectures/

-------------------------

Since I dont know the library you mentioned I dont know of the limits, but I guess for sparse tridiagonal (Block-) systems the limit would be a relatively large number, since you only need to know the index of the row (or the diagonal element) and the distance from that diagonal element to the two off-diagonal elements plus the values of those elements and the changes in the matrix for the first and last row (of blocks) depending on the boundary conditions of the problem.

Regards,

Thorsten

Friday, November 17, 2017 9:27 AM
• Hi,

... looking at

https://www.microsoft.com/en-us/research/project/open-solving-library-for-odes/

its said that there are Runge Kutta and BDF methods implemented. So, if there's no implicit Runge Kutta method in that lib, try the BDF method(s) for solving the stiff equation.

Maybe do a stability test with a known function and the chosen method, maybe even the Dahlquist Test function u' = lambda*u with u(0) = 1 and see if you get a series of constanly falling values as result.

https://en.wikipedia.org/wiki/Stiff_equation#A-stability

Regards,

Thorsten

Saturday, November 18, 2017 10:04 AM
• Hi,

additionally, here's a video (only available in 240p, but explaining the errors and how ton chose the right method)