I want to plot only parts of the sphere of radius 1 where the gradient $\frac{\partial z}{\partial x}$ is < 0, = 0 and > 0.
The full sphere is given by:
ContourPlot3D[x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]
I know how to plot parts of the sphere where $x^2 + y^2 + z^2 < 0.5 $ or something, but I can't figure out how to apply the condition to the gradient.
UPDATE: The positive and negative gradients turn out fine, but when I try to plot gradient = 0 it turns out funny.
I tried to find $\frac{\partial z}{\partial x} = 0$ for the equation but it didn't work: $$x^2 + y^2 + z^2 == xy $$
eq1 = x^2 y + y^2 + z^2 x == x y
ContourPlot3D[Evaluate[eq1], {x, -2, 1}, {y, -2, 2}, {z, -2, 2}]
deriv = Derivative[1, 0][z][x, y] /.
First[ Solve[ D[eq1 /. z -> z[x, y], x],
Derivative[1, 0][z][x, y] ] ] /. z[x, y] -> z;
Positive1 =
ContourPlot3D[Evaluate[eq1], {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
RegionFunction -> Function[{x, y, z}, deriv > 0], Mesh -> False,
ContourStyle -> Blue, MaxRecursion -> 5];
Negative1 =
ContourPlot3D[Evaluate[eq1], {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
RegionFunction -> Function[{x, y, z}, deriv < 0], Mesh -> False,
ContourStyle -> Red, MaxRecursion -> 5];
zero1 = ContourPlot3D[
Evaluate[eq1], {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
RegionFunction -> Function[{x, y, z}, deriv = 0], Mesh -> False,
ContourStyle -> Green, MaxRecursion -> 5];
Show[Positive1]
Show[Negative1]
show[zero1]