# Plot3D with y as a function of x

I wanted to plot a function of two variables so I have decided to make use of Mathematica.

The function is

$z =\ ( 1 / 6) \ y^2 + \ ( \pi \ / 6 )(x^2y)$

where

$\ y=\sqrt{9-x^2}$

Sorry for what may be a simple question, but how do I plot the graph with the restriction on y?

I have written this code

 Plot3D[1/6  * (y)^2 + Pi/6* x^2 * (y), {x, -3, 3}, {y, Sqrt[9 - x^2],
Sqrt[9 - x^2]}]


But I get a wireframe type of graph back.

How can I get a filled in graph which depicts the function along with its restriction? Thank you.

• Consider Plot3D[1/6*(y)^2 + Pi/6*x^2*(y), {x, -3, 3}, {y, Sqrt[9 - x^2], Sqrt[9 - x^2]}, ViewPoint -> Front] and Plot[1/6*(y)^2 + Pi/6*x^2*(y) /. y -> Sqrt[9 - x^2], {x, -3, 3}]. The second makes the substitution prior to plotting. – Edmund Mar 12 '17 at 19:11
• I could be misinterpreting your suggestion, but running these two lines gives me a 2D function along with a graph plot quite like what I already had. – Larry Mar 12 '17 at 19:53
• It is not quite clear to me what sort of graph you are looking for. Maybe this one: With[{y=Sqrt[9-x^2]},ParametricPlot3D[{x, y, y^2/6 +x^2 y \[Pi]/6}, {x, -3, 3}]]? – Fred Simons Mar 12 '17 at 20:05
• Fred I think that is what I'm looking for. Thank you very much. Is there a way to project the lines down to z = 0, so as to make it a surface rather than a function? – Larry Mar 12 '17 at 20:27
• You can modify Fred's code like this With[{y = Sqrt[9 - x^2]}, ParametricPlot3D[{x, y, u (y^2/6 + x^2 y Pi/6)}, {x, -3, 3}, {u, 0, 1}]] – Simon Woods Mar 12 '17 at 20:44

r[t_] := {3 Cos[t], 3 Sin[t], 9 Sin[t]^2/6 + 27 Pi Cos[t]^2 Sin[t]/6}