Professional Documents
Culture Documents
BFC24203
GROUP ASSIGNMENT
NUMERICAL DIFFERENTIATION
SECTION 2
GROUP L
1. MUHAMMAD ILHAM BIN MAT YAJID (DF180110)
MEMBERS 2. NUR AINA ATIRAH BINTI OTHMAN (CF190100)
3. MUHAMMAD SALAHUDDIN BIN MAT NOR (CF180162)
LECTURER DR.HENDRY FITRIAN SUHANDRI
TABLE OF CONTENTS
NO CONTENT PAGE
NUMBER
1.0 INTRODUCTION 2-4
2.0 OBJECTIVE 5
6.0 CONCLUSION 15
1
1.0 INTRODUCTION
Civil Engineering Mathematic IV is a compulsory subject for all Civil Engineering student in
University Tun Hussein Onn Malaysia (UTHM). Before taking Civil Engineering Mathematic IV
subject, students need to pass Civil Engineering Mathematic I, II and III.
For this assignment, we are asked to use numerical differentiation to solve the problems
of function where the function is not easily differentiated analytically or only a set of data is
given The problem of numerical differentiation does not receive very much attention nowadays.
Although the Taylor series plays a key role in much of classical analysis, the poor reputation
enjoyed by numerical differentiation has led numerical analysts to construct techniques for most
problems which avoid the explicit use of numerical differentiation. One may briefly and roughly
define the term numerical differentiation as any process in which numerical values of derivatives
are obtained from evaluations of the function at several abscissae near. Taylor series allows us to
expand a function into an infinite series. If the function is infinitely differentiable at number h,
we can use the Taylor series to approximate the function. We can derive the backward, the
forward, and the center divided difference methods using Taylor series, which also give the
quantitative estimate of the error in the approximation.
2
this chapter , we will know how to approximate the first derivative by using 2-point forward, 2-
point backward, 3-point central and 5-point formulas whereas second derivative can be
approximated from 3-point central and 5-point formulas for a tabulated data with the increment
of h.
Difference formula for a function of a single variable can be developed using Taylor’s
series. The Taylor’s series expansion for f(x+h) can be written as below;
f ( x +h ) =f ( x ) +h f ' ( x ) + f (x)} over {2!} {h} ^ {2} + {{f} ^ {'''} left (x right )} over {3!} {h} ^ {3} +…+ {{f} ^ {(
Considering only the first derivative (do not have higher derivatives or very small), we can use
this formula;
f ( x+ h )−f (x )
For first derivative 2-point forward, f ' ( x )=
h
f ( x )−f ( x−h )
For first derivative 2-point backward, f ' ( x )=
h
f ( x+ h )−f ( x−h)
For first derivative 3-point central, f ' ( x )=
2h
The first derivative for 2-point forward, 2-point backward and 3-point central can be shown
graphically.
a) 2-point forward
Figure 1
3
b) 2-point backward
Figure 2
c) 3-point central
Figure 3
4
2.0 OBJECTIVE
In this project assignment, we were asked to solve the Numerical differentiation equation by
using Matlab application in learning slide page 12 which consist of two question which is;
1) Given f(x) = ex. By taking h= 10-k , where k=1,2. Find f’(2.2) using;
2) Let f(x) = ln(x) and x = 3. Using 2-point forward and 3-point central difference and working to
8 decimal places, approximate f’(x) using h = 0.1 and h = 0.01.
5
4.0 METHODOLOGY
4.1 Step
Step 1: Solve the problem by using formula First Derivative of Taylor’s series.
2-point forward
i. From the problem statement, identify the function of y(x)
ii. Identify the value of point concern, x
iii. Identify the distance between the point, h
iv. Using the point data after the point concern, the derivative can be expressed as the
slope or gradient.
y ( x +h ) − y ( x)
y’(x) =
h
2-point backward
i. From the problem statement, identify the function of y(x).
ii. Identify the value of point concern, x
iii. Identify the distance between the point, h
iv. Using the point data before the point concern, the derivative can be expressed as
the slope or gradient.
6
y ( x )− y ( x+ h )
y’(x) =
h
3-point central
i. From the problem statement, identify the function of y(x).
ii. Identify the value of point concern, x
iii. Identify the distance between the point, h
iv. Using the point data before and after the point concern, the derivative can be
expressed as the slope or gradient.
y ( x +h ) − y ( x−h )
y’(x) =
2h
7
8
4.2 Command
Question 1
else
disp('**Formula not available**')
end
9
Question 2
else
disp('**Formula not available**')
end
10
5.0 RESULT AND DATA ANALYSIS
5.1 Results
Manual Calculation:
Question 1
x = 2.2, h =0.1
f ( x+ h )−f ( x )
f’(x) =
h
e2.2 +0.1−e2.2
=
0.1
= 9.491690
x = 2.2, h = 0.01
f ( x+ h )−f ( x )
f’(x) =
h
= 9.070289
x= 2.2, h =0.1
f ( x )−f ( x−h )
f’(x) =
h
e2.2 −e 2.2−0.1
=
0.1
11
= 8.588436
x =2.2, h=0.01
f ( x )−f ( x−h )
f’(x) =
h
e2.2 −e 2.2−0.01
=
0.01
= 8.980038
x = 2.2, h = 0.1
f ( x+ h )−f ( x−h )
f’(x) =
2h
e2.2+0.1−e2.2−0.1
=
2(0.1)
= 9.040063
x = 2.2, h =0.01
f ( x+ h )−f ( x−h )
f’(x) =
2h
e2.2+0.01−e 2.2−0.01
=
2(0.1)
= 9.025164
12
Question 2:
Let f(x) = ln(x) and x = 3. Using 2-point forward and 3-point central difference and working to 8
decimal places, approximate f’(x) using h = 0.1 and h = 0.01.
x = 3, h =0.1
f ( x+ h )−f ( x )
f’(x) =
h
= 0.32789823
x = 3, h =0.01
f ( x+ h )−f ( x )
f’(x) =
h
= 0.33277901
x = 3, h =0.1
f ( x+ h )−f (x−h)
f’(x) =
2h
= 0.33345687
x = 3, h =0.01
13
f ( x+ h )−f (x−h)
f’(x) =
2h
= 0.33333457
Question1
Question 2
14
CentraL h1: 0.33345687
CentraL h2: 0.33333457
Based on the results for Question 1, the results we obtained by using the first derivative 2-point
forward formulas for h=0.1 is 9.491690 while for h=0.01 is 9.070289. As we can see, the result
shows that there are the differences. This is because, the smaller value of h, the accurate results
obtained. However, this relationship cannot be applied to the first derivative 2-point backward
formulas. The results when h=0.1 is 8.588436 and for h=0.01 is 8.980038. From the results, we
can conclude that the smaller number of h, the higher value of function (f(x)). For the last, the
first derivatives of 3-point central difference were calculated. It is because this formula was a
better approximation since more points are considered. By applying this formula, the value for
h=0.1 and h=0.01 were obtained. Result shows that the output for h=0.1 is 9.040063 while for
h=0.01 is 9.025164. As we can see, by using the 3-point central differences formulas, the results
of f(x) were just slightly different. This also can conclude that the smaller value of h, the better
approximation that we obtain.
For question 2, the formula used is 2-point forward and 3-point central difference. By
using 2-point forward formula, the results shows that h=0.1 has high small value than h=0.01
which is 0.3278923 and 0.33277901 respectively. The differences between the result is because
the value of h. the smaller value of h, the higher value of f(x). Then, the results for 3-point central
differences were slightly different. Value f(x) for h=0.1 is 0.33345687 and h=0.01 is 0.33333457.
by referring to the results of 3-point central difference, we can conclude that the smaller value of
h, the precise approximation of the f(x).
15
6.0 CONCLUSION
The objectives for this assignment were achieved as the we obtained the output for 2-
poiint forward, 2-point backward and 3-point central. For question 1, the results of 2-point
forward for h1 and h2 were 9.491690 and 9.070289 respectively. Then the result for h1 and h2 in
2-point backward is 8.588436 and 8.980038 each. Lastly, the result show for 3-point central is
9.040063for h1 and 9.025164 for h2. For question 2, the output using 2-point forward for h1 is
0.32789823 and h2 is 0.33277901. Meanwhile, the 3-point central gave output for h1 and h2 as
0.33345687 and 0.33333457 respectively.
After the output was obtained, we then analyse the results and compare the differences.
As we can see, the output does show the differences when using different formulas. Hence, this
shows that our second objective was achieved. Next, the third objective is to expose students
about the relationship of numerical method in programming and real condition in engineering
field. By doing this assignment, we gain more knowledge especially about MATLAB. Other than
mastering in calculation, we also can improve our skills in programming that we believe will
help us a lot in future when in engineering field.
It can be concluded that this assignment gave us more knowledge either in calculation or
programming. We hope this assignment can be continued for this subject to help improving the
understanding of student about numerical differentiation and it relationship with MATLAB.
16