# Integrating Hamiltonian equations using NDSolve [closed]

Would someone be able to integrate numerically the equations at the bottom of page 12 in the paper Interstellar Wormholes given some initial conditions of your choice.

Reading the first paragraph of page 13 might also help.

My thoughts on this is:

1. List out the equations.

listeq =
{l'[t] + p_l == 0, θ'[t] - p_θ/r^2 == 0,
ϕ'[t] - b/r^2 Sin^2[θ] == 0, p_l'[t] - B^2 r'[l]/r^3 == 0,
p_θ'[t] - b^2 Cos[θ]/r^2 Sin^3[θ] == 0}

2. List the initial conditions. Could be potential constraints on this however not too sure so just subbed in random numbers.

listinital =
{l == 2, θ == Pi/4, ϕ == Pi/2, p_l[t] == 10, p_θ[t] = 7}

3. Plug into NDSolve. The forth equation has a derivative wrt to l also so this may be wrong.

NDSolve[{listeq, listinital}

• We'll need more info. Generally people prefer if you provide what you have already tried and give us some code to work from. – b3m2a1 Jan 31 '19 at 23:31
• Your third item NDSolve[{listeq,listinital}, is incomplete. – bbgodfrey Feb 1 '19 at 12:47

Better to write your equations as in the paper. Notice some other changes...no underscores in variable names, where the exponent goes for the sine and cosine functions, don't forget the pl[t] for the pl on the right side of the == symbol.

listeq = {
l'[t] == pl[t],
θ'[t] == pθ[t]/r^2,
ϕ'[t] == b/(r^2 Sin[θ]^2),
pl'[t] == (B^2 r'[l])/r^3,
pθ'[t] == (b^2 Cos[θ])/(r^2 Sin[θ]^3)}


We need values for band B. Without reading the paper, is r'[l] a constant? If so, we need that. If not, we need some chain rule to get it into dr/dl=(dr/dt)/(dl/dt).

listinital = {..., pl[t] == 10, pθ[t] = 7}

you need to set values for t for those conditions, otherwise you are telling it that pl is a constant from time 0 to eternity, which I doubt you mean to.