# Manipulate the parametric plot of a torus [duplicate]

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.

## 1 Answer

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}]