Determine allowable values in the torus: y = Sqrt[(r^2 - (x - R)^2)]?

I’m doing a project for my calculus class where we are determining the volume and surface area of a torus.The question I am on is asking me to find the allowable values of "R’ and ‘r’ in the equation y=Sqrt[(r^2 - (x - R)^2)]. It gives us the manipulate shown below, but it does not work. I can manipulate “R” just fine, but when I try to move “r,” the picture disappears. Could somebody tell me if this is typed in wrong? Or is there another way to solve this problem?

What I typed in:

Manipulate[
 ParametricPlot3D[
  {(R + r Cos[\[Alpha]]) Cos[\[Theta]], (R + 
      r Cos[\[Alpha]]) Sin[\[Theta]], r Sin[\[Alpha]]}, {\[Alpha], 0, 
   2 \[Pi]}, {\[Theta], 0, 2 \[Pi]},
  PlotPoints -> 50, ImageSize -> Small, Mesh -> None,
  {Axes -> False, Boxed -> False}, PlotStyle -> Brown, 
  ImageSize -> 200],
 {R, 0.2, 0.629961}, {r, 0.2, radiusr}]

Usually, copy the equation out of Manipulation and try the value by hand in new Cell. if there is an error by hand then that is why it disappears, it stops on errors.

however i tried the exmample and it works

above i visually see ie, Cos[[Alpha]] which should be Cos[Alpha], but unsure if that just from the way you pasted it, the way the community site displays it, or if someone gave you “bad code”

another consideration is to run it all in a Module[{r,R,Theta,…}, code to protect it from erroneous ?Global* assignments. if you have no work to save you can remove Global* to insure nothing is substituted in your eqn that your having no idea are impacting them. perhaps you can use tools such as “trace”. but better bet is to just start fresh so your sure nothing is unintentionally getting in.

consider this:

In: yx[z_]:=5+z In: x=5 In: wx=7

you now have 3 different x’s all kept separately. you can change your “Context Path” if you keep having to type wx and want w the default instead of Global`

In: w`x
Out: 7

You are right, about the cos[alpha] part, in that the way it’s shown is just the way the site shows it. Though I’m still unsure how to solve the problem.
To be more specific, the problem states “Find the range of allowable values for R and r, with 0.2<r<0.629961.” I think the problem may be with the “radiusr” part at the end of the code.

I should also specify that the volume of the torus has to be fixed at (pi^2)/2