1
$\begingroup$

I need to solve a system of stiff ODE's using the RK4 method. I know how to solve a single ODE but am struggling with the concept of how to do a system. The equations are as follows: $\frac{dy_1}{dt}=-0.013y_1-10000y_1y_3$

$\frac{dy_2}{dt}=-2500y_2y_3$

$\frac{dy_3}{dt}=-0.013y_1-1000y_1y_3-2500y_2y_3$

Where: $ y_1(0)=1$, $ y_2(0)=1$, $ y_3(0)=0$

I don't need help programming, just some general advice about how to even set this problem up would be great.

$\endgroup$

1 Answer 1

1
$\begingroup$

The specifics depend on the programming language.

You implement the RK4 methods so that all y and k are or can be vectors.

Then you implement the ODE function to be used in the RK4 method as

vector dydt = odefunc(real x, vector y) dydt[1] =−0.013*y[1]−10000*y[1]*y[3] dydt[2]=−2500*y[2]*y[3] dydt[3]=−0.013*y[1]−1000*y[1]*y[3]−2500*y[2]*y[3] return dydt end 

and call

t0=0 tf=??? y0=vector([1,1,0]) yf = rk4(odefunc, t0,y0,tf,h) 
$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.