Solving for the maximal interest rate Initially, we have the formula of paying off a mortgage over a fixed period is: Substitute value onto the formula, we have equation We have first po
Trang 1
VIETNAM NATIONAL UNIVERSITY, HO CHI MINH CITY
HO CHI MINH UNIVERSITY OF TECHNOLOGY
(0000
Experimental Report Subject: Calculus 1
Group ID:
Lecturer teacher:
Trang 2Group Information:
1 Group No: 02
2 Members:
Full name Student ID Hoang Nguyéén Đức 2252021 Anh
Trâân Ngọc Ánh Vân 2252900
Dương Nhật Thành 2252474 Nguyêên Mạnh Cường 2252099 Đoàn Nguyên Phúc 2152627
Class: CC16
Trang 3Table of contents
TL Infr0CfÏOH co <5 << Hi HT lv 1
II Detailed expÏa'nafÏOTIS - so <5 << 0 in TH ng ng vn 2 Problem Í <5 <5 sọ cọ TT nà n0 2 Discuss about Newton’s method
Solving for the maximal interest rate
Problem 2 si nà n0 3 Theory to find max-min of a function on
Present code algorithm to find max-min of on
Apply code to find the shorftesf possible (ime co co 3153551551591 9595 4 Apply code to find the smallest length of the fold 5 Problem ỔỔ o- «cọ nà ni 6 Discuss the Trapezoidal metHo( - s5 55 5511 1 Y1 g1 ng 1 my, 6 Illustrate Trapezoidal method in MATLAB 7 Apply code in part a Evaluate the definite integraÌ - -.s« s««<««s« 7 Apply code in part b Compute the area of the p00IÏL s55 5< 5 sex 7 TIT MATLAB code and ExpÌanati0T -o- << <5 Y1 Y1 Y1 mg v1 men 9 Problem Í <5 <5 sọ cọ TT nà n0 9
Problem 2b Go 5S 0 TT TT TH 0 8 10
ProbilÌeim Í s5 55 0 TT TT TH 0 00 0m 12
Problem 2b Go 5S 0 TT TT TH 0 8 12
Problem SjÙ G55 cọ TT TH TT 0m 12
Trang 4L Introduction
The vast subject of mathematics known as calculus includes concepts such as instantaneous rates of change, areas under curves, sequences, and series All of these subjects revolve around the concept of a limit, which involves analysing a function's behaviour at places that are progressively closer to a given point but never actually reach it The two primary applications of calculus are integral calculus and differential calculus
The calculus was independently developed by Sir Isaac Newton and the
German Gottfried Leibniz They were both working on motion difficulty studies at the end of the 17th century The argument between the men over who invented calculus first was fierce
The ability to predict the locations of the stars was found to be essential for assisting in nautical navigation Finding longitude while a ship was at sea was the most challenging task Any government would prosper if it could successfully send ships to the New World and successfully return them with cargo
Trang 5II Detailed explanations
Problem 1
Discuss about Newton’s method
Newton method or Newton Raphson method is a technique for solving equations of the form by successive approximation The idea is to pick an initial guess such that is reasonably close to zero We then find the equation of the line tangent to at and follow it back to the axis at a dew guess The formula for this is
We then find the equation of the line tangent to at and follow it back to the axis to get anew (and improved!) guess from the formula
We keep on refining our guesses until we are close enough for whatever application we have in mind In general, we have the recursive formula
In typical situations, Newton's method homes in on the answer extremely quickly, roughly doubling the number of decimal points in each round Therefore, if your original guess is good to one decimal place, 5 rounds later you will have an answer good to digits
Solving for the maximal interest rate
Initially, we have the formula of paying off a mortgage over a fixed period is: Substitute value onto the formula, we have equation
We have first point
After using MATLAB to run Newton method, we get the answer is Therefore, the maximal interest rate the borrower can afford to pay is 8.10% per year
Problem 2
Theory to find max-min of a function on
In calculus, you might have learnt how to find the local maximum and local minimum values of a function using the first derivative test and second derivative test
As we know, the function has neither a local maximum value nor a local minimum value In this article, you will learn how to find the minimum and maximum values of
a function in a closed interval in detail
Trang 6Step 1: Identify all critical points of the function f in the g1ven Interval, 1.e., these are the values of where either or fis not differentiable
Step 2: Choose the endpoints of the interval
Step 3: At all these points, i.e the values listed in the previous steps, i.e steps
1 and 2, evaluate the values of the given function
Step 4: Identify the minimum and maximum values of f out of the values estimated in the previous step
This maximum value will be the absolute maximum or the greatest, whereas the minimum value will be the absolute minimum or the least value of the function Present code algorithm to find max-min of on
In our code, first we will find the derivative of by MATLAB
Then we will use solve() command to find critical points of
Next, we will find the value of at critical points, lower bounded and upper bounded by command subs(), assume lower limit and upper limit are
Finally, we will use basic sort algorithm to find the value to find max/min value In this example, | will sort for the min value
You can invert the sign from “<” to “>” to find the max value
Trang 7Apply code to find the shortest possible time
Figure 1
We have is bounded by
We have the distance of the woman from A to B is and distance arc from B to Cis
Now time taken to row is and time taken to walk is , so we can compute the total time equation
Next, we will find the critical points and examine whether it is min value or not Now we will find second derivative of
So is the local maxima, we can declined
We will examine at the lower limit and upper limit
So the smallest time is 1.54s, that means she has to walk the entire arc ABC in order to minimize her travel
Apply code to find the smallest length of the fold
First, we need to find the interval of x
Trang 8a(S \z-1a
As you can see, the lower limit of x 1s 4.5836 and the upper limit of x is 8 Next, we need to find equation with y and x
D
5”
v
We have triangle CDE and triangle BCA are similar Therefore,
Let
Now, we need to find the derivative of respect to
Then, we will find the value of at the critical point, at the upper and lower limit
Trang 9Therefore, result to smallest In conclusion, to minimize the length of the fold, should be equal to six
Problem 3
Discuss the Trapezoidal method
In Calculus, ““Trapezoidal Rule” is one of the important integration rules The name trapezoidal is because when the area under the curve is evaluated, then the total area is divided into small trapezoids instead of rectangles This rule is used for approximating the definite integrals where it uses the linear approximations of the functions
Trapezoidal Rule is a rule that evaluates the area under the curves by dividing the total area into smaller trapezoids rather than using rectangles This integration works by approximating the region under the graph of a function as a trapezoid, and it calculates the area This rule takes the average of the left and the nght sum
Let be a continuous function on the interval Now divide the intervals into equal subintervals with each of width,
Such that Then the Trapezoidal Rule formula for area approximating the definite integral
Is given by:
Where,
If, R.H.S of the expression approaches the definite integral
Illustrate Trapezoidal method in MATLAB
So we have the trapezoidal formula is:
With
Therefore, first we will compute
Then we will create an array , then the sum in the middle part is calculated in
MATLAB by:
The before * means that we are multiply every elements in array with Then the sum using trapezoidal result is presented by:
That is our result
Trang 10Apply code in part a Evaluate the definite integral
In this part, we have the lower limit is 1, the upper limit is 5, then we will input equation onto the Command Window
After MATLAB executes the trapezoidal formula, we have the result is 34.02, which is quite precisely from the calculator: 34.01882640944523
Apply code in part b Compute the area of the pool
Initially, we have matrix S include the width of the pool
And
Then we have the Trapezoidal formula:
So the area of the pool by using the Trapezoidal formula is 80.8
Trang 11Problem 1
% Problem 1: Newton method
% File Problem1.m
% Clear the Workspace and Command Window
clear variables; clc;
% Define function f(x)
syms x;
f=1000* (1- (1+x)*(-360))-135000*x; % nter the Function here
g=diff(f); % The Derivative of the Function
% Limit the number of decimal places is 10
epsilon = 5#19^- (1Ø+1);
x@ = input('Enter the intial approximation: ');
for i=1:100
f0=vpa(subs(,x,x@)); % Calculating the value of function at x@
f@_der=vpa(subs(g,x,x@)); % Calculating the value of function derivative at
xo
y=x0-f0/fe_der; % The Formula
err=abs(y-xÐ) ;
if err<epsilon %checking the amount of error at each iteration
break
end
xO=y;
end
y =y - rem(y,19^-19); %Displaying upto required decimal places
fprintf('So the maximal interestrate is: %.2*%% per year\n' ,y*12*1@@) ;
Problem 2a
% Problem 2a: Find the shortest way for the woman
% File Problem2a.m
% Clear the Workspace and Command window
clear variables; clc;
syms theta
% Define borders
D = [9;pi/2];
assume (D(1)<=theta<=D(2))
% Define the S1 function and S2 function
s1 = 4#cos(theta);
s2 = 2*2*theta;
fprintf("From the figure, you have function of S1 = %s”", s1);
fprintf("\nAnd S2 = %s\n", s2);
% Time to taken to row t1 and time to walk t2 and sum of it
t1 = $s1/2; t2 = s2/4;
fprintf ("Now time taken to row is ti = %s", t1);
fprintf(" and t2 = %s",t2);
Trang 12fprintf("\nTotal time = ti + t2 = %s\n", T);
% Use function smallest to find the smallest time
[ans,angle] = smallest(D, T);
fprintf("So the smallest time is %.2f s\n", subs(T,theta,ans)); fprintf("That means she has to walk entire arc ABC in order” +
to minimize her travle theta = %.2f rad", angle);
function [d,angle] = smallest(D, T)
syms theta; assume(D(1) <= theta <= D(2));
dT = diff(T);
S = solve(dT == 9, theta);
Ta = subs(T,D(1)); Tb = subs(T,D(2));
Ttheta = subs(T,S);
if (Ta < Tb) && (Ta < Ttheta)
d = Ta;
angle = D(1);
else if (Tb < Ttheta)
d = Tb;
angle = D(2);
else
d = Ttheta;
angle = S;
end
end
end
Problem 2b
% Problem 2b: Find x to minimize y
% File Problem2b.m
% Clear Workspace and Command Window
clear variables; clc;
syms x;
D = [4.5836 8];
% Define function y
y = sqrt(x^2 + 4*x^2/(x-4));
fprintf("We have the bounded of x is [%.2f %.2f].\n”,D(1),D(2)); fprintf("And the equation of y is %s.\n", y)3
% Using function to find the smallest value
[y, x] = smallest(D, y);
% Print output
fprintf( "After calculating in the function smallest, "+
“the minimize length y is %.2f when x = %.2f.", y, x); function [y,x] = smallest(D, y)
syms x; assume(x>@);
dY = diff(y);
S = vpasolve(dY == @,x, [D(1) D(2)]);
Ya = subs(y,D(1));
Yb = subs(y,D(2));
Ylocal = subs(y,S);
if (Ya < Yb) && (Ya < Ylocal)
y = Ya;
x = D(1);
else if (Yb < Ylocal)
y = Yb;
x = D(2);
else
y = Ylocal;
x = S3
end
end
Trang 13Problem 3a
% Calculate the trapezoidal rules
% File Problem3a.m
% Clear the Workspace and Command Window
clear variables; clc;
% Define f(x)
syms f(x);
% Enter value of lower, upper limit and equation f(x)
a = input("Enter lower limit a: “);
b = input("Enter upper limit b: "};
f(x) = input("Enter equations: ");
S = trapezoidal(a,b,f(x)); % Call function trapezoidal
fprintf("The value of integration is %.2f\n", S$);
function out = trapezoidal(a,b,f)
syms x;
n = 100; % Number of itterations
h = (b-a)/n;
i = 1:1:n-1;
S = subs(f,x,ati.*h);
out = (h./2).*(subs(f,x,a)+2.*sum(S)+subs(f,x,b));
end
Problem 3b
% Compute the area of the pool
% File Problem3b.m
% Clear the Workspace and Command Window
clear variables; clc;
% Define the widths of the swimming pool in matrix S
S = [@ 6.2 7.2 6.8 5.6 5.0 4.8 4.8 0];
% Find delta x
deltax= (16-0)/8;
% Define the trapezoidal formula T = deltax/2*sum(S)/2
T = deltax/2*sum(S)*2;
% Print some statements
fprintf("Initially, we have matrix S concludes: \n");
disp(S);
fprintf("And deltax = (b-a)/N = (16-9)/8 = %.2f", deltax);
fprintf("\nThe trapezoidal formula: S = deltax/2*sum(f(k+1)+f(k)) = "+
"deltax/2*sum(S)*2 = %.2f", T);
10
Trang 1411%
JA Dac
Vv INXS
Problem 1
II
Trang 15V_References Y-.—^- =
[1] Christopher G Gibson Elementary geometry of differentiable curves: an
undergraduate introduction Cambridge, UK ; New York : Cambridge University Press, 2001
[2] Shoichiro Nakamura Numerical analysis and graphic visualization with
MATLAB Upper Saddle River, N.J : Prentice Hall PTR, ©2002
[3] Peter L, K., 2021 MATLAB for Begineers: A Gentle Approach Revised Edition Peter I Kattan (September 24, 2009)
[4] J Edwards (1892) Differential Calculus London: MacMillan and Co pp 143 ff Cajori, Florian (2007-01-01) A History of Mathematical Notations Torino: Cosimo, Inc ISBN 9781602067141
12