solving a system of nonlinear differential equations with the Euler method
Hello everyone,
I'm a PhD student and I have to take some post-grad courses. One is about numerical methods to solve differential equations.
I understood methods such as the Euler, Backward Euler, etc... fine, BUT this kind of sytem I can't solve numerically:
(A, B, C, D some constants) We know X(0), Y(0) and Z(0)
X' = -A*X + B*Y*Z
Y' = A*X - B*Y*Z - DY'
Z' = DY'
My main problem comes from the multiplications between the function (Y*Z here).
I tried to do X' + Y', this kind of trick, to simplify the system but it led to no solution, and anyways I have other exercises that do not seem to simplify either, yet it should be possible to solve them with Euler method...
I know how to solve an equation such as X' = AX + B in a numerical way, but for this system I have no clue how to do it...
If anyone can help, thank you very much!
Re: solving a system of nonlinear differential equations with the Euler method
I don't see why that would affect anything. Y and Z are just numbers at each step- multiply those numbers
You are given X(0), Y(0), Z(0), so you can calculuate
dX= (-A*X(0) + B*Y(0)*Z(0))dt, dY= (A*X(0) - B*Y(0)*Z(0) - DY(0))dt, dZ= DY(0)dt
X(dt)= X(0)+ dX, Y(dt)= Y(0)+ dY, Z(dt)= Z(0)+ dZ
Now, dX= (-A*X(dt) + B*Y(dt)*Z(dt))dt, dY= (A*X(dt) - B*Y(dt)*Z(dt) - DY(dt))dt, dZ= DY(dt)dt
and X(2dt)= X(dt)+ dX, Y(2dt)= Y(dt)+ dY, Z(2dt)= Z(dt)+ dZ
and continue like that.
Now, I have replace Y' on the right sides of the last two equations with Y, assuming that was a typo. If not, the Y' equation can be rewritten (1+D)Y'= AX- B*Y*Z so Y'= (AX- B*Y*Z)/(1+D) and the Z' equation gives
dZ= d(dY/dt) where dY is calcated first, then dZ.
Re: solving a system of nonlinear differential equations with the Euler method
Thanks so much HallsofIvy!
I did not take the time to solve the entire exercise yet, but I think that I understood what you told me.
It makes sense, and actually what does not make sense to you I guess, is why it is not obvious to me.
I must admit that I am quite confused with the numerical methods, and it is not yet clear in my mind (Wondering). It's always the same problem: you think you got it when you're in class, but then, in front of your exercise, it suddenly does not make sense anymore.
The "step by step", one iteration at a time, reasoning is different from what I've seen so far (actually it has already been covered in my classes in the past, but at this time I did not have a clue at all (Giggle)).
PS: No, the ' was not a typo.