Interactive: A Cube within a Hemisphere

558 days ago by lhjruo

A cube placed within a hemisphere

Lauri Ruotsalainen, 2010

A cube is placed within a hemisphere so that the corners of the cube touch the surface of the hemisphere. Observe numerically the ratio of the volume of the cube and the volume of the hemisphere.

Picture:


 

# A cube is placed within a hemisphere so that the corners of the cube touch the surface of the hemisphere; Observe numerically the ratio of the volume of the cube and the volume of the hemisphere. # Lauri Ruotsalainen, 2010 x, y, z = var("x,y,z") @interact def _(size = slider(0.5, 1, label="The Edge Length x:")): hemisphere_graph = implicit_plot3d(x^2+y^2+z^2==1, (x, -1, 1), (y, -1, 1), (z, 0, 1), color="green", opacity=0.4) cube_graph = cube(size=size, opacity=0.9, color="red", frame_thickness=1).translate((0, 0, size/2)) surface_graph = plot3d(0, (x, -1.2, 1.2),(y, -1.2, 1.2), color="lightblue", opacity=0.6) show(hemisphere_graph + cube_graph + surface_graph, aspect_ratio=1) V_c = size^3 V_hs = 4*pi*1^3/6 html("$\\text{Volume of the Cube: }V_{cube} = x^3 = %s^3 = %s" % (N(size, digits=5), N(V_c, digits=5))) html("$\\text{Volume of the Hemisphere: }V_{hemisphere} = \\frac{4\pi r^3}{3}:2 = \\frac{4\pi 1^3}{3}:2 = %s$" % N(V_hs, digits=5)) html("$\\text{Ratio: }V_{cube}/V_{hemisphere} = %s/%s = %s$" % (N(V_c, digits=5), N(V_hs, digits=5), N(V_c/V_hs, digits=5))) 
       

Click to the left again to hide and once more to show the dynamic interactive window