How to deal with two interdependent integrators? I have two functions, f(t,x) and g(t,u), where

Agohofidov6

Agohofidov6

Answered question

2022-01-17

How to deal with two interdependent integrators?
I have two functions, f(t,x) and g(t,u), where ddtu=f(t,x) and ddtx=g(t,u).
I am trying to discretize the integral of this system in order to track x and u. I have succeeded using Euler integration, which is quite simple, since x(t) and u(t) are both known at t:
u(t+h)=u(t)+hf(t,x(t))
x(t+h)=x(t)+hg(t,u(t))
However, I am now trying to implement mid-point integration to get more accurate results. (Eventually Runge-Kutta but I am stuck here for now.)

Answer & Explanation

Virginia Palmer

Virginia Palmer

Beginner2022-01-18Added 27 answers

Im
chumants6g

chumants6g

Beginner2022-01-19Added 33 answers

Per Christian's suggestion I re-thought the question in terms of a state vector y=|u,x|, with a single derivative function [u˙,x˙]=y˙=z(t,x,u).
This allows to express the mid-point method as usual:
y(t+h)=y(t)+hz(t+h2,y(t)+h2z(t,y(t)))
where z(t,x,u)=[f(t,x),g(t,x)]
alenahelenash

alenahelenash

Expert2022-01-24Added 556 answers

You can write the mid-point rule even with both equations separated as was your original post as
u(t+h)=u(t)+hf(t+h2,x(t)+h2g(t,u(t)))
and mutatis mutatndis for x(t+h).
P.S. I find your notation a bit verbose; personally I got used to using indices ,,+ for values at th,th2,t,t+h2,t+h; then the equation would read
u˙+=u+hu˙(x+h2x˙(u))

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Differential Equations

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?