# Need help with ContourPlot3D

I need to print out the value of x, y, and z when h==0, g==0. Help please?

h = x^2 + y^2 + z^2 - 2;
g = x^3 + y^2 - z^2;

ContourPlot3D[{h == 0, g == 0}, {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
MeshFunctions -> {Function[{x, y, z, f}, h - g]},
MeshStyle -> {{Thick, Blue}}, Mesh -> {{0}},
ContourStyle ->  Directive[Orange, Opacity[0.5], Specularity[White, 30]]]


• The blue Pringle-shaped curve is when h==0 and g==0. Otherwise you could use Solve[{h == 0, g == 0}, {x, y, z}]. ?? Nov 8, 2019 at 19:26
• @ChrisK. I knew the blue curve is when h==0 and g==0, but in other word what arex,y values at z=0 point in the z-axis? Nov 8, 2019 at 20:16
• The question in the comment is not the same as the question in the OP. Could you please edit the question in the OP? Nov 9, 2019 at 8:55

Like Chris says in a comment, Solve can be used to find the values where h == 0 && g == 0, at least for two variables since we have two equations. You take as an example z = 0. For that case we have the following:

Solve[h == 0 && g == 0 /. z -> 0, {x, y}, Reals]


{{x -> -1, y -> -1}, {x -> -1, y -> 1}}

Here's a demonstration of finding the values for different z:

sols[zval_] := Append[zval] /@ Values@Solve[h == 0 && g == 0 /. z -> zval, {x, y}, Reals]

cp = ContourPlot3D[
{h == 0, g == 0},
{x, -2, 2}, {y, -2, 2}, {z, -2, 2}
];

pts = Flatten[Table[Quiet@sols[z], {z, -2, 2, 0.1}], 1];
Show[
cp,
Graphics3D[{
Green, ,
Sphere[pts, 0.2]
}]
]