How to write a function with much variables to repusent following in Show and get figures?
2 Answers
Your question is not clear. I assume you want to plot the values of f and g for fixed z as a function of x and y in one single plot. This can be done e.g. by:
f[x_, y_, z_] = x^2 + y^2 - z^3;
g[x_, y_, z_] = (x^2 - y^2) z^3;
ff[z_] :=
Plot3D[f[x, y, z], {x, 0, 1}, {y, 0, 1}, PlotStyle -> Green]
gg[z_] := Plot3D[g[x, y, z], {x, 0, 1}, {y, 0, 1}, PlotStyle -> Red]
Manipulate[Show[ff[z], gg[z]], {z, 0, 1}]
Show
is generally not needed when combining the same type of plots (e.g., both Plot3D
).
$Version
(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)
Clear["Global`*"]
f[x_, y_, z_] = x^2 + y^2 - z^3;
g[x_, y_, z_] = (x^2 - y^2) z^3;
Manipulate[
Plot3D[
{f[x, y, z], g[x, y, z]},
{x, 0, 1}, {y, 0, 1},
PlotStyle -> {Green, Red},
AxesLabel -> (Style[#, 14] & /@ {x, y}),
PlotLegends -> (Style[#, 16] & /@ {f, g})],
{{z, 0.8}, 0, 1, 0.01, Appearance -> "Labeled"}]