2
$\begingroup$

I would like to plot the curve $\alpha(s) = (l(s), h(s))$, where $l$ and $h$ are the solutions to the system $l'^2 + h'^2 = 1$ and $l'h''-l''h'=h'\tan(l)$. Here's what I tried:

Clear[eq1, eq2, initConds, sol];
eq1 = l'[s] h''[s] - l''[s] h'[s] == h'[s] Tan[l[s]]
eq2 = l'[s]^2 + h'[s]^2 == 1;
initConds = {l[0] == 1, l'[0] == 1, h[0] == 0};

sol = NDSolve[{eq1, eq2, initConds}, {l, h}, {s, -10, 10}]
ParametricPlot[Evaluate[{l[s], h[s]} /. First[sol]], {s, -10, 10}]

This doesn't work (I don't get any image). Why?

$\endgroup$
1
  • 1
    $\begingroup$ A sometimes useful trick when an image doesn't seem to appear for a plot is to replace the plot function with the Table function. Sometimes adding a step size for the Table will also help. Thus looking at the output of Table[Evaluate[{l[s],h[s]}/.First[sol]], {s,-10,10,1/10}] might give you some idea what is happening in this case and in other cases in the future. This can let you realize things like there are complex numbers for some or all of the graph or there are undefined variables or other problems that plot might not clearly explain to you. $\endgroup$
    – Bill
    Dec 3, 2018 at 4:20

1 Answer 1

2
$\begingroup$
eq1 = l'[s] h''[s] - l''[s] h'[s] == h'[s] Tan[l[s]];
eq2 = l'[s]^2 + h'[s]^2 == 1;
initConds = {l[0] == 1, l'[0] == 1, h[0] == 0};

sol = NDSolve[{eq1, eq2, initConds}, {l, h}, {s, -10, 10}];
ParametricPlot[Evaluate[{l[s], h[s]} /. First[sol]], {s, -10, 10}, 
 AspectRatio -> 1]

fig1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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