222 - Topic 14.5 - Switching order of integration

152 days ago by Professor222

John Travis

Mississippi College

Spring 2013

Evaluate  $\int_{0}^{4}\int_{\sqrt{x}}^{2}\frac{3}{2+y^3}dy dx$

var('x,y') f = 3/(2+y^3) plot3d(f,(x,0,4),(y,0,2)) 
       
var('x,y') @interact def _(top = input_box(y<=2), bottom = input_box(y>=sqrt(x)), xs = input_grid(1,2, default = [[0,4]],label='x range ='), ys = input_grid(1,2, default = [[0,4]],label='y range ='), x0 = slider(0,4,0.2,1)): constraints = (top, bottom) a = xs[0][0] b = xs[0][1] c = ys[0][0] d = ys[0][1] n = 100 dely = (d-c)/n G = region_plot(constraints , (x,a,b), (y,c,d), plot_points=400) for k in range(n): y0 = c+k*dely if bottom(x=x0,y=y0) and top(x=x0,y=y0): G += point((x0,y0),color='red',size=20,zorder=2) G.show() 
       
top 
bottom 
x range = 
y range = 
x0 

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

# Doing the problem as stated with dy first and then dx var('x,y') f = 3/(2+y^3) # We need these so that the inside integral knows everything is real valued assume(x>0) assume(sqrt(x)<2) I_y = integrate(f,y,sqrt(x),2) show(I_y) I_yx =integrate(I_y,x,0,4) show(I_yx) print "Numerically, the integral evaluates to ",I_yx.n() 
       
Numerically, the integral evaluates to  1.60943791243410
Numerically, the integral evaluates to  1.60943791243410
# Let's look at the region we are integrating over @interact def _(x0=slider(0,4,0.1,1.2,label='$x_0$'),y0=slider(0,2,0.1,1.8,label='$y_0$')): G = plot(2,(x,0,4),fill=True,fillcolor='green') G += plot(sqrt(x),(x,0,4),fill=True,fillcolor='white') G += text("This is the region.",[0.75,1.5]) # Vertical Strip...dy dx G += line([(x0,sqrt(x0)),(x0,1.97)],color='red',thickness=10) G += text("$y=\sqrt{x}$",[x0,sqrt(x0)-0.1]) G += text("$y=2$",[x0,2+0.1]) # Horizontal Strip...dx dy G += line([(0.03,y0),(y0^2,y0)],color='yellow',thickness=10) G += text("$x=y^2$",[y0^2+0.2,y0]) G += text("$x=0$",[0-0.1,y0]) G.show() 
       

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

# Switching the order of integration, dx and then dy I_x =integrate(f,x,0,y^2) show(I_x) I_xy =integrate(I_x,y,0,2) show(I_xy) print "Numerically, the integral evaluates to ",I_xy.n() 
       
Numerically, the integral evaluates to  1.60943791243410
Numerically, the integral evaluates to  1.60943791243410
(I_yx - I_xy).show() (I_yx - I_xy).n(digits=100) 
       
-1.428734239102843727769729435381676199314887493528498326518907304034540\
794883422744594310027325215037e-101
-1.428734239102843727769729435381676199314887493528498326518907304034540794883422744594310027325215037e-101
# In polar coordinates... # Under z = e^(-cx^2-cy^2) # inside d^2 < x^2+y^2 < b*a^2 var('r,theta,a,b,c,d') assume(c>1,b>1) I1 = integrate(e^(-c*r^2)*r,r,d,sqrt(b)*a) I = integrate(I1,theta,0,2*pi) lim(I,a=oo) 
       
pi*e^(-c*d^2)/c
pi*e^(-c*d^2)/c