# how to control the limits of two variables in manipulate

This is my code.

myPlot[a_, b_] := ParametricPlot3D[Sin[x], {x, a, b}];

Manipulate[Show[myPlot[a, b]], {a, -1, 1}, {b, -1, 1}]


I want to manipulate a,b, so that the entire plot will change as we change a,b. However there are errors. Do you know how to fix it ? Thanks

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Feb 11 '15 at 6:12

myPlot[a_, b_] := ParametricPlot3D[{1, x, Sin[x]}, {x, a, b}];

Manipulate[Show[myPlot[a, b]], {{a, -1}, -1, Pi}, {{b, 1}, -1, Pi}]


The errors occur whenever a==b since the domain of the plot is just a point which is not allowed. Consequently, you must handle a==b as a special case. It also helps to fix the PlotRange.

myPlot[a_, b_] := ParametricPlot3D[
{1, x, Sin[x]}, {x, a, b},
PlotRange -> {{0, 2}, {-1, Pi}, {-1, 1}}];

Manipulate[
Piecewise[{
{Graphics3D[
Point[{1, a, Sin[a]}],
Axes -> True,
PlotRange -> {{0, 2}, {-1, Pi}, {-1, 1}}],
a == b}},
myPlot[a, b]],
{{a, -1}, -1, Pi, Appearance -> "Labeled"},
{{b, 1}, -1, Pi, Appearance -> "Labeled"}]