Currently, science is growing, with this development strength, the application of science and scientific patents in schools is very feasible and significant. Since the first year, Ho Chi Minh City University of Technology lecturers have helped technical students get acquainted with programming applications such as MATLAB. MATLAB is a rising and programming environment that allows calculating numbers with matrices, graphing functions or charting information, implementing algorithms, creating user interfaces, and linking to computer programs written in many other programming languages. MATLAB enables simulation of calculations with the Toolbox library, experimenting with many models in practice and techniques. With more than 40 years of establishment and development, MATLAB is an effective calculation tool to solve technical problems today with a relatively simple and universal design. Therefore, for the problems in Algebra, especially matrix problems, we can use MATLABs computing applications to solve most simply and understandably, helping us get acquainted and add more skills to use programs application for students.
Trang 1HCMC University of Technology MATLAB Project
Department of Applied Mathematics Subject: Calculus 2
1 Introduction
Currently, science is growing, with this development strength, the application of science and scientific patents in schools is very feasible and significant Since the first year, Ho Chi Minh City University of Technology lecturers have helped technical students get acquainted with programming applications such as MATLAB MATLAB is a rising and programming environment that allows calculating numbers with matrices, graphing functions or charting information, implementing algorithms, creating user interfaces, and linking to computer programs written in many other programming languages MATLAB enables simulation of calculations with the Toolbox library, experimenting with many models in practice and techniques With more than 40 years of establishment and development, MATLAB is an effective calculation tool to solve technical problems today with a relatively simple and universal design Therefore, for the problems in Algebra, especially matrix problems, we can use MATLAB's computing applications to solve most simply and understandably, helping us get acquainted and add more skills to use programs application for students.
3 Solutions:
Question 1: Find the extreme values of the function f(x; y) = x2 + 2y2 on the circle x2 + y2 = 1 Sketch the given surface and show the extreme values.
fx = 2x ; fy = 4y, the only critical point is (0;0) and f(0;0) =0 To find the critical points on the boundary
value is f (0 ;± 1)=2and the minimun point is f (0 ;0 )=0
Question 2: Find the extreme values of the function f(x; y) = x2y on the curve x2 + 2y2 = 6: Sketch the given surface and show the extreme values.
¿ 1 d2L(P ¿¿ 3), d2L(P ¿¿ 4 )< 0 so P3; P4¿ ¿is local maximum.
¿−1 d2
L(P ¿¿ 5),d2L(P ¿¿ 6)>0 so P5 ; P6islocal minimum ¿ ¿
Trang 2Question 3: Find the extreme values of the function f(x; y) = 6 - 5x - 4y
on the curve x2 + y2 = 9 Sketch the given surface and show the extreme values.
Question 4: Find the extreme values of the function f(x; y) = 1 - 4x - 8y
on the curve x2 + 8y2 = 8 Sketch the given surface and show the extreme values.
Solve equations ∇f= λ∇g and g(x,y)=8 using Lagrange multipliers
Trang 3Therefore the maximum value of f(x,y) on the curve x2 + 8y2 = 8 is f(- 4 √ 3
3 ,- √ 3
3 ) = 1 + 8 √ 3 and the minimum value is f( 4 √ 3
3 , √ 3
3 ) = 1 - 8 √ 3
Question 5: Find the extreme values of the function f(x; y) = x2 + y2 +
xy on the curve x2 + 2y2 = 8 Sketch the given surface and show the extreme values
Consider Lagrange function:
L ( x , y , λ )=x2
+ y2+ xy−λ (1−x2−2 y2
) Find stationary points:
12 ) ;− √ 3− √ 3
12 )
< 0 Maximum point ((1− √ 3) √ 3+ √ 13
12 ; √ 3+ √ 13
12 )
> 0 Minimum point ((1− √ 3)(− √ 3+ √ 13
f ( x , y )=2 x2+12 xy+ y2
x2+ y2=25
fx = 4x+12y gx = 2x
fy = 12x+2y gy = 2y
fx = lamda.gx => 4x +12y = lamda.2x (1)
fy = lamda.gy => 12x +2y = lamda.2y (2)
Trang 43 ) is the minimum point
Question 8: Find the local maximum and minimum values and saddle points of f ( x , y )=x4
+ y4−2 x2
+ 4 xy−2 y2 Sketch the given surface and show
the extreme values.
Trang 5∆ = fxx.fyy – fxy2 = 288x2y2 – 96x2 – 24y2 + 8
fxx fyy ∆ = fxx.fyy – fxy2
Trang 6Therefore, the maximum value of f is f(0,0) = 0, and f( 1
2 ,1) = - 9
8 , f( 1
2 ,1) = 9
-8 , f( −1
2 ,1) = - 9
8 , f( −1
2 ,-1) = - 9
8 are the minimum point.
Question 10: Find the local maximum and minimum values and saddle points of f ( x , y )=(x2
− 2 y2) ex− y Sketch the given surface and show the
Compute: { A=fxx
' '
=(2+2 x ) ex− y+(2 x+x2−2 y2) ex− yB=f' ' xy= (−4 y ) ex− y+ ( 2 x+x2−2 y2) (−1) ex− y
Trang 7So M(-2,0) is the minimum point
Question 13: Find the local maximum and minimum values and saddle points of f ( x , y )=(x2
+ y2)( e−x2
Trang 8∆ >0, A <0 →(1 ;1)is a local minimum
Question 17: Find the local maximum and minimum values and saddle points of f ( x , y )=x3
∆4< 0∧So M2is a saddle point
Question 18: Find the surface area of the part of the sphere x2
+ y2+ z2=4
that lies inside the cylinder x2
+ y2=2 y Sketch the given surface
Trang 9that lies above the cone z2
= x2+ y2 Sketch the given surface.
Since the part of the sphere x2+y2+z2=2 that lies above the cone z2=
x2+y2, can be divided into 2 parts, which have the same area, thus the required surface area is
Trang 10Question 22: Evaluate the solid bounded by 2x + z = 2 and (x - 1)2 + y2
= z Sketch the given solid.
Let { x=rcosφ y=rsinφ | J | = r 0≤ φ ≤ 2 π 0 ≤ φ ≤ 1
( x−1)2+ y2≤ z ≤ 2−2 x (rcosφ−1)2+ rsinφ2≤ z ≤ 2−2 rcosφ
Question 23: Evaluate the volume of the solid bounded by y = x; y = 2x;
x = 1; z = x2 + y2; z = x2 + 2y2 Sketch the given solid.
+ y2=2 x Sketch the given solid.
Letting x = r cosφ, y = r sinφ,
= 3 π
2
Question 25: Evaluate the volume V of the solid Ω bounded by z = 1 – x2
– y2 and z = 0 Sketch the given solid.
Trang 11The volume V of the solid Ω is
Question 26: Evaluate the volume of the solid bounded by y = 1 + x2; z
= 3x; y = 5; z = 0 (where x > 0) Sketch the given solid.
The solid Ω lies under the surface z=3 x and above z=0.
The projection D is bounded by y=1+x2, y=5, x=0
Let x=rcosφ, y=rsinφ: D= { (r , φ): 0 ≤r ≤ 1,0 ≤ φ ≤ 2 π }
The volume V of the solid Ω is
2 dφ=
π
8
Question 29: Evaluate the area of the region D bounded by y = (x+1)2; x
= y-y3; x = -1; y = -1 Sketch the given region.
The curve x = y – y3 goes through the origin and intersects the y-axis at the points (0;-1) and (0; 1)
The curve x = y – y3 intersects the straight line y = 1 and the curve x =
-1 + √ y at (0;-1) and (0; 1) respectively, since they satisfy the equations:
-1 + √ y = y – y3 => { x=0 y=1
The curve x = -1 + √ y intersects the x-y coordinate at (-1; 0) and (0; 1)
The curve x = -1 + √ y intersects the straight line x = -1 at (-1; 0)
Trang 12Question 30: Evaluate ∬
D
2 xdA where D={( x , y ) :2 x ≤ x2
+ y2≤ 6 x , y ≤ x Sketch the given region.
2 x ≤ x2
+ y2≤6 x ↔ { ( x−1)2
+ y2≥1
( x−3)2+ y2≤ 9
Let x=rcosφ, y=rsinφ: 2 cosφ≤ r≤ 6 cosφ
y ≤ x ↔ rsinφ ≤ rcosφ where φ ∈ [ − π
3
3 − cosφ
2(2 cosφ)3
3 ) dφ ≈157.189
Question 31: Evaluate the area of the region D bounded by x + y2 =1; y
- x = 1; x = 0 Sketch the given region.
Trang 13Question 32: Evaluate ∬
D
( x + y )dA where
D={( x , y ) :1≤ x2+ y2≤ 4 , x ≥ 0, y ≥ 0, y ≥ x } Sketch the given region.
By the spherical coordinate system, let { x=rcosφ y=rsinφ | J | = r
Let x=rcosφ, y=rsinφ: 1 ≤r ≤2
x
ydA where D is the region bounded by y2 = x;
x = 0; y = 1 Sketch the given region.
The region D is bounded by { 0 ≤ x ≤ y 0≤ y ≤12
Then I= ∫
0
1
¿ ¿.
Trang 14Question 36: Evaluate ∬
D
xdA where D is a triangle OAB; O(0; 0); A(1; 1);
B(0; 1) Sketch the given region.
0
π / 2cosydy = [ − cosx ] π /2
Sketch the given region.
The region D is bounded by { 1≤ y ≤ 2 0 ≤ x ≤ 2
− 2)dy=12
Question 39: Evaluate ∭
Ω
xy z2dV ; where Ω is the rectangular box given
by Ω:0 ≤ x ≤1 ,−1≤ y ≤ 2, 0 ≤ z ≤3 Sketch the given solid.
( x +2 y)dV e; where Ω is the solid bounded by
x2≤ y ≤ x ,0 ≤ z ≤ x Sketch the given solid.
Trang 15Question 41: Evaluate I= ∭
Ω
√ x2+ z2dV where Ω is the region bounded by
x2+ z2≤ y ≤ 4 Sketch the given solid.
Sketch the given solid.
The region D is bounded by x2
Trang 16Question 44: Evaluate the triple integral with cylindrical coordinates
I= ∭
Ω
1
x2+ y2dV where Ω is the solid bounded by z = 0; z = y; x2 + y2 = 1
and y ≥ 0 Sketch the given solid.
Trang 17( x2+ y2) dV where Ω is the solid hemisphere x2 + y2 + z2 ≤ 1; z ≥ 0:
Sketch the given solid.
Evaluate the triple intergral with spherical coordinates
The solid Ω in the spherical coordinate system is bounded by { 0 ≤θ ≤ π
( x2+ y2+ z2) dV where Ω lies between the spheres x2 + y2 + z2 = 1 and
x2 + y2 + z2 = 4 in the first octant Sketch the given solid.
Let x=rcosφ, y=rsinφ
In the first octant x ≥ 0∧ y ≥ 0 so0 ≤ φ ≤ π
+ z2dV where Ω is the solid that lies within the sphere x2 + y2 +
z2 = 4 and above the cone z= √ x2
+ y2.Sketch the given solid.
Letting x = ρsinθcosφ, y = ρsinθsinφ, z = ρ cosθ
0 ≤ z ≤ √ x2+ y2 z ≤ r
Trang 18Converting from Cartesian coordinate system to spherical coordinate system:
{ x φ=tan2+ y2+−1z2( = y ρ2
x ) θ=tan−1
Question 51: Use spherical coordinates to find the volume of the solid that lies above the cone z= √ x2+ y2 and below the sphere x2 + y2 + z2 = z
Sketch the given solid.
Trang 194 MATLAB code questions:
Question 1: Find the extreme values of the function f(x; y) = x2 + 2y2 on the circle x2 + y2 = 1 Sketch the given surface and show the extreme values.
syms x y lamd real
% Sketch the given surface and show the extreme values
x=linspace(-10,10,30); y=linspace(-10,10,30); [x,y]=meshgrid(x,y);
syms x y lamd real
Trang 20Question 3: Find the extreme values of the function f(x; y) = 6 - 5x - 4y
on the curve x2 + y2 = 9 Sketch the given surface and show the extreme values.
syms x y lamd real
Trang 21Question 4: Find the extreme values of the function f(x; y) = 1 - 4x - 8y
on the curve x2 + 8y2 = 8 Sketch the given surface and show the extreme values.
syms x y lamd real
Trang 22Question 5: Find the extreme values of the function f(x; y) = x2 + y2 +
xy on the curve x2 + 2y2 = 8 Sketch the given surface and show the extreme values
syms x y lamd real
Trang 23Question 6: Find the extreme values of the function f(x; y) = 2x2 + 12xy + y2 on the curve x2 + 4y2 = 25 Sketch the given surface and show the extreme values
syms x y lamd real
Trang 24Question 7: Find the extreme values of the function f ( x , y )=x2+ y2 on the plane x
2 +
y
3 =1 Sketch the given surface and show the extreme values.
syms x y lamd real
Trang 25Question 8: Find the local maximum and minimum values and saddle
points of f ( x , y )=x4+ y4−2 x2+ 4 xy−2 y2 Sketch the given surface and show
the extreme values.
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 26Question 9: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 27Question 10: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 28Question 11: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 29Question 12: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 30Question 13: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 31Question 14: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 32Question 15: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 33Question 16: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 34Question 17: Find the local maximum and minimum values and saddle
if ((Deltai>0) && (A1>0))
sprintf('The point (%8.4f, %8.4f) is minimum
point',double(criticalx(i)),double(criticaly(i)))
end
if ((Deltai>0) && (A1<0))
sprintf('The point (%8.4f, %8.4f) is maximum
Trang 35Question 18: Find the surface area of the part of the sphere x2
polarfun = @(phi,r) fun(r.*cos(phi),r.*sin(phi)).*r;
rmax = @(phi) 2*sin(phi);
q = integral2(polarfun,0,pi,0,rmax)
area=double(q);
fprintf('The surface area is %6.2f',area)
%Sketch the figure %Rotate to observe the surface
syms phi theta z2
x1 = 2*sin(phi)*cos(theta), y1 = 2*sin(phi)*sin(theta), z1 = 2*cos(phi)x2 = cos(theta), y2 = 1+sin(theta)
x2 = cos(theta), y2 = 1+sin(theta)
figure; rotate3d on
fsurf(x1, y1, z1, [0 pi 0 2*pi], 'MeshDensity', 20); hold on
x1 = 2*cos(theta), y1 = 2*sin(theta)
fplot3(x1, y1, sym(0), [0 2*pi], 'r')
s1 = sym(sqrt(4)), y1 = s1*cos(theta), z1 = s1*sin(theta)
fplot3(sym(0), y1, z1, [0 2*pi], 'm')
hold on;
fsurf(x2, y2, z2, [0 2*pi -3 3], 'MeshDensity', 12)
axis equal; alpha 0.2
xlabel('x'); ylabel('y'); zlabel('z')
Trang 36Question 19: Find the surface area of the sphere x2
fprintf('The surface area is %6.2f',area)
%Sketch the figure %Rotate to observe the surface
syms phi theta
x = 3*sin(phi)*cos(theta), y = 3*sin(phi)*sin(theta), z = 3*cos(phi)
figure
fsurf(x, y, z, [0 pi 0 2*pi], 'MeshDensity', 20); hold on
x = 3*cos(theta), y = 2*sin(theta)
fplot3(x, y, sym(0), [0 2*pi], 'r')
s1 = sym(sqrt(9)), y = s1*cos(theta), z = s1*sin(theta)
fplot3(sym(0), y, z, [0 2*pi], 'm')
axis equal; alpha 0.2
xlabel('x'); ylabel('y'); zlabel('z')
Question 20: Find the surface area of the part of the sphere x2
+ y2+ z2
= 2
that lies above the cone z2
= x2+ y2 Sketch the given surface.
Trang 37x1 = sqrt(2)*sin(phi)*cos(theta), y1 = sqrt(2)*sin(phi)*sin(theta), z1 = sqrt(2)*cos(phi)
eq = z^2 == x^2 + y^2
figure
fsurf(x1, y1, z1, [0 pi 0 2*pi], 'MeshDensity', 20); hold on
x1 = sqrt(2)*cos(theta), y1 = 2*sin(theta)
fplot3(x1, y1, sym(0), [0 2*pi], 'r')
s1 = sym(sqrt(2)), y1 = s1*cos(theta), z1 = s1*sin(theta)
fplot3(sym(0), y1, z1, [0 2*pi], 'm')
hold on;
fsurf(r*cos(theta), r*sin(theta), r, [-3 3 0 2*pi], 'MeshDensity', 16)axis equal;alpha 0.2
xlabel('x'); ylabel('y'); zlabel('z')
Question 21: Find the surface area of the part of the surface z = xy that
lies inside the cylinder x2+ y2 = 1 Sketch the given surface.
fun = @(x,y) sqrt(1+x.^2+y.^2);
polarfun = @(phi,r) fun(r.*cos(phi),r.*sin(phi)).*r;
q = integral2(polarfun,0,2*pi,0,1)
area=double(q);
fprintf('The surface area is %6.2f',area)
%Sketch the figure %Rotate to observe the surface
syms z theta
x = cos(theta), y = sin(theta)
figure
fsurf(x, y, z, [0 2*pi -5 5], 'MeshDensity', 12)
axis equal; alpha 0.2
xlabel('x'); ylabel('y'); zlabel('z')
hold on
x=linspace(-1,1,30); y=linspace(-5,5,30); [x,y]=meshgrid(x,y);
f=x.*y
mesh(x,y,f)