# Manipulate with Contours and 3D plots

First question in this community (and rather new to the Mathematica world): thanks in advance for your help and sorry if the solution to the question is completely trivial!

I would like to have contours with 3D plots in the spirit of the question plotting 3d and contour (along with selected answer), with the addition of manipulate on a given parameter. Thus, for example, in line with the aforementioned previous question, how should I modify this piece of code to get the plot changing with variations wrt to $$a$$:

fun[x_, y_] := x + a y;
Show[Plot3D[fun[x, y], {x, -2, 2}, {y, -2, 3}, Mesh -> None,
PlotStyle -> Directive[Opacity[0.75], Specularity[White, 50]],
ColorFunction -> "Rainbow", PlotTheme -> "Detailed",
FaceGrids -> None],
SliceContourPlot3D[fun[x, y],
z == -1, {x, -2, 2}, {y, -2, 3}, {z, -1, 1},
ColorFunction -> "Rainbow", Boxed -> False]]


I did try to put Manipulate in between Show and Plot3D (with related brackets added), but it didn't work out.

• Manipulate[ Module[{fun}, fun[x_, y_] = x + a y; Show[Plot3D[fun[x, y], {x, -2, 2}, {y, -2, 3}, Mesh -> None, PlotStyle -> Directive[Opacity[0.75], Specularity[White, 50]], ColorFunction -> "Rainbow", PlotTheme -> "Detailed", FaceGrids -> None], SliceContourPlot3D[fun[x, y], z == -1, {x, -2, 2}, {y, -2, 3}, {z, -1, 1}, ColorFunction -> "Rainbow", Boxed -> False]]], {a, -2, 2}] Feb 18, 2023 at 8:58
• Thanks a lot, much appreciated! If you want to write it down as an answer, I will be happy to accept it. Feb 18, 2023 at 9:21
• Thanks, I post it as answer. Feb 18, 2023 at 9:24

Enclose the fun[x_,y_]=x+a*y by Module work.
Manipulate[