# This cell illustrates one rectangular prism in the desired volume.
# By adjusting x0 and y0 the user can determine which prism to view.
#
# For this cell, the first constraint must not involve the top or bottom of the solid
# The second (functional) constraint involves the top of the solid.
# Here, the bottom is presumed to be z = 0.
var('x,y,z,t')
# constraint1(x,y,z) = y == 4-x^2
# constraint2(x,y) = z == 4-x^2
# Larson #27
constraint1(x,y,z) = z == x*y
constraint2(x,y,z) = y == x
# Larson #29
constraint1(x,y,z) = 1 == x^2 + z^2
constraint2(x,y,z) = 1 == y^2 + z^2
# Larson #30
# constraint1(x,y,z) = z == 4 - x^2
# constraint2(x,y,z) = y == 4 - x^2
n=10
@interact
def _(x0 = slider(0,2),y0 = slider(0,4),
xmin = input_box(-4,label='Min x',width=5),
xmax = input_box(4,label='Max x',width=5),
ymin = input_box(-4,label='Min y',width=5),
ymax = input_box(4,label='Max y',width=5)):
delx = (xmax-xmin)/n
dely = (ymax-ymin)/n
# Larson, #29
G = implicit_plot3d(constraint1, (x, 0, 2), (y,0,2), (z,0,2),opacity=0.6)
G += implicit_plot3d(constraint2, (x, 0, 2), (y,0,2), (z,0,2),color='green',opacity=0.6)
# Larson, #27
# G = implicit_plot3d(constraint1, (x, 0, 1), (y,0,2), (z,0,4),opacity=0.6)
# G += implicit_plot3d(constraint2, (x, 0, 1), (y,0,2), (z,0,4),color='green',opacity=0.6)
# for k in range(40):
# m = k/20
# G += parametric_plot3d([t,m,m*t], (t, 0, 1), color='red', opacity = 0.7)
# G += parametric_plot3d([t,m,0], (t, 0, 2), color='red', opacity = 0.7)
# G += parametric_plot3d([1,m,m*t], (t, 0, 2), color='red', opacity = 0.7)
# Larson, #30
# G = implicit_plot3d(constraint1, (x, 0, 2), (y,0,4), (z,0,4),opacity=0.6)
# G += implicit_plot3d(constraint2, (x, 0, 2), (y,0,4), (z,0,4),color='green',opacity=0.6)
# G = implicit_plot3d(constraint1, (x, 0, 2), (y,0,4), (z,0,4),opacity=0.6)
# G += implicit_plot3d(constraint2, (x, 0, 2), (y,0,4), (z,0,4),color='green',opacity=0.6)
# G += line3d([(x0,y0,0),(x0,y0,constraint2(x0,y0))],thickness=10,color='red')
G.show()
# I1 = integrate(constraint2,y,0,4-x^2)
# I1.show()
# I = integrate(I1,x,0,2)
# print "The desired volume of the region is",I
|
Click to the left again to hide and once more to show the dynamic interactive window
|