Doubl_e integral_Evaluating Volume under Surfaces (2) (1)
Doubl_e integral_Evaluating Volume under Surfaces (2) (1)
Aim: To evaluate the volume under surface using double integral and to
visualize the same using MatLab.
Statement of the problem: Evaluate and visualize the volume represented by the
double integral
x 2 y2 (x)
∫∫ f ( x , y ) dydx . (1)
x 1 y1 (x)
Above integral represents volume of the region below the surface z=f (x , y ) and
above the plane z=0 . This integral can also be setup in the following way (by
changing the order of integration of x and y):
y2 x 2( y)
∫∫ f ( x , y ) dxdy . (2)
y1 x 1( y)
volume=∫ (∫ ( f (x , y), x , x 1 ( y ) , x 2 ( y ) ) , y , y 1 , y 2)
Further, to visualize the volume in MatLab we make use of two additional MatLab
functions (provided by MathWorks) viz. “viewSolid” and “viewSolidone”. These
supporting function files can be downloaded from the link
ftp://10.30.2.53/MATLAB/.
The first function “viewSolid” is used to visualize the integrals in which the order of
integration is as given in (1) and “viewSolidone” is for the integrals of the form (2).
What follows is the syntax for using “viewSolid” and “viewSolidone” commands:
viewSolid(z,0,f(x,y),y,y1(x),y2(x),x,x1,x2)
viewSolidone(z,0,f(x,y),x,x1(y),x2(y),y,y1,y2)
It should be observed that the “viewSolid” command is used when y1 and y2 are
functions of x whereas x1 and x2 are constants. The “viewSolidone” command is
used in the reverse case. Now we consider few examples for illustration of the
approach mentioned above.
Example 1:
Set up a double integral to find the volume of a sphere of unit radius.
Solution:
Let the sphere be x 2+ y 2+ z 2=1 . We know that due to the symmetry the volume of the
sphere is 8 times its volume in the first octant. Thus we setup a double integral to find
the volume below the surface of the sphere in the first octant only and write the total
volume as:
1 √1− x2
V =8∫ ∫ √1−x 2− y 2 dy dx .
0 0
MATLAB Code:
clc
clear all
syms x y z
vol=8*int(int(sqrt(1-x^2-y^2),y,0,sqrt(1-x^2)),x,0,1)
viewSolid(z,0+0*x*y,sqrt(1-x^2-y^2),y,0+0*x,sqrt(1-x^2),x,0,1);
axis equal; grid on;
clc
clear all
syms x y z
vol=8*int(int(sqrt(1-x^2-y^2),y,0,sqrt(1-x^2)),x,0,1)
viewSolid(z,0+0*x*y,sqrt(1-x^2-y^2),y,0+0*x,sqrt(1-x^2),x,0,1); axis equal; grid
on;
Output:
vol =
(4*pi)/3
1
0.8
0.6
z
0.4
0.2
0
0
1
0.5
0.5
1 0
y
x
Example 2:
Find the volume of the solid that lies under the paraboloid z=x 2 + y 2 and above the
region D in the xy -plane bounded by the lines y=2 x and the parabola y=x 2
Solution:
The double integral for this problem can be setup as:
4 √y
∫ ∫ ( x2 + y 2 ) dx dy
0 y/ 2
clc
clear all
syms x y z
vol = int(int(x^2+y^2, x,y/2,sqrt(y)), y, 0, 4)
viewSolidone(z,0+0*x*y,x^2+y^2,x,y/2,sqrt(y),y,0,4);
grid on;
MATLAB Code:
Clc
clear all
syms x y z
vol = int(int(x^2+y^2, x,y/2,sqrt(y)), y, 0, 4)
viewSolidone(z,0+0*x*y,x^2+y^2,x,y/2,sqrt(y),y,0,4); grid on
Output:
vol =
216/35
20
15
10
z
5 0
1
0 2
0 3
0.5
1
1.5 4
2 x
y
Example 3:
∬ ( x−3 y 2 )dA
Evaluate R where R={( x , y )|0≤x≤2 , 1≤ y≤2 }
Given below is the Matlab code for the above problem.
MATLAB Code:
clc
clear all
syms x y z
viewSolid(z,0+0*x+0*y,x-3*y^2+0*y,y,1+0*x,2+0*y,x,0,2)
int(int(x-3*y^2+0*y,y,1,2),x,0,2)
Output:
In the Command window:
>> ans
-12
In the Figure window:
-2
-4
-6
-8
z
-10
-12
2
2
1.5 1.5
1
0.5
y 1 0
x
Inference:
In this figure the required volume is below the plane z=o (shown in red) and above
the surface z=(x-3y^2)(shown in green) . The reason why the answer is negative is
that the surface z=(x-3y^2) is below z=0 for the given domain of integration.
Example 4:
Output:
In the Command window:
>> ans
0
In the Figure window:
2
z -1
-2
-3
-4
0 2 1.2 1
4
2 1.8 1.6 1.4
x y
Inference:
For a function f(x,y) that takes on both positive and negative values ∬ f (x , y )dA is
R
a difference of volumes V1-V2, V1 is the volume above R and below the graph of f
and V2 is the volume below R and above the graph. The integral in this example is 0
means V1=V2
D 0 0
clc
clear all
syms r theta
V = int(int((1-r^2)*r, r, 0, 1), theta, 0, 2*pi)
fsurf(r*cos(theta),r*sin(theta), 1-r^2, [0 1 0 2*pi], 'MeshDensity', 20)
axis equal; axis([-2 2 -2 2 0 1.3])
xticks(-2:2); yticks(-2:2); zticks(0:1.3)
xlabel('x'); ylabel('y')
Output
V = pi/2
Figure window:
Example 6
Find the volume of the solid that lies under the paraboloid z=x 2 + y 2 and above the
xy- plane, and inside the cylinder x 2+ y 2=2 x
Sol:
By changing the coordinates from Cartesian to Polar we get
❑ π /2 2 cos θ
V =∬ (x ¿ ¿ 2+¿ y )dA= ∫ ∫ ( r 2 ) rdrθ ¿ ¿
2
D −π / 2 0
Matlab code
clc
clear all
syms r theta z r1
V = int(int((r^2)*r, r, 0,2*cos(theta) ), theta, -pi/2, pi/2)
r = 2*cos(theta), x = r*cos(theta), y = r*sin(theta)
fsurf(x,y,z, [0 2*pi 0 1], 'MeshDensity', 16)
axis equal; xlabel('x'); ylabel('y'); zlabel('z')
zticks(0:1.5)
hold on
fsurf(r1*cos(theta),r1*sin(theta),r1^2, [0 1 0 2*pi], 'MeshDensity', 20)
Output:
V = (3*pi)/2
Exercise Problems:
1. Set up a double integral to find the volume of the hoof of Archimedes, which
is the solid region bounded by the planes z= y , z=0 , and the cylinder
2 2
x + y =1.
2. Write an iterated integral to view the volume enclosed by the cone z 2=x 2+ y 2
and the plane z=0 . Hence find the volume.
3. Find the volume of the solid bounded by the elliptic paraboloid
2 2
x + 2 y + z=16 , the planes x=2 and y=2 and the three coordinate planes.
4. Use polar coordinates to find the volume of the solid that lies under the cone
z=√ x 2+ y 2 and above the disk x + y ≤ 4
2 2