1
$\begingroup$

I bet this has asked before, but I can't seem to find an answer anywhere.

I have x and y functions which, individually plotted, are showing up fine, but when I try to plot the parametrically, the graph does not show up. I absolutely cannot figure out why this is occurring, and I've tried simpler functions (such as x=sin[t]), which work, leading me to believe it has something to do with the way I solved the differential equation.

    k1 = 9*^9*(1.6*^-19)^2;
    me = 511*^3;
    mp = 938*^6;
    ℏ = 6.59*^-1;
    U[r_] := -k1/r;
    V[r_] := U[r] + l[r]^2/2/μ/r^2;
    L := n*ℏ;
    ϕ'[r_] := L/me/r^2;
    F[r_] := -k1/r^2;
    μ = (me + mp)/(me*mp);
    u[ϕ_] := 1/r[ϕ];
    l[r_] := μ r^2 ϕ'[r];
    n = .1;

    sol = NDSolve[{D[D[u[ϕ], ϕ], ϕ] == 
         u[ϕ] - μ/l[r[ϕ]]^2/u[ϕ]^2*F[r[ϕ]], 
        r[1] == 30, r'[1] == 5}, r[ϕ], {ϕ, 0, 4 Pi}];

    X[ϕ1_] := r[ϕ]*Cos[ϕ] /. sol /. ϕ -> ϕ1;
    Y[ϕ1_] := r[ϕ]*Sin[ϕ] /. sol /. ϕ -> ϕ1;

    Plot[X[th], {th, 0, 2 Pi}]
    Plot[Y[th], {th, 0, 2 Pi}]
    ParametricPlot[{X[t], Y[t]}, {t, 0, 2 Pi}]
$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Dr. belisarius Mar 30 '16 at 1:30
2
$\begingroup$

Note the First@sol part:

X[ϕ1_] := r[ϕ]*Cos[ϕ] /. First@sol /. ϕ -> ϕ1;
Y[ϕ1_] := r[ϕ]*Sin[ϕ] /. First@sol /. ϕ -> ϕ1;

ParametricPlot[{X[t], Y[t]}, {t, 0, 2 Pi}, AspectRatio -> 1]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.