0
$\begingroup$

I have failed to get Manipulate to generate a torus whose scaling functions can be adjusted. I have:

x = (a + b*Cos[\[Theta]])*Cos[\[Phi]];
y = (a + b*Cos[\[Theta]])*Sin[\[Phi]];
z = a*Sin[\[Theta]];
v3 = {x, y, z}; (*Parametric definition of a torus*)
ParametricPlot3D[
 v3 /. {a -> 1, b -> 1}, {\[Theta], 0, 2*\[Pi]}, {\[Phi], 0, 
  2*\[Pi]}] (*simple plot of a torus with scaling constants set to 1*)


Manipulate[
 ParametricPlot3D[
  v3, {\[Theta], 0, 2*\[Pi]}, {\[Phi], 0, 2*\[Pi]}], {a, 1, 5}, {b, 1,
   5}] (*attempting to manipulate the scaling constants to play with \
the torus before going further*)

But this fails to even generate a plot, yet by setting the constants a and b I can generate a parametric plot. Thank you in advance.

$\endgroup$

marked as duplicate by zhk, Kuba Jun 14 '17 at 16:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2
$\begingroup$

You can do it like this,

x = (a + b*Cos[θ])*Cos[ϕ];
y = (a + b*Cos[θ])*Sin[ϕ];
z = a*Sin[θ];

v3[a_, b_, θ_, ϕ_] = {x, y, z}

Manipulate[ParametricPlot3D[v3[a, b, θ, ϕ], {θ, 0, 2*π}, {ϕ, 0, 2*π}], {a, 1, 5}, {b, 1, 5}]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.