0% found this document useful (0 votes)
40 views20 pages

123doc Giai Tich 2 Bai Tap Dai Hoc Bach Khoa TPHCM

This document contains an assignment problem for a Calculus 2 course. The problem asks students to: 1) Draw the graph and contour plot of the function f(x,y)=10x^2y - 5x^2 - 4y^2 - x^4 - 2y^4, and identify any local extremes or saddle points. 2) Use calculus techniques to find the exact local extremes and saddle points of the function. 3) The solution provides the graph and contour plot generated in MATLAB, identifying 5 special points. It also shows the calculations to find the critical points and classify the points as local maxima, minima, or saddle points.

Uploaded by

Nga Huỳnh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views20 pages

123doc Giai Tich 2 Bai Tap Dai Hoc Bach Khoa TPHCM

This document contains an assignment problem for a Calculus 2 course. The problem asks students to: 1) Draw the graph and contour plot of the function f(x,y)=10x^2y - 5x^2 - 4y^2 - x^4 - 2y^4, and identify any local extremes or saddle points. 2) Use calculus techniques to find the exact local extremes and saddle points of the function. 3) The solution provides the graph and contour plot generated in MATLAB, identifying 5 special points. It also shows the calculations to find the critical points and classify the points as local maxima, minima, or saddle points.

Uploaded by

Nga Huỳnh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

HO CHI MINH UNIVERSITY OF TECHNOLOGY

Faculty of Applied Science

Assignment: Calculus 2
Instructor: Hoang Hai Ha

Group member: Hoang Hung – 2152097


Dinh Viet Thanh – 21520966
Tran Duy Minh – 2152773
Pham Anh Hoang – 2152082
Vo Hoang Anh Duy – 2152082

HO CHI MINH CITY, May, 2022


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

Contents

1 Problem 1 2

2 Problem 2 10

3 Problem 3 13

Calculus 2 Page 1/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

1 Problem 1
Let z = f (x, y) = 10x2 y − 5x2 − 4y 2 − x4 − 2y 4
a) Draw the graph of the function
b) Draw the contour plot of the function. Point out the local extreme and the saddle point
on that figure.
c) Find the exact local extreme and saddle point (using calculus technique).

Theory

Calculus technique to find local extremes and saddle points


We need to do those two steps:

1. Step 1 : We find the critical points by solving two equations fx = 0, fy = 0

2. Step 2 : Substituting those critical points that we find from step 1 to D(x, y) =
2
fxx fyy − fxy
We apply the second derivative test here. If D(x, y) > 0 it is a saddle point. Other-
wise if D(x, y) < 0, f xx < 0, it is local maximum, else if D(x, y) < 0, f xx > 0, it
is local minimum. Therefore, we can seek local extreme, saddle point.

Solution

a) Draw the graph of the function.


Matlab code

%% SETTING UP
clc ;
clear all ;
close all ;

%% DECLARATION
syms x y Fx Fy Fxx Fyy Fxy D;

%% INPUTED FUNCTION
F = 10∗ x^2∗y − 5∗ x^2 − 4∗ y^2 − x^4 − 2∗ y ^ 4 ;

%Draw t h e graph
clf ;

subplot (1 ,2 ,1);
f s u r f (F , [ − 5 , 5 ] , ’ ShowContours ’ , ’ on ’ ) ;
h o l d on
f o r i = 1 : nMax
zVal = s u b s (F , [ x , y ] , [ max( i , 1 ) , max( i , 2 ) ] ) ;
s c a t t e r 3 (max( i , 1 ) , max( i , 2 ) , zVal , 5 0 , ’ r e d ’ , ’ f i l l e d ’ ) ;

Calculus 2 Page 2/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

end
f o r i = 1 : nMin
zVal = s u b s (F , [ x , y ] , [ min ( i , 1 ) , min ( i , 2 ) ] ) ;
s c a t t e r 3 ( min ( i , 1 ) , min ( i , 2 ) , zVal , 5 0 , ’ g r e e n ’ , ’ f i l l e d ’ ) ;
end
f o r i = 1 : nSaddle
zVal = s u b s (F , [ x , y ] , [ s a d d l e ( i , 1 ) , s a d d l e ( i , 2 ) ] ) ;
s c a t t e r 3 ( s a d d l e ( i , 1 ) , s a d d l e ( i , 2 ) , zVal , 5 0 , ’ b l u e ’ , ’ f i l l e d ’ ) ;
end
hold o f f
g r i d on ;
a x i s on ; a x i s e q u a l ; a x i s s q u a r e ;
x l a b e l ( ’ x ’ ) ; y l a b e l ( ’ y ’ ) ; z l a b e l ( ’ z ␣=␣ f ( x ) ’ ) ;
t i t l e ( ’ The␣ graph ␣ o f : ␣ 10 x^2y␣−␣ 5x^2␣−␣ 4y^2␣−␣x^4␣−␣ 2y^4 ’ ) ;

The result

b) Draw the contour plot of the function. Point out the local
extreme and the saddle point on that figure.
Matlab code

Calculus 2 Page 3/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

%% SETTING UP
clc ;
clear all ;
close all ;

%% DECLARATION
syms x y Fx Fy Fxx Fyy Fxy D;

%% INPUTED FUNCTION
F = 10∗ x^2∗y − 5∗ x^2 − 4∗ y^2 − x^4 − 2∗ y ^ 4;

subplot (1 ,2 ,2);
f c o n t o u r (F , [ − 5 , 5 ] ) ;
hold on
f o r i = 1 : nMax
p l o t (max( i , 1 ) , max( i , 2 ) , ’ r . ’ , ’ m a r k e r s i z e ’ , 2 0 ) ;
end
f o r i = 1 : nMin
p l o t ( min ( i , 1 ) , min ( i , 2 ) , ’ g . ’ , ’ m a r k e r s i z e ’ , 2 0 ) ;
end
f o r i = 1 : nSaddle
plot ( saddle ( i ,1 ) , saddle ( i , 2 ) , ’b . ’ , ’ markersize ’ ,20);
end
hold o f f
g r i d on ;
xlabel ( ’x ’ ); ylabel ( ’y ’ );
a x i s on ; a x i s e q u a l ; a x i s s q u a r e ;
t i t l e ( ’ The␣ Contour ␣ l i n e ’ ) ;
% Maximum p o i n t − r ed
% Minimum p o i n t − g r e e n
% Saddle p o i n t − b l u e
colormap ( ’ p a r u l a ’ ) ;

%% The End

Calculus 2 Page 4/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

3 local extremes are red and 2 saddle points are blue

c) Find the exact local extreme and saddle point (using calculus
technique)
Solved by hand
(
fx = 20xy − 10x − 4x3
We have 2 partial derivative of f (x, y)
fy = 10x2 − 8y 3 − 8y
(
fx = 0
We need to solve the following system of equations:
fy = 0
(
x(20y − 10 − 4x2 ) = 0(1)
<=>
10x2 − 8y 3 − 8y = 0(2)
With x = 0 , we get a root of this system of equations: (0,0)
(
20y − 10 − 4x2 = 0
With x ̸= 0 , from (1) we get the new system of equations:
10x2 − 8y 3 − 8y = 0
(
y = 51 x2 + 12
<=>
10x2 − 8y 3 − 8y = 0

Calculus 2 Page 5/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

(
y = 15 x2 + 12
<=>
10x2 − 8y 3 − 8y = 0
(
y = 15 x2 + 12
<=>
10x2 − 8( 15 x2 + 12 )3 − 8( 15 x2 + 21 ) = 0
(
y = 15 x2 + 12
<=>
10x2 − 8y 3 − 8y = 0
(
y = 15 x2 + 12
<=> −8 6 12 4 36 2
125 x − 25 x + 5 x − 5 = 0(3)
To solve (3), let t = x2 (t > 0) then (3) becomes
−8 3 12 2 36
t − t + t−5=0
125 25 5

t = 6.991922
<=>  t = 0.733861
t = −15.22578
Because t > 0 we just select 2 of 3 roots:

t = 6.991922, t = 0.733861

x = 2.64422
 x = −2.64422
=> x = 0.85666
x = −0.85666
So we get 5 special points

1. (x1 , y1 ) = (0, 0)
2. (x2 , y2 ) = (2.64422, 1.89838)
3. (x3 , y3 ) = (−2.64422, 1.89838)
4. (x4 , y4 ) = (0.85666, 0.64677)
5. (x5 , y5 ) = (−0.85666, 0.64677)

2
fxx = −12x + 20y − 10

We have : fyy = −24y 2 − 8

fxy = 20x

2
Let D(x, y) = fxx fyy − fxy
Following the above equation, we calculate the value ofD(x, y) :

Calculus 2 Page 6/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

(
D(x1 , y1 ) = 80 > 0
1. => So (x1 , y1 ) is local maximum of f
fxx (x1 , y1 ) = −10 < 0
(
D(x2 , y2 ) ≈ 2488.7172 > 0
2. => So (x2 , y2 ) is local maximum of f
fxx (x2 , y2 ) ≈ −55.9354 < 0
(
D(x3 , y3 ) ≈ 2488.7172 > 0
3. => So (x3 , y3 ) is local maximum of f
fxx (x3 , y3 ) ≈ −55.9354 < 0
4. D(x4 , y4 ) ≈ 187.6363 > 0 => So (x4 , y4 ) is saddle point of f
5. D(x5 , y5 ) ≈ 187.6363 > 0 => So (x5 , y5 ) is saddle point of f

Therefore, we have 3 local maximum and 2 saddle points.

Solved by Matlab

%% CALCULATION
Fx = d i f f (F , x ) ;
Fy = d i f f (F , y ) ;

Fxx = d i f f ( Fx , x ) ;
Fyy = d i f f ( Fy , y ) ;
Fxy = d i f f ( Fx , y ) ;

D = Fxx∗Fyy − Fxy ^ 2;

f p r i n t f ( ’ Fx␣␣=␣ ’ ) ; d i s p ( Fx ) ;
f p r i n t f ( ’ Fy␣␣=␣ ’ ) ; d i s p ( Fy ) ;
%% SETTING UP
clc ;
clear all ;
close all ;

%% DECLARATION
syms x y Fx Fy Fxx Fyy Fxy D;

%% INPUTED FUNCTION
F = 10∗ x^2∗y − 5∗ x^2 − 4∗ y^2 − x^4 − 2∗ y ^ 4;

Calculus 2 Page 7/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

f p r i n t f ( ’ Fxx␣=␣ ’ ) ; d i s p ( Fxx ) ;
f p r i n t f ( ’ Fyy␣=␣ ’ ) ; d i s p ( Fyy ) ;
f p r i n t f ( ’ Fxy␣=␣ ’ ) ; d i s p ( Fxy ) ;

%% FINDING SPECIAL POINTS


SysoEqn = [ Fx == 0 , Fy == 0 ] ;
%System o f 2 e q u a t i o n s Fx = 0 and Fy = 0
s o l = v p a s o l v e ( SysoEqn , x , y ) ;
x = sol .x;
y = sol .y;
tmp = x + y ;
nAllRoots = s i z e ( tmp ) ;
% nAllRoots ( 1 ) = Number o f r e a l and i m a g i n a r y r o o t s
nRealRoots = 0 ;
% nRoots = Number o f r e a l r o o t s
Roots = [ 0 , 0 ] ;

f o r ( i = 1 : nAllRoots ( 1 ) )
i f ( imag ( tmp ( i ) ) == 0 )
Roots = [ Roots ; x ( i ) , y ( i ) ] ;
nRealRoots = nRealRoots + 1 ;
end
end

f p r i n t f ( ’ Number␣ o f ␣ s p e c i a l ␣ p o i n t s : ␣%i ␣\n\n ’ , nRealRoots ) ;

%% CLASSIFYING POINTS INTO LOCAL MAXIMUM, MINIMUM, SADDLE POI


Roots = Roots ( 2 : end , : ) ;
max = [ 0 , 0 ] ;
min = [ 0 , 0 ] ;
saddle = [ 0 , 0 ] ;
f o r i = 1 : nRealRoots
syms x y
DVal = subs (D, [ x , y ] , [ Roots ( i , 1 ) , Roots ( i , 2 ) ] ) ;
FxxVal = subs ( Fxx , [ x , y ] , [ Roots ( i , 1 ) , Roots ( i , 2 ) ] ) ;
i f ( DVal > 0 )
i f ( FxxVal > 0 )
min = [ min ; Roots ( i , 1 ) , Roots ( i , 2 ) ] ;
e l s e i f ( FxxVal < 0 )

Calculus 2 Page 8/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

max = [ max ; Roots ( i , 1 ) , Roots ( i , 2 ) ] ;


end
e l s e i f ( DVal < 0 )
s a d d l e = [ s a d d l e ; Roots ( i , 1 ) , Roots ( i , 2 ) ] ;
end
end

%% DISPLAYING POINTS
min = min ( 2 : end , : ) ;
max = max ( 2 : end , : ) ;
s a d d l e = s a d d l e ( 2 : end , : ) ;

nMin = s i z e ( min ) ;
nMax = s i z e (max ) ;
nSaddle = s i z e ( s a d d l e ) ;

i f ( nMin ( 1 ) > 0 )
d i s p ( ’ ∗ ␣Minimum␣ p o i n t s : ’ ) ;
d i s p ( min ) ;
end

i f (nMax ( 1 ) > 0 )
d i s p ( ’ ∗ ␣Maximum␣ p o i n t s : ’ ) ;
d i s p (max ) ;
end

i f ( nSaddle ( 1 ) > 0 )
d i s p ( ’ ∗ ␣ Saddle ␣ p o i n t s : ’ ) ;
disp ( saddle ) ;
end
So we have the final result:

Calculus 2 Page 9/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

The result

2 Problem 2
Find the maximum and minimum values of z = 2x2 − 2xy + y 3 subject
to the single constraint x2 + y 2 = 4
a) Using Lagrange multiplier method..
b) Using contour plot (Draw the contour plot of the function and the con-
straint curve in the same figure)..

Theory
Lagrange multiplier technique
Lagrange multiplier technique lets you find the maximum or minimum
of a multi -variable function f (x, y, . . .) where there is some constraint on
the input values you are allowed to use.
This technique only applies to constraints that look something like this:
Suppose that (x0 , y0 ) is an extreme of z = f (x, y) subject to G(x, y) = k.
We define Lagrange function L(x, y, λ) = f (x, y) − λ(G(x, y) − k)
- If d2 L(x0, y0, fl0) > 0 then (x0 , y0 ) is a minimum point subject to the
constraint G(x, y) = k.
- If d2 L(x0, y0, fl0) < 0 then (x0 , y0 ) is a maximum point subject to the
constraint G(x, y) = k.

Calculus 2 Page 10/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

- If d2 L(x0, y0, fl0) is indefinite then (x0 , y0 ) is not an extreme point.

Solution

a) Using Lagrange multiplier method.


We have Lagrange function L(x, y, λ) = 2x2 − 2xy + y 3 − λ(x2 + y 2 )
We need
 to find stationary points (x, y) which satisfies the system of
Lx = 4x − 2y − 2λx = 0(1)

equation Ly = 3y 2 − 2x − 2λy = 0(2)

 2
x + y 2 = 4(3)
With x = 0 , from (1) we get y = 0, which does not satisfies (3)
With y = 0 , from (2) we get x = 0, which does not satisfies (3)
With xy ̸= 0 from (1) we have 2λxy = 4xy − 2y 2 and from (2) we have
2λxy = 3xy 2 − 2x2 , therefore 3xy 2 − 2x2 − 4xy + 2y 2 = 0(4)

From (3) we have two cases:


√ √
* First case: y = 4 − x2 . Substitute y = 4 − x2 in (4) we have the
equation : √
−3x3 − 4x2 − 4x 4 − x2 + 12x + 8 = 0
x = 1.442
<=>
x = −1.324

Because y = 4 − x2 so we have two solutions
(x1 , y1 ) = (1.4418, 1.3860); (x2 , y2 ) = (−1.3243, 1.4987)
√ √
* Second case: y = − 4 − x2 . Substitute y = − 4 − x2 in (4) we
have the equation : √
−3x3 − 4x2 + 4x 4 − x2 + 12x + 8 = 0
x = −0.3820
<=>
x = 1.9092

Because y = − 4 − x2 so we have two solutions:
(x3 , y3 ) = (−0.3820, −1.9360); (x4 , y4 ) = (1.9092, −0.5956)

Substitute (x1 , y1 ), (x2 , y2 ), (x3 , y3 ), (x4 , y4 ) in z(x, y) = 2x2 − 2xy + y 3


we have:
z(x1 , y1 ) = 2.8236
z(x2 , y2 ) = 9.3535

Calculus 2 Page 11/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

z(x3 , y3 ) = −8.7743 => This is minimum value


z(x4 , y4 ) = 10.8436 => This is maximum value

To conclude, the maximum and minimum values of z = 2x2 − 2xy +


y 3 subject to the single constraint x2 + y 2 = 4 is 10.8436 and -8.7743,
respectively.

b) Using contour plot (Draw the contour plot of the function and
the constraint curve in the same figure).
Matlab code:
%S e t t i n g up
clc
clear all
x = −2:0.1:2;
y = −2:0.1:2;
[ X,Y] = meshgrid ( x , y ) ;
%Input t h e f u n c t i o n
Z = 2∗X.^2 −2∗X. ∗Y+Y. ^ 3 ;

c o n t o u r (X, Y, Z , 1 0 0 )

%Draw t h e c o n t o u r p l o t o f t h e f u n c t i o n
hold on
t = −2:0.01:2;
z = −2:0.01:2;
[ X,Y] = meshgrid ( t , z ) ;
Z2 = X.^2+Y.^2 −4;
c o n t o u r (X, Y, Z2 , 1 )
hold o f f

Calculus 2 Page 12/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

The result

3 Problem 3
Let C is the intersection of the given surface x2 + y 2 + z 2 = 9 and the
cylinder x2 + 3y 2 = 4, z > 0.
a) Draw the surfaces and the curve C.
b) Find the length of the curve.
c) At any given point (x0 ; y0 ; z0 ) belongs to the curve, draw the unit tan-
gent vector.

Theory

Find length of the curve using line integral


The line L which have function f (x(t), y(t), z(t)) and a <= t <= b, we
can calculate the length of L by using the formula:
R b q dx
L = a ( dt )2 + ( dy 2 dz 2
dt ) + ( dt ) dt

Calculus 2 Page 13/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

Tangent vector
In mathematics, a tangent vector is a vector that is tangent to a curve
or surface at a given point. Tangent vectors are described in the differential
geometry of curves in the context of curves in Rn . More generally, tangent
vectors are elements of a tangent space of a differentiable manifold. Tangent
vectors can also be described in terms of germs. Formally, a tangent vector
at the point x is a linear derivation of the algebra defined by the set of
germs at x.
Let r(t) be a parametric smooth curve. The tangent vector is given
by r’(t) where we have used a prime instead of the usual dot to indicate
differentiation with respect to parameter t. The unit tangent vector is given

by T (x) = ||rr′ (x)||
(x)

Solution

a) Draw the surfaces and the curve C.


Draw x2 + y 2 + z 2 = 9
%P l o t t he t he s u r f a c e x^2 + y^2 + z ^2 = 9
f = @( x , y , z ) x . ^ 2 + y . ^2 +z . ^2 −9;
f i m p l i c i t 3 ( f , [ −3 3 −3 3 0 5 ] , ’ c ’ ) ;
xlabel ( ’x ’ );
ylabel ( ’y ’ );
zlabel ( ’z ’ );
hold on ;

The result

Calculus 2 Page 14/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

Draw x2 + 3y 2 = 4
%P l o t t he t he s u r f a c e x^2 +3y^2 = 4
g = @( x , y ) x . ^ 2 + 3 ∗ ( y . ^ 2 ) −4;
f i m p l i c i t 3 ( g , [ −3 3 −3 3 0 5 ] , ’ g ’ ) ;
xlabel ( ’x ’ );
ylabel ( ’y ’ );
zlabel ( ’z ’ );
hold on ;

The result

Draw the curve C as the interection of 2 surfaces:


syms t ;
X = cos ( t ) . ∗ 2 ;
Y = sin ( t ).∗(2/ sqrt (3));
syms t ;
X = 2.∗ cos ( t ) ;
Y = sin ( t ).∗(2/ sqrt (3));
Z = s q r t (9 − 4.∗ cos ( t ).^2 − 4/3.∗ s i n ( t ) ^ 2 ) ;
curveC = f p l o t 3 (X, Y, Z , [ 0 2∗ p i ] , ’ l i n e w i d t h ’ , 5 ) ;
curveC . Color = ’ r ’ ;
axis equal ;

Calculus 2 Page 15/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

xlabel ( ’x ’ );
ylabel ( ’y ’ );
zlabel ( ’z ’ );
t i t l e ( " I n t e r s e c t i o n c u r v e o f th e s u r f a c e s x^2 + y^2 + z ^2 = 9

The result

Draw the curve C as the interection of 2 surfaces without line:


X = cos ( t ) . ∗ 2 ;
Y = sin ( t ).∗(2/ sqrt (3));
Z = s q r t (9 − 4.∗ cos ( t ).^2 − 4/3.∗ s i n ( t ) ^ 2 ) ;
curveC = f p l o t 3 (X, Y, Z , [ 0 2∗ p i ] , ’ l i n e w i d t h ’ , 3 ) ;
curveC . Color = ’ b ’ ;
axis equal ;
xlabel ( ’x ’ );
ylabel ( ’y ’ );
zlabel ( ’z ’ );
t i t l e ( " The i n t e r s e c t i o n c u r v e C o f two s u r f a c e s " ) ;

Calculus 2 Page 16/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

The result

b) Find the length of the curve.


Solved by hand
(
x2 + y 2 + z 2 = 9(1)
We have curve C is the intersection of two surfaces:
x2 + 3y 2 = 4(2)
which satisfies the condition z > 0
From equation (2), we represent x and y through parameter t:
x = 2cos(t), y = √23 sin(t) , 0 ≤ t < 2π
Substitute x = 2cos(t), y = √23 sin(t) in equation (1), we get:
q
z = 9 − 4 cos(t)2 − 43 sin(t)2
Therefore the curve C this the intersection of


 x = 2cos(t)

y = √23 sin(t)
 q
z = 9 − 4 cos(t)2 − 4 sin(t)2

3

Length ofqcurve C is:


R 2π dy 2
L= 0 ( dx 2 dz 2
dt ) + ( dt ) + ( dt ) dt

R 2π r
=> L = 0 (−2sin(t))2 + ( √23 cos(t))2 + ( √ 8sin(t)cos(t) 2 )2 dt ≈ 10.3677
3(15+8(sin(t))

Solved by Matlab

Calculus 2 Page 17/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

Matlab code
%C a l c u l a t e t h e l e n g t h o f th e i n t e r s e c t i o n c u r v e C
f u n c=@( x ) s q r t (( −2.∗ s i n ( x ) ) . ^ 2 + ( 2 . / s q r t ( 3 ) . ∗ c o s ( x ) ) . ^ 2 +
( ( ( 8 / 3 ) . ∗ cos (x ) . ∗ sin (x ) ) . / sqrt ( ( 8 / 3 ) . ∗ sin (x ).^2+5)).^2);
Length = i n t e g r a l ( func , 0 , 2∗ p i ) ;
f p r i n t f ( ’ Length ␣ o f ␣ c u r v e ␣C␣ i s : ␣ ’ ) ;
%P r i n t out t he l e n g t h o f c u r v e C i n command window
d i s p ( Length ) ;
And here is the result

c) At any given point (x0 ; y0 ; z0 ) belongs to the curve, draw the


unit tangent vector.


 x = 2cos(t)

We have (C): y = q √2 sin(t)
3

z = 9 − 4 cos(t)2 − 4 sin(t)2

q 3
Let r(t) = 2cos(t)⃗i + √23 sin(t)⃗j + 9 − 4 cos(t)2 − 43 sin(t)2⃗k

=> r′ (t) = −2sin(t)⃗i + √2 cos(t)⃗


3
j + √ 8sin(t)cos(t) 2 ⃗k
3(15+8(sin(t))
Therefore, we can implement Matlab code
%P l o t t he u n i t t a n g e n t v e c t o r a t any p o i n t on th e c u r v e C
t = l i n s p a c e ( 0 , 2∗ pi , 1 0 0 ) ;
%Vector r ( t ) s components : x_t , y_t , z_t
x_t = 2 . ∗ c o s ( t ) ;
y_t = 2 . / s q r t ( 3 ) . ∗ s i n ( t ) ;
z_t = s q r t ( 9 − 4 . ∗ c o s ( t ) . ^ 2 + 4 . / 3 . ∗ s i n ( t ) . ^ 2 ) ;

%Vector r ’ ( t ) components : m, n , p
x = −2.∗ s i n ( t ) ;

Calculus 2 Page 18/19


HO CHI MINH UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE

y = 2./ sqrt ( 3 ) . ∗ cos ( t ) ;


z = ( 8 . ∗ cos ( t ) . ∗ s i n ( t ) ) . / s q r t ( 3 . ∗ ( 8 . ∗ s i n ( t ).^2+15))
l = s q r t ( x .^ 2 + y . ^ 2 +z . ^ 2 ) ;
m = −2∗ s i n ( t ) . / l ;
n = ( 2/ s q r t ( 3 ) . ∗ c o s ( t ) ) . / l ;
p = (8.∗ cos ( t ) . ∗ sin ( t ) ) . / sqrt ( 3 . ∗ ( 8 . ∗ sin ( t ).^2+15))./ l ;

figure
q u i v e r 3 ( x_t , y_t , z_t , m, n , p ) ;
axis equal ;
xlabel ( ’x ’ );
ylabel ( ’y ’ );
zlabel ( ’z ’ );
t i t l e ( ’ Unit ␣ t a n g e n t ␣ v e c t o r s ␣ b e l o n g ␣ t o ␣C ’ ) ;

The result

Calculus 2 Page 19/19

You might also like