You are on page 1of 7

Name : Ananyaa Gupta

Reg. no. : 20BCT0177


Slot : L3-L4

Experiment 5A Triple Integrals


Aim : To find volume of sphere x2+y2+z2=9 using triple integration.

Mathematical background :
The triple integration of a function given by f inside a region R is
represented
as

Here dV = dx dy dz
To solve a triple integration we integrate one by one with respect to a
particular variable one at a time (like we do for partial differentiation)
keeping
the other variables constant

To find the volume of a sphere as our question suggests using triple


integration we take f as 1 because we will die the region R in such a way
that
it will only contain the region inside that sphere.
MATLAB code :
clc
clearvars
close all
syms x y z
f=1;%%as if we other tan 1 we cannot visualise as it will
become 4d
x1=input('Enter the limits of x');
y1=input('Enter the limits of y');
z1=input('Enter the limits of z');
i=int(int(int(f,z,z1(1),z1(2)),y,y1(1),y1(2)),x,x1(1),x1(2))
;
disp('The volume is : ')
disp(i)
viewSolid(z,z1(1),z1(2),y,y1(1)+0*x+0*z,y1(2)+0*x+0*z,x,x1(1
)+0*y+0*z,x1(2)+0*y+0*z)

Output :
inputs:

Enter the limits of x


[-3 3]
Enter the limits of y
[-sqrt(9-x^2),sqrt(9-x^20]
Enter the limits of y
[-sqrt(9-x^2) sqrt(9-x^2)]
Enter the limits of z
[-sqrt(9-x^2-y^2) sqrt(9-x^2-y^2)]
result
The volume is :
36*pi

Conclusion :
Hence we found out using MATLAB that the volume of the given
sphere
is 36*pi cubic units.
Experiment 5B Divergence ,Curl and Gradient and
visualisation of vector field
Aim :
To find the volume bounded by the curve x2+2y2+z=16 , the
planes
x=2 , y=2 and the three coordinate plane
Mathematical background :
A vector field is an assignment of a vector to each point in a subset of
space.
A vector field in the plane can be visualised as a collection of arrows with
a
given magnitude and direction, each attached to a point in the plane.
Given below is an example of a vector field

The divergence of a vector field simply measures how much the flow is
expanding at a given point. It does not indicate in which direction the
expansion is occuring. Hence (in contrast to the curl of a vector field),
the divergence is a scalar. Divergence of a vector v is given b by
In vector calculus, the curl is a vector operator that describes the
infinitesimal
circulation of a vector field in three-dimensional Euclidean space

Curl of a vector F whose i , j , k components are represented by P,Q,R is


given by

For a completely 2d vector (x y plane) the curl will be in only z direction


i.e. a
function of x and y.
MATLAB code :
clearvars
close all
clc
syms x y z
f=input('Input vector function in x and y');
subplot(1,2,1);
[X, Y] = meshgrid(-2:.2:2,-2:.2:2);
G1 = subs(f(1),[x y],{X,Y});
G2 = subs(f(2),[x y],{X,Y});
quiver(X,Y,G1,G2)
d=divergence(f,[x,y,z]);
c=curl(f,[x,y,z]);
disp('The divergence is :')
disp(d)
disp('The curl is : ')
disp(c)
xlabel('X axis')
ylabel('Y axis')
zlabel('Z axis')
title('Vector field')
subplot(1,2,2);
Z=subs(c(3),[x,y],{X,Y});
s=surf(X,Y,double(Z),'FaceAlpha',0.8);
s.EdgeColor='none';
xlabel('X axis')
ylabel('Y axis')
zlabel('Amount of curl')
title('Representation of curl')
Output :

Conclusion :
Hence we successfully found the divergence and curl of the given
vector field and visualised that vector field and the curl using
MATLAB.

You might also like