How Do I set a variable bigger than another variable?

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” bigger
than “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 :slight_smile:

Best regards, Stephan

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.

Wow, this is genius, thanks alot ;D

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

Wolfram posted the code automatically in the here but thanks I I’ll definitely give it a try :slight_smile: if it works how I think it works it might even be better than the “If []”

Double post my bad.