I have a trouble of defining a Jacobian matrix for my problem. Basically, I have 4 differential equations to be solved.
$$ \begin{aligned} \dot x_1(t)&=x_2(t)\\ \dot x_2(t)&=p_2(t)−\sqrt 2 x_1(t)e^{-αt}\\ \dot p_1(t)&=\sqrt 2p_2(t)e^{-αt}+x_1(t)\\ \dot p_2(t)&=−p_1(t) \end{aligned} $$
with initial and boundary values of: $$ x_1(0)=1\\ p_2(0)=0\\p_1(1)=0\\p_2(1)=0$$
Following classic shooting method strategy, I suggest some values for $x_2(0), p_1(0)$, solve the system of diff equations using Dormand Prince method and obtain some values at the boundary.
Here I check, if the solution on my boundaries meets the criteria of $p_1(1)=0,p_2(1)=0$. If not, I have to suggest new values for the initial values of $x_2(0), p_1(0)$ to be iterated again. Since this is a two-parametric shooting, I can't use simple linear interpolation as in one-parametric shooting, so I have to use Newton's method for that.
Here is my question: How to implement Newton's method to iterate towards the right solution? I tried myself and it doesn't work. Can you at least help me with defining a Jacobian, for the given problem of iterative solution to $x_2(0), p_1(0)$?