I Problem 1 1 Problem xt = 417 —3 Given the parametric equations: yữ=#—7In/?+2 Study the parametric curve, find all the asymptotes and extrema.. clc; clearvars; %declare the variable a
Trang 1VIET NAM NATIONAL UNIVERSITY HO CHI MINH CITY
HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY
FACULTY OF APPLIED SCIENCE
BK TP.HCM
PROJECT - CALCULUS 1 USING MATLAB OR PYTHON TO SOLVE BASIC PROBLEMS
Instructor: PhD Dau The Phiet
Class code: Authors:
Ho Chi Minh City, 2023
Trang 2PREFACE
Calculus stands as an indispensable discipline for engineers, serving as a fundamental corner- stone in their academic and professional journey The profound exploration of change within this field has consistently demonstrated its applicability across diverse real-world scenarios Consequently, it becomes imperative for engineers not only to grasp the theoretical underpin- nings of calculus but also to adeptly apply this knowledge in addressing practical challenges This academic report has been meticulously crafted to meet the requisites of the Calculus 1 subject, a pivotal component in the preparation for the Calculus | final examination The as- signment of this topic to our group by Mr Phiet necessitated a comprehensive examination
of the utilization of calculus concepts, such as limits, derivatives, integration, and differential
equations, in the resolution of real-world problems Within this report, a particular emphasis is placed on employing Matlab commands as our primary programming language, showcasing the integration of theoretical knowledge with practical implementation It is our sincere hope that this report proves to be an insightful resource, aiding fellow engineering students in navigating the intricacies of calculus and its practical applications
Trang 3Contents
1 Problem Q Q HQ Q HQ HH HQ vn k k va 1
4 MATLAB code and explanation .0.0.0 0000000 eee eee 2
1 Problem Q Q HQ Q HQ HH HQ vn k k va 5
4 MATLAB codeandexplanation .0.02022 0.2.0048 6
1 Problem Q Q HQ Q HQ HH HQ vn k k va 7
4 MATLAB codeandexplanation .0.02022 0.2.0048 9
ii
Trang 4I Problem 1
1 Problem
x(t) = 417 —3 Given the parametric equations:
yữ)=#—7In(/?)+2 Study the parametric curve, find all the asymptotes and extrema Sketch the curve
2 Mathematics knowledge
Asymptotes of a parametric curve
x=x(t Let (C) be the curve of the parametric equations: { ứ)
Ụ=? (t)
1 When lim x = 00, limy = yo (a could be a real number or infinity, yp € IR), the horizontal
a a
line y = yo is called a horizontal asymptote of the curve
2 When tim, X=Xo, limy = 0 (b could be a real number or infinity, xp € JR), the vertical line
> to
X =X 1s called a vertical asymptote of the curve
3 When lim x = ©, lim y = ce (c could be a real number or infinity):
toc toc
t eLetm= tim E0)
» When ø € R\{0} letn =lmly) — mx()|
* Ifm ER, the oblique line y = mx +n is called a slant asymptote of the curve Analyzing parametric equations
Give the parametric equations:
y=y(t)
Let (C) be the curve of the parametric equations in Cartesian coordinate plane In order to imagine how (C) looks like at first, we can follow the following steps
1 Analyze two functions x(t) and y(t) of the variable 1
2 Put the table of variation of two functions x(¢) and y(t) in the same table
3 Find all of the asymptotes, intervals of increase or decrease, concavity of two functions x(t) and y(t)
Trang 53 Manual solution
Find the asymptotes:
a) Horizontal asymptotes:
Í lim \ x7) = + lim y(t) = +00
We have rote ( , So there is no horizontal asymptote of the curve
im 1 x(t) = +00
(
im, 3) =—=
b) Vertical asymptotes:
lim x(t) = —
We have 477? , SO x = —3 is a vertical asymptote of the curve
lim y(t) = Jim 1 y(t) = +60
t30t c) Slant asymptotes:
Let m, = jim, MÔI m= lim yt)
x(t) t ae x0) , 3— 14
We have m, = ,im mM Jun lim ye) = lim 3 = oo,
oo x(t) too x/(f) tte 8r2
It is easy to prove that mạ = —œ
Since both m, and mz are not non-zero real numbers, the curve does not have any slant asymptotes
Find the extrema:
“mee yt
/Ÿ)= =(jỗ) cam
whens = (ff LÍ T4 3 T4 2
Atft=} =, y’ (x) changes from negative to positive, so (8.1703; —0.5221) is a local minimum, and also an absolute minimum
Conclusion: The graph of the given parametric equations have only one extremum, which is (8.1703; —0.5221)
4 MATLAB code and explanation
Trang 6clc; clearvars;
%declare the variable and the functions
syms t;
x=4«t°2-3;
y=t°3-7xlog(t°2)+2;
find horizontal asymptotes
limxinf=lLimit (x,inf);
limyinf=limit (y,inf);
Llimxminf=lLimit (x,-inf);
limyminf=limit (y,-inf);
if (isinf(limxinf) && isinf(limyinf) && isinf(limxminf) &&
isinf(limyinf) )
disp(’There is no horizontal asymptote’);
else
if (isinf (limxinf) )
disp(’y =’ + string(limyinf) + ’ is a horizontal asymptote’);
end
if (isinf (limxminf) )
disp(’y =’ + string(limyminf) + 7 is a horizontal asymptote’);
end
end
%find vertical asymptotes
subsx0=subs (x, 0);
limityl=limit (y,t,0,’left’);
limityr=limit (y,t,0,’ right’);
if (isinf (subsx0)==false)
if (isinf(limityl) || isinf(limityr))
disp(’x =’ + string(subsx0) + ’ is a vertical asymptote’); else
disp (’There is no vertical asymptote’);
end
else
disp(’There is no vertical asymptote’);
end
Sfind slant asymptotes
number=0;
Trang 7“isinf (limyminf) )
disp(’There is no slant asymptote’)
else
if (isinf(limxinf) && isinf(limyinf))
a = limit (y/x, inf);
b limit (y -— axx, inf);
if ("“isinf (b)) disp(’y =’ + string(a) +’ x + ’ + string(b) + ’ is slant asymptote’ )
else number=numbert1;
end end
if (isinf(limxminf) && isinf(limyminf) })
c=limit (y/x,-inf);
gđ=limit (y-cxx,inf);
if ("“isinf(c)) disp(’y =’ + string(c) +’ x + ’ + string(d) + ’ is slant asymptote’ )
else number=numbert1;
end end
if (number==2)
disp (’There is no slant asymptote’) end
end
%find the extrema
extreme_points_y = solve(diff(y,t)==0,t,’Real’,true);
extreme_values_x = subs(x, t, extreme_points_y);
extreme_values_y = subs(y, t, extreme_points_y);
if ("“isnan(extreme_values_x) && “~isnan(extreme_values_y) )
fprintf(’ The extremum of the parametric equations is (%.4f,
%.4f)’, extreme_values_x, extreme_values_y);
else
disp(’The parametric equations do not have any extrema’); end
Trang 8a fplot(x,y,[-5 5]);
nm title(’Graph of parametric curve’);
5 Result
The following pictures are the result when executing the above code
Command Window There is no horizontal asymptote
x = -3 is a vertical asymptote There is no slant asymptote The extremum of the parametric equations is (8.1793,-9.5221)
Graph of parametric curve
0 L
=0 20 40 60 80
The output displayed in the command window matches our results, and the graph produced by Matlab matches the results of calculations made with other tools
1 Problem
You are trying to measure the height of a building by dropping a stone off the top and seeing how long it takes to hit the ground, knowing that the distance d (in feet) an object falls is related
to the time of fall, ¢ Gin seconds), by the formula d = 1617 You find that the time of fall is
Trang 910
2.5 seconds, and you estimate that you are accurate to within a quarter of a second What do you calculate the height of the building to be, and how much uncertainty do you consider your
calculation to have?
2 Mathematics knowledge
In real life, there are some circumstances in which one wishes to evaluate the change in the dependent variable corresponding to a tiny amount of change in the independent variable In these cases, we can use differentials to approximate the propagated error
Specifically, if a function f is differentiable at a, the propagated error is Ay ~ dy = f’(a)dx
3 Manual solution
We have the formula for the distance in terms of time is d = 1617
When t = 2.5: d = 16 x (2.5)? = 100 (feet)
Let Ad be the corresponding uncertainty in the calculated value of d at the uncertainity in time
At
In this case: Ad = dd = d'(t)dt - 32r dt = 32 x 2.5 x 0.25 = 20
So the uncertainty of height is +20 (feet)
4 MATLAB code and explanation
sdeclare the variables
syms dt du dt;
find the height of the building
t=2.5;
d=16+tˆ2;
disp(’The height of the building is: ’ + string(d));
%find the uncertainty of height
dt=0.25;
đuú=16x2xtxdt;
đisb(7The uncertainty of height is +-' + string(dđu));
5 Result
The following picture is the result on the command window when executing the above code
Trang 10The height of the building is: 100 The uncertainty of height is +-20
Figure 1: Command window when executing the code for problem 2 The output displayed in the command window matches our result
III Problem 3
1 Problem
Study the Euler method to approximate the solution of first order differential equations (ODEs) The world’s population in 1990 was about 5 billion, and data show that birth rates range from
35 to 40 per thousand per year and death rates from 15 to 20 Take this to imply a net annual growth rate of 20 per thousand One model for world population assumes constant per capita growth, with a per capita growth rate of 20 = 0.02 1000
a) Write a differential equation for P that expresses this assumption Use P to denote the world population, measured in billions
b) According to the differential equation in (1), at what rate (in billions of persons per year) was the world population growing in 1990?
c) By applying Euler’s method to this model, using the initial value of 5 billion in 1990, estimate the world population in the years 1980, 2000, 2040, and 2230 Present a table of successive approximations that stabilizes with one decimal place of accuracy (in billions) What step size did you have to use to obtain this accuracy?
2 Euler’s method
! — F(x, Approximation values for the solution of the initial-value problem » œ3) , with step
y(x0) = Yo
size h, at x, = %,_1 this:
Yn = Yn—I + AF (Xu—1.ø—1)
3 Manual solution
a) The differential equation for constant per capita growth is given by
dP
—=kpP
dt
7
Trang 11dP where + is the rate of change of population with respect to time,
P is the population,
k is the constant per capita growth rate
In this case, k = 0.02 (as given in the problem statement), and P is the world population measured in billions
So the differential equation is:
dP
— =0.02P
dt
b) Now, we integrate the differential equation in (a):
1 [pera [ore
© In|P| = 0.02-+€
Se LP| — c0.02:+C
> P = ¿002+C Assuming the initial population (Po) in 1990 is 5 billion, which means
P(1990) =5 Using the above condition to find C, we have:
Œ€ =ln|5| — 0.02 x 1990 Now, rewriting the expression, we have:
P= 5¿0.02:—0.02 x1990
So
dP
dt
To find the rate at which the population was growing in 1990 (t = 1990), we substitute
— 0 02 x 5¿0.03—0.02x 1990
t = 1990 into the derivative of P with respect tot:
dP = 0.02 x 50.02% 1990-0.02 1990
dt | 1990
=0.1
Trang 12So, according to the differential equation, the world population was growing at a rate of 0.1 billion people per year in 1990
4 MATLAB code and explanation
clc; clearvars;
syms t p(t);
Squetion a
disp (’ question a’);
equation = diff(p,t) == 0.02x«p;
disp (equation);
%question b
disp (’ question b’);
disp (’By solving the differential eqation we get’);
ep = dsolve (equation, p(1990) == 5);
disp (p);
dp=diff(p,t);
dpatt=subs (dp,t,1990);
disp (’By substituting the value of t into the function, we have the result for the question b is: ’)
disp (dpatt);
Squestion c
disp(’It is time for question c’);
h = input (’Input the step size: ’');
original_poriginal = 5;
years =[1980,2000,2040,2230]; % Initialize years array
fprintf(’Step size\tYear\tPopulation\tExact population\n’);
for i = 1l:length (years)
°
poriginal = original_poriginal; %* Reset to original population
at the start of each calculation
if years(i) < 1990
for year = 1990-h:—-h: years (i) dpt = subs(dp, t, year);
poriginal = poriginal — h * dpt; % Decrease for years before 1990
end else
for year = 1990+h:h:years (1)
Trang 13°
poriginal = poriginal + h * dpt; % Increase for years
after 1990 end
end
fprintf (’f\tsd\t%.2f billion\t%.2f\n’, h, years(i),
poriginal, subs(p,years(i)));
end
5 Result
The following pictures are the result when executing the above code
differential eqation we get into the function, we have the result for the question b is
Figure 2: Command window when executing the code The results made by computing in problems a and b are the same as the other, and also the same
as those done manually, and the results in problem c are within a finite bound
IV Conclusion
In conclusion, this extensive assignment has provided valuable insights into collaborative work and enhanced our understanding of Matlab symbolism The acquired knowledge encompasses the identification of asymptotes and extrema for a given parametric curve, as well as the com- putation of uncertainty associated with a quadratic function Furthermore, we have gained proficiency in employing the Euler method through Matlab symbolic calculations, demonstrat- ing a discerning ability to select suitable step sizes to achieve desired levels of accuracy This undertaking has not only enriched our technical skills but also fostered a collaborative spirit essential for tackling complex mathematical challenges