double integral

2051 days ago by basyrova

def my_cube(x, y, z, dx, dy, dz, color_top="blue", opacity_cube=0.8): cx = x + dx/2; cy = y + dy/2; cz = z + dz/2; return cube(size = 1, aspect_ratio=[1,1,1],color=[color_top,"white","white","white","white","white"],frame_thickness=1,frame_color="black",opacity=opacity_cube).scale([dx,dy,dz]).translate([cx,cy,cz]); def my_riemann_cubes(a,b,c,d,n,fun, sx=0, sy=0, color_top="blue", opacity_cube=0.8, color_graph="red", opacity_graph=0.3): dx = (b-a)/n; dy = (d-c)/n; cubes=plot3d(fun, (a,b), (c,d), color = color_graph,opacity=opacity_graph); #cubes = Graphics() for i in range(n): for j in range(n): x = a + dx*i; y = c + dy*j; z = fun(x+dx*sx,y+dy*sy); cubes+=my_cube(x,y,0, dx, dy, z, color_top, opacity_cube); return cubes; 
       
x,y=var("x y"); plot3d( 4 - (1/8)*x^2 - (1/20)*y^2, (x, 0, 4), (y, 0, 4), color="red" ); 
       
.jmol_images
f(x,y) = 4-(1/8)*x^2-(1/20)*y^2 my_riemann_cubes(0, 4, 0, 4, 20, f, opacity_graph=0.6,opacity_cube=0.3, sx=0, sy=0, color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0, 4, 0, 4, 4, lambda x,y: 4-(1/8)*x^2 - (1/20)*y^2,opacity_graph=0.6,opacity_cube=0.3, sx=0, sy=0, color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0, 4, 0, 4, 5, lambda x,y: 4-(1/8)*x^2 - (1/20)*y^2,opacity_graph=0.6,opacity_cube=0.3, sx=0, sy=0, color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0, 4, 0, 4, 10, lambda x,y: 4-(1/8)*x^2 - (1/20)*y^2,opacity_graph=0.6,opacity_cube=0.3, sx=0, sy=0, color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0, 4, 0, 4, 10, lambda x,y: 4-(1/8)*x^2 - (1/20)*y^2,opacity_graph=0.0,opacity_cube=0.3, sx=0, sy=0, color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0, 4, 0, 4, 20, lambda x,y: 4-(1/8)*x^2 - (1/20)*y^2,opacity_graph=0.0,opacity_cube=0.3, sx=0, sy=0, color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0,2,0,4,2, lambda x,y: 2*x+3*y^2, opacity_graph=0.3, opacity_cube=0.3, sx=0, sy=0,color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0,2,0,4,2, lambda x,y: 2*x+3*y^2, opacity_graph=0.3, opacity_cube=0.3, sx=1, sy=1,color_graph="red",color_top="darkblue"); 
       
.jmol_images
my_riemann_cubes(0,2,0,4,2, lambda x,y: 2*x+3*y^2, opacity_graph=0.3, opacity_cube=0.3, sx=0.5, sy=0.5,color_graph="red",color_top="darkblue"); 
       
.jmol_images