Following comments here and here I have added two examples to the ODE Solver spreadsheet showing use of the ODE function to solve systems of differential equations with two or more coupled equations. The new version (including full open source code) may be downloaded from ODESolver.zip.

The first new example is the system of equations for the Lorenz-Attractor. As for the examples given previously, it is necessary to create a short VBA function to evaluate each of the differential equations for given values of the variables and coefficients. This function is called by the Alglib ODE solver (included with the download file) to solve the system of equations for any specified series of steps:

Lorenz Attractor Solver

Results for coefficients as used by Lorenz:

The second example is the classic predator-prey system, where increasing prey numbers are limited by increasing numbers of predators, until the prey animals go into a rapid decline, followed by decline in predators, until prey numbers start to increase again. This example was taken from the document on solution of differential equations at the XNumbers site: ODE Tutorial

Predator-Prey Solver

### Like this:

Like Loading...

*Related*

First at all great work and thank you for sharing it! I am missing a in the description and examples: There is an example for a 2nd order d²x/dt² differential equation (damped oscillation), however one-dimensional. There are examples of 1st order dx/dt differential equation but 2- dimensional and even 3-dimesional. However I am wondering if 2nd order differential equation having 2- dimensions also work.

D²x/dt²=k*dy/dt

D²y/dt² = L*dx/dt

These are typical differential equations if working with aerodynamic drag (so the topics Physics always insist not to model 😉

I went through your code and doubt it will work, however may be wrong.

LikeLike

Thanks for the comments Wilhard.

Regarding 2nd order with 2 dimensions, I will have to check. I have some other work that I want to finish first but I will come back to this when I have some time.

I should say that I don’t actually use these functions in my day to day work, so I rely on examples on the Internet for information, and the lack of examples probably suggests that it isn’t easy!

LikeLike