2
$\begingroup$

I have a function f[x_, y_, z_] := (x - y) (z^2 - x*y) of three variables x, y and z. The conditions for f[x, y, z] to have zeros are x=y or z^2 = x*y. Now if I impose the condition that that f[x, y, z] is a non-negative function, then how do the above conditions for zeros get affected for a fixed x while varying y and z?

$\endgroup$
2
  • 2
    $\begingroup$ You can use RegionFunction in ContourPlot3D[] to impose your constraints. $\endgroup$ Sep 19, 2023 at 15:59
  • $\begingroup$ f[x_, y_, z_] := (x - y) (z^2 - x*y); ContourPlot3D[ f[x, y, z] == 0 // Evaluate, {y, -5, 5}, {z, -5, 5}, {x, -5, 5}, PlotPoints -> 30, MaxRecursion -> 2, RegionFunction -> Function[{x, y, z}, f[x, y, z] >= 0], RegionBoundaryStyle -> None, AxesLabel -> {"y", "z", "x"}, LabelStyle -> {10, Bold}] $\endgroup$
    – cvgmt
    Sep 19, 2023 at 22:07

1 Answer 1

1
$\begingroup$
a = 1; 
f[x_, y_, z_] := Max[{(x - y) (z^2 - x*y), 0}];
ContourPlot3D[f[x, y, z], {x, -a, a}, {y, -a, a}, {z, -a, a}]

enter image description here

UPDATE

This is probably more exactly what you are asking. Mathematica has a bit of a problem plotting the surface where the function is zero or near zero:

a = 1;
g[x_, y_, z_] := (x - y) (z^2 - x*y);
f[x_, y_, z_] := Piecewise[{{g[x, y, z], g[x, y, z] >= 0}}, Undefined]
ContourPlot3D[f[x, y, z], {x, -a, a}, {y, -a, a}, {z, -a, a}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.