# Graphing in Mathmatica

Here I am only concerned with the plotting. I am not new to Mathematica, but i have no idea how to complete part B and graph the angle or velocity or phase diagrams. Any help is appreciated.

• If you have solved part A, please show us your work... once you have part A solved, then you can plot the parameters of interest. – bill s Nov 21 '17 at 20:44
• Here I have added the solution to part A – Isaac Dec 7 '17 at 20:57

May be this will get you started. I used the ODE's as given in https://en.wikipedia.org/wiki/Spherical_pendulum

solved the above coupled non-linear ODE's using NDSolve for some t interval, and made the plots

m = 0.5; r = 1; g = 9.81;
ClearAll[theta, phi, t];
ode1 = D[m r^2 theta'[t], t] -
m r^2 Sin[theta[t]] Cos[theta[t]] phi'[t]^2 +
m g r Sin[theta[t]] == 0;
ode2 = D[m r^2 Sin[theta[t]]^2 phi'[t], t] == 0;

ic = {theta[0] == 10 Degree, theta'[0] == 0, phi[0] == 0, phi'[0] == 1};
(*need phi'(0) not zero to get something interesting*)

{theta, phi} = {theta, phi} /.
First@NDSolve[{ode1, ode2, ic}, {theta, phi}, {t, 0, 10}];


p1=Plot[theta[t],{t,0,10},Frame->True,FrameLabel->{{"theta(t)",None},{"time (sec)","theta vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];
p2=Plot[phi[t],{t,0,10},Frame->True,FrameLabel->{{"phi(t)",None},{"time (sec)","phi vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];
p3=Plot[theta'[t],{t,0,10},Frame->True,FrameLabel->{{"theta'(t)",None},{"time (sec)","theta' vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];
p4=Plot[phi'[t],{t,0,10},Frame->True,FrameLabel->{{"phi'(t)",None},{"time (sec)","phi' vs. time"}},GridLines->Automatic,GridLinesStyle->LightGray];

Grid[{{p1,p2},{p3,p4}}]


And used ParametricPlot for phase plot

ParametricPlot[{theta'[t],phi'[t]},{t,0,10},Frame->True,AspectRatio->1]


• For your NDSolve line of your first ODE, what did you use as your variable? I am also getting a recursionlimit error. – Isaac Dec 11 '17 at 17:18
• @Isaac I am sorry, I do not understand the question. The code posted above works as is. no recursionlimit for me. May be you can try the code from clean kernel? may be you have some other definitions getting in the way. – Nasser Dec 11 '17 at 17:22