0
|
5037 Views
|
5 Replies
|
3 Total Likes
View groups...
Share
GROUPS:

# How Do I set a variable bigger than another variable?

Posted 10 years ago
 Hello there, This is my first experience with mathematica and I would like to give my plot the "perfect" touch with telling my plot that it isnt allowed to pick any "r" biggerthan "a" so that r < a is true. This is the code i entered: r = 1; w = 2 \[Pi]; a = 2; v = 0.1; Manipulate[ ParametricPlot[{v*t (1 + 1/(1 - r/a*Cos[w*t])), (r*Sin[w*t])/( 1 - r/a*Cos[w*t])}, {t, 0, 10}, PlotRange -> {{-.5, 200}, {-100, 100}}], {r, 0.000000001, 100, Appearance -> "Labeled"}, {a, 0.000000001, 100, Appearance -> "Labeled"}, {v, 0.000000001, 20, Appearance -> "Labeled"}, {w, 0.000000001, 20, Appearance -> "Labeled"}]  This is the Output: I would really appreciate it if someone got an answer to this :) Best regards, Stephan
5 Replies
Sort By:
Posted 10 years ago
Posted 10 years ago
 Wolfram posted the code automatically in the here but thanks I I'll definitely give it a try :) if it works how I think it works it might even be better than the "If []"
Posted 10 years ago
 Hi Stephan,you simply can let 'r' run from 0.00.. to 'a': Manipulate[ ParametricPlot[{v* t (1 + 1/(1 - r/a*Cos[w*t])), (r*Sin[w*t])/(1 - r/a*Cos[w*t])}, {t, 0, 10}, PlotRange -> {{-.5, 200}, {-100, 100}}], {{r, 1}, 0.000000001, a, Appearance -> "Labeled"}, {{a, 2}, 0.000000001, 100, Appearance -> "Labeled"}, {{v, 0.1}, 0.000000001, 20, Appearance -> "Labeled"}, {{w, 2 Pi}, 0.000000001, 20, Appearance -> "Labeled"}] Also please note the way of initialization of the parameters which was probably inteded by you originally.Yours Henrik
Posted 10 years ago
 Wow, this is genius, thanks alot ;D
Posted 10 years ago
 Hi,You can use If[]: Manipulate[ If[ r < a, ParametricPlot[ {v*t (1 + 1/(1 - r/a*Cos[w*t])), (r*Sin[w*t])/(1 - r/a*Cos[w*t])}, {t, 0, 10}, PlotRange -> {{-.5, 200}, {-100, 100}} ], Graphics[Text["error :: r > a"]] ], {r, 0.000000001, 100, Appearance -> "Labeled"}, {a, 0.000000001, 100, Appearance -> "Labeled"}, {v, 0.000000001, 20, Appearance -> "Labeled"}, {w, 0.000000001, 20, Appearance -> "Labeled"} ] I.M.