Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I new to Mathematica and I have a problem with certain equations. I want to plot a trajectory in spherical coordinates given by the equations:

(1 + α^2)*(Abs[γ])^-1*θ'[t] == (Sin[2*θ[t]]*Subscript[H, d]*α)/
           2 + ((Cos^2)[ϕ[t]]*Sin[2*θ[t]]*α - Sin[2*ϕ[t]]*Sin[θ[t]])*Subscript[H, k]/
           2 - (α*M*(Cos[β]*Cos[θ[t]]*Cos[ϕ[t]] - Sin[β]*Sin[θ[t]]) + 
      M*Cos[β]*Sin[ϕ[t]])*Subscript[α, j]

and

(1 + α^2)*(Abs[γ])^-1*ϕ'[t] == -Cos[θ[t]]*Subscript[H, d]*α - (2*(Cos^2)[ϕ[t]]*Cos[θ[t]] - 
            α*Sin[2*ϕ[t]])*Subscript[H, k]/2 - Cos[θ[t]]*(α*M*(Cos[β]*Cos[θ[t]]*Cos[ϕ[t]] - 
        Sin[β]*Sin[θ[t]]) - 
        M*Cos[β]*Sin[ϕ[t]])*Subscript[α, j]

My (crude) code is:

sol = ParametricNDSolve[{(1 + α^2)*(Abs[γ])^-1*θ'[t] == (Sin[2*θ[t]]*Subscript[H, d]*α)/
       2 + ((Cos^2)[ϕ[t]]*Sin[2*θ[t]]*α - Sin[2*ϕ[t]]*Sin[θ[t]])*Subscript[H, k]/
       2 - (α*M*(Cos[β]*Cos[θ[t]]*Cos[ϕ[t]] - Sin[β]*Sin[θ[t]]) + 
       M*Cos[β]*Sin[ϕ[t]])*Subscript[α, j], (1 + α^2)*(Abs[γ])^-1*ϕ'[t] ==
             -Cos[θ[t]]*Subscript[H, d]*α - (2*(Cos^2)[ϕ[t]]*Cos[θ[t]] - α*
             Sin[2*ϕ[t]])*Subscript[H, k]/2 - 
       Cos[θ[t]]*(α*M*(Cos[β]*Cos[θ[t]]*Cos[ϕ[t]] - Sin[β]*Sin[θ[t]]) - 
       M*Cos[β]*Sin[ϕ[t]])*Subscript[α, j], ϕ[0] == 0, θ[0] == 0},
       {ϕ[t], θ[t]}, {t, 0, 100},
       {α, Subscript[H, d], Subscript[α, j], Subscript[H, k], M, γ, β}]

and I try to plot it:

ParametricPlot3D[
 Evaluate[{M*Cos[ϕ[t]]*Sin[θ[t]] /. sol, 
    M*Sin[ϕ[t]]*Sin[θ[t]] /. sol, 
    M*Cos[θ[t]] /. sol} /. {α -> 1, 
    Subscript[H, d] -> 1, Subscript[α, j] -> 1, 
    Subscript[H, k] -> 1, M -> 1, γ -> .1, β -> .1}, {t, 
   0, 100}]]

but the plot isn't displayed and I don't get any errors. Does anyone know what am I doing wrong? Thanks in advance!

share|improve this question
    
Have you actually looked at what Evaluate[{M*Cos[ϕ[t]]*Sin[θ[t]] /. sol, M*Sin[ϕ[t]]*Sin[θ[t]] /. sol, M*Cos[θ[t]] /. sol} /. {α -> 1, Subscript[H, d] -> 1, Subscript[α, j] -> 1, Subscript[H, k] -> 1, M -> 1, γ -> .1, β -> .1} is feeding to ParametricPlot3D? Is it what you expect? –  m_goldberg May 13 at 2:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.