Good day, everyone. Basically , the problem I am given is to solve the system of differential equations with 4 equations, and I have two initial values, and two boundary conditions. Following the Shooting method theory, I supply my system with two guesses for missing initial values, solve the system using Runge-Kutta 4th order, and obtain some values for functions, which are not right based on my boundary conditions.The question is how to iterate my system of approximations for initial values, to obtain right initial guesses? If I had only one value to be found by this method, it would be easy, by just implementing some form of linear interpolation, squeezing down the solution from two ends. But since there are two values guessed, it is not working anymore. Any ideas would be greatly appreciated.
My functions are like this: \begin{align} \dot x_1(t) &= x_2(t), \\ \dot x_2(t) &= p_2(t)-\sqrt 2 x_1(t)e^{-\alpha t}, \\ \dot p_1(t) &= \sqrt 2 p_2(t)e^{-\alpha t}+x_1(t), \\ \dot p_2(t) &= -p_1(t) \end{align} with initial and boundary values of: $x_1(0)=1$, $p_2(0)=0$; $p_1(1)=0$, $p_2(1)=0$
As your ODE system is linear, your solutions will also be (affine) linear in the initial conditions. Parametrize the unknown conditions at $x=0$ as $u=\pmatrix{u_1\\u_2}=\pmatrix{x_2(0)\\p_1(0)}\in\Bbb R^2$ and name the target variables at $x=1$ as $v=\pmatrix{v_1\\v_2}=\pmatrix{p_1(1)\\p_2(1)}$, with requested values $v^*=\pmatrix{0\\0}$. Then $v=f(u)$, where $f$ contains the integration from $x=0$ to $1$, is an affine linear function.
Now any affine linear function $v=f(u)=Au+b$ can be reconstructed from 3 function values at points in general position. Set $v^k=f(u^k)$, $k=1,2,3$, and construct $$ U=\pmatrix{u_1^1&u_1^2&u_1^3\\u_2^1&u_2^2&u_2^3\\1&1&1}~~\text{ and }~~ V=\pmatrix{v_1^1&v_1^2&v_1^3\\v_2^1&v_2^2&v_2^3\\1&1&1} $$ then $$ \pmatrix{A&b\\0&1}=VU^{-1}, $$ as $$ \pmatrix{A_{11}&A_{12}&b_1\\A_{21}&A_{22}&b_2\\0&1} \pmatrix{u_1^k\\u_2^k\\1}=\pmatrix{Au^k+b\\1}=\pmatrix{v^k\\1}. $$ The initial condition you are looking for is then obtained as $u^*=A^{-1}(v^*-b)$. You can refine this results to get more numerical accuracy by repeating this computation from points $u^k$ close to $u^*$.