# Plotting four surfaces with different constraints in one plot

I generated the plot shown below using this code:

ContourPlot3D[
{x^2 + y^2 == 2.4,
x^2 + y^2 - z^2 == 1,
x^2 + y^2 + (-Sqrt[4.76] + z)^2 == 2.4,
x^2 + y^2 == .5^2},
{x, -10, 10}, {y, -10, 10}, {z, -10, 10},
ContourStyle -> Opacity[.65]] But what I want to do is create this:

equation1 = x^2 + y^2 == 2.4
constraint1 = -0.5 - Sqrt[4.76] <= z <= -Sqrt[4.76]

equation2 = x^2 + y^2 - z^2 == 1
constraint2 = - Sqrt[4.76] <= z <= Sqrt[4.76]

equation3 = x^2 + y^2 + (-Sqrt[4.76] + z)^2 == 2.4
constraint3 = Sqrt[4.76] <= z <= Sqrt[5.51]

equation4 = x^2 + y^2 == .5^2
constraint4 = Sqrt[5.51] <= z <= Sqrt[5.51] + 1.5


I want to plot the surfaces with the constraints given above, so I can get the figure I designed to print in 3D. I'm really confused about how to integrate the constraints in the plot. Any tips?

• Oct 5, 2018 at 4:11

equation1 = x^2 + y^2 == 2.4;
constraint1 = -0.5 - Sqrt[4.76] <= z <= -Sqrt[4.76];
equation2 = x^2 + y^2 - z^2 == 1;
constraint2 = -Sqrt[4.76] <= z <= Sqrt[4.76];
equation3 = x^2 + y^2 + (-Sqrt[4.76] + z)^2 == 2.4;
constraint3 = Sqrt[4.76] <= z <= Sqrt[5.51];
equation4 = x^2 + y^2 == .5^2;
constraint4 = Sqrt[5.51] <= z <= Sqrt[5.51] + 1.5;

g1 = ContourPlot3D[
Evaluate[equation1], {x, -10, 10}, {y, -10, 10}, {z,
constraint1[], constraint1[]},
ContourStyle -> Opacity[.65]];

g2 = ContourPlot3D[
Evaluate[equation2], {x, -10, 10}, {y, -10, 10}, {z,
constraint2[], constraint2[]},
ContourStyle -> Opacity[.65]];

g3 = ContourPlot3D[
Evaluate[equation3], {x, -10, 10}, {y, -10, 10}, {z,
constraint3[], constraint3[]},
ContourStyle -> Opacity[.65]];

g4 = ContourPlot3D[
Evaluate[equation4], {x, -10, 10}, {y, -10, 10}, {z,
constraint4[], constraint4[]},
ContourStyle -> Opacity[.65]];

Show[{g1, g2, g3, g4}, PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}}] 