Message Boards Message Boards

0
|
5119 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Phase diagram for a plane pendulum

Posted 9 years ago

I'm having a problem trying to plot a phase diagram for a plane pendulum. For some reason the function I created will not plot. if I solve for specific variable it will give me a solution but anything else I do with it will not work (Manipulate[], Plot[], etc..). Can someone help me out?

thetadot[m_, g_, l_, \[Theta]_, \[Theta]max_] := 
  2 Sqrt[(g/l)[Sin[\[Theta]max/2]^2 - Sin[\[Theta]/2]^2]];

Manipulate[
 Plot[thetadot[20, 10, 1, \[Theta], \[Theta]max], {\[Theta], -2 Pi, 
   2 Pi}], {\[Theta]max, 0, 2 Pi}]
POSTED BY: Devin Luu
3 Replies
Posted 9 years ago

Thank you both! it worked out beautifully.

Cheers, Dev

POSTED BY: Devin Luu

Remove incorrect [ ] and everything works

thetadot[m_, g_, l_, \[Theta]_, \[Theta]max_] := 
  2 Sqrt[(g/l) Sin[\[Theta]max/2]^2 - Sin[\[Theta]/2]^2];

Manipulate[
 Plot[thetadot[20, 10, 1, \[Theta], \[Theta]max], {\[Theta], -2 Pi, 
   2 Pi}], {\[Theta]max, 0, 2 Pi}]
POSTED BY: S M Blinder
Posted 9 years ago

You are using [Sin[[Theta]max/2]^2 - Sin[[Theta]/2]^2] to group those two things together and Mathematica does not instantly put giant red bouncing pointing fingers pointing at that [ and ] to say that is unacceptable. Change those [ and ] to ( and ), but only in the one place where you are using those to group, not in the other places where you are correctly using these around function arguments, then run the code and slide the slider and see your plot

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract