- Variable Definition:
- Three variables
x
,y
, andz
are defined symbolically using thevar
function. These variables represent the coordinates in three-dimensional space.
- Three variables
- Equation Definition:
- Three equations representing planes are defined:
eq1
: x + 2y + 4z = 7eq2
: 3x+7y+2z=-11eq3
: 2x+3y+3z=1
- Three equations representing planes are defined:
- Plotting the Planes:
- Each equation is plotted in a different color with the
implicit_plot3d
function. Thecolor
parameter specifies the color of the plane, and theopacity
parameter sets the transparency level. In this case, each plane is set to have a transparency of 0.5, making them partially see-through.
- Each equation is plotted in a different color with the
- Labeling the Planes:
- Each plane is labeled with its equation using the
text3d
function. The labels are positioned at specific coordinates in the three-dimensional space to avoid overlap.
- Each plane is labeled with its equation using the
- Adding Arrows:
- Arrows representing the direction of the normal vectors to each plane are added. The direction of each arrow corresponds to the coefficients of the normal vectors derived from the equations.
- Displaying the Plot:
- All the components (planes, labels, and arrows) are combined using the
+
operator and displayed using theshow
function.
- All the components (planes, labels, and arrows) are combined using the
Overall, the code generates a 3D plot showing three planes with transparency applied to each plane separately, along with labels indicating their equations and arrows indicating the direction of their normal vectors.
Define variables
x, y, z = var('x,y,z')
Define equations
eq1 = x + 2y + 4z == 7
eq2 = 3x + 7y + 2z == -11
eq3 = 2x + 3y + 3z == 1
Plot each plane in a different color with transparency and label them
plane1 = implicit_plot3d(eq1, (x, -10, 10), (y, -10, 10), (z, -10, 10), color='blue', opacity=0.5)
plane2 = implicit_plot3d(eq2, (x, -10, 10), (y, -10, 10), (z, -10, 10), color='green', opacity=0.5)
plane3 = implicit_plot3d(eq3, (x, -10, 10), (y, -10, 10), (z, -10, 10), color='red', opacity=0.5)
Label each plane with its equation using text3d
label1 = text3d("x + 2y + 4z == 7", (8, 5, 8), color='blue')
label2 = text3d("3x + 7y + 2z == -11", (-8, -5, 8), color='green')
label3 = text3d("2x + 3y + 3z == 1", (-8, 5, -8), color='red')
Add arrows indicating the direction of the normal vectors
arrow1 = arrow3d((8, 5, 8), (8 + 1, 5 + 2, 8 + 4), color='blue')
arrow2 = arrow3d((-8, -5, 8), (-8 + 3, -5 + 7, 8 + 2), color='green')
arrow3 = arrow3d((-8, 5, -8), (-8 + 2, 5 + 3, -8 + 3), color='red')
Show the plots
show(plane1 + plane2 + plane3 + label1 + label2 + label3 + arrow1 + arrow2 + arrow3)