I have question to solve using RK2. Your help is highly appreciated.
In a reversible chemical reaction concentrations $A$ and $B$ given in $\rm \text{g-mol}/L$ of two compound, change at rates given by $$ \begin{align} \frac{dA}{dt} &= -k_1 A^2 + k_2 B\\ \frac{dB}{dt} &= 2k_1 A^2 - k_2 B^2 \end{align} $$ with $A(0) = 1$, $B(0) = 0$, and $k_1 = 0.03$, $k_2 = 0.02$. Use RK2 method to find B at $t= 1,2$. Show how to apply an alternate method for the same purpose.
We have the system:
$$ \begin{align} \frac{dA}{dt} &= -k_1 A^2 + k_2 B = -0.03 A^2 + 0.02 B\\ \frac{dB}{dt} &= 2k_1 A^2 - k_2 B^2 = 2 (0.03) A^2 - 0.02 B^2 \end{align} $$
$$A(0) = 1, B(0) = 0$$
Use the Runge-Kutta Order 2, RK2, method to find $B$ at $t = 1,2$.
We arrive at the iterates:
You can fill in the details for RK2 and also use a second method to verify these results.