 # How to deal with two interdependent integrators? I have two functions, f(t,x) and g(t,u), where Agohofidov6 2022-01-17 Answered
How to deal with two interdependent integrators?
I have two functions, f(t,x) and g(t,u), where .
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\left(t+h\right)=u\left(t\right)+hf\left(t,x\left(t\right)\right)$
$x\left(t+h\right)=x\left(t\right)+hg\left(t,u\left(t\right)\right)$
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.)
You can still ask an expert for help

## Want to know more about Laplace transform?

• Live experts 24/7
• Questions are typically answered in as fast as 30 minutes
• Personalized clear answers

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it Virginia Palmer chumants6g
Per Christian's suggestion I re-thought the question in terms of a state vector $y=|u,x|$, with a single derivative function $\left[\stackrel{˙}{u},\stackrel{˙}{x}\right]=\stackrel{˙}{y}=z\left(t,x,u\right)$.
This allows to express the mid-point method as usual:
$y\left(t+h\right)=y\left(t\right)+hz\left(t+\frac{h}{2},y\left(t\right)+\frac{h}{2}z\left(t,y\left(t\right)\right)\right)$
where $z\left(t,x,u\right)=\left[f\left(t,x\right),g\left(t,x\right)\right]$
###### Not exactly what you’re looking for? alenahelenash

You can write the mid-point rule even with both equations separated as was your original post as
$u\left(t+h\right)=u\left(t\right)+hf\left(t+\frac{h}{2},x\left(t\right)+\frac{h}{2}g\left(t,u\left(t\right)\right)\right)$
and mutatis mutatndis for $x\left(t+h\right)$.
P.S. I find your notation a bit verbose; personally I got used to using indices $-,\ominus \circ \oplus ,+$ for values at $t-h,t-\frac{h}{2},t,t+\frac{h}{2},t+h$; then the equation would read
${\stackrel{˙}{u}}^{+}={u}^{\circ }+h{\stackrel{˙}{u}}^{\oplus }\left({x}^{\circ }+\frac{h}{2}{\stackrel{˙}{x}}^{\circ }\left({u}^{\circ }\right)\right)$