Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Numerical methods – Topic 1

VIETNAM NATIONAL UNIVERSITY OF HO CHI MINH CITY

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY

--------o0o--------

REPORT ON THE ASSIGNMENT IN NUMERICAL METHODS

GROUP 11 – TOPIC 1

Subject: Numerical methods

Instructor: MSc. Hoàng Hải Hà

Subject code: MT1009

Class: CC01

Group: 11

Semester: 231
Numerical methods – Topic 1

Table of Contents
I) Group members .............................................................................................................. 3
II) Job role of each members & Work evaluation.................................................................. 3
III) Introduction ................................................................................................................. 4
IV) Calculation ................................................................................................................. 5
A) Theory and algorithm ................................................................................................. 5
B) Solving the problem by using Matlab ........................................................................... 6
1. Choosing a topic and object for the project .............................................................. 6
2. Data collecting procedure ...................................................................................... 7
3. Final data ........................................................................................................... 22
4. Convert table ...................................................................................................... 24
5. Main Code session .............................................................................................. 25
6. Explaining the code ............................................................................................ 27
7. Final result ......................................................................................................... 32
V. Conclusion ................................................................................................................. 34
VI. References ................................................................................................................. 35
Numerical methods – Topic 1

I) Group members

No. Name Student ID

1 Phạm Nguyễn Quốc Trung 2213710

2 Nguyễn Ngọc Khánh Nhi 2252580

3 Phạm Hồng Diễm Quyên 2252699

4 Mai Thiều Phúc Toàn 2252819

5 Phùng Nhật Huy 2252261

6 Nguyễn Phan Khánh Toàn 2252821

II) Job role of each members & Work evaluation

No. Name Job role Work evaluation

1 Phạm Nguyễn Quốc Trung Coordinator, Code Matlab 100%

2 Nguyễn Ngọc Khánh Nhi Format, Introduction, Theory 100%

3 Phạm Hồng Diễm Quyên Format, Introduction, Theory 100%

4 Arrange structure of report, 100%


Mai Thiều Phúc Toàn
Code matlab
Numerical methods – Topic 1

5 Collecting data from QGIS, 100%


Phùng Nhật Huy
Rearrange data

Collecting data from QGIS,


6 Nguyễn Phan Khánh Toàn Rearrange data 100%

III) Introduction
Numerical methods play a pivotal role in solving mathematical problems that lack closed-
form analytical solutions. As we delve into the realm of mathematical modeling, engineering
simulations, and scientific computations, the limitations of traditional analytical techniques
become apparent. It is in this landscape that numerical methods emerge as indispensable tools,
offering solutions to complex problems through iterative algorithms and computational
techniques.

Numerical methods provide a means to approximate solutions to mathematical problems that may
defy exact analysis. These methods are particularly crucial when dealing with functions that are
intricate, discontinuous, or lack a straightforward algebraic expression. One such numerical
technique that stands out in the realm of numerical integration is Simpson's rule.

Simpson's rule, a cornerstone of numerical analysis, is a numerical integration method designed to


estimate definite integrals of functions. This method, named after the mathematician Thomas
Simpson, excels in approximating the area under a curve by employing quadratic interpolating
polynomials. Through a systematic approach of dividing the interval of interest into subintervals
and fitting parabolic arcs, Simpson's rule strikes a balance between simplicity and accuracy.

In this exploration of numerical methods, we embark on a journey to understand the principles


behind Simpson's rule, its application in approximating definite integrals, and the advantages it
offers over alternative methods. As we navigate through the intricacies of numerical integration,
we uncover the significance of Simpson's rule in providing reliable and efficient solutions to
mathematical problems that elude traditional analytical techniques.

In this project, we will use knowledge gained from university to solve the required problems.
Numerical methods – Topic 1

IV) Calculation
A) Theory and algorithm
The Simpson's rule is a numerical integration method used to approximate the definite
integral of a function. It's based on approximating the curve defined by the function with a series
of parabolic arcs.
The basic idea behind Simpson's rule is to divide the area under the curve into a series of narrow,
equal-width subintervals and then use the quadratic interpolating polynomials for each pair of
adjacent subintervals.

The Simpson’s formula can be expressed as follows:

𝑏−𝑎
Here, n = 2 is the number of subintervals, h is the width of each subinterval (given by ℎ = ,
𝑛

and xi represents the endpoints of each subinterval.

The composite Simpson’s formula can be expressed as follows:


Numerical methods – Topic 1

Simpson's rule gives just an approximate value of the integral, not the exact value. So there is
always an error that can be calculated using the following formula.

Simpson's rule is used to calculate the area of a province because it provides an accurate method
for calculating the area under a curve or the volume of a shape. It's an important method in the
field of Surveying, helping to calculate areas based on diameters.

Simpson's rule states that, the sum of the first and last diameter must be made. Add twice the sum
of the remaining diameters and four times the sum of the remaining diameters. Multiplying this
sum by 1/3 of the common distance between the diameters will give the area sought.

Simpson's rule provides more accurate results than other methods like the Midpoint rule or the
Trapezoidal rule, as it uses parabolas to approximate each part of the curve, rather than rectangles
or trapezoids.

B) Solving the problem by using Matlab


Requirements: Choosing a province of Vietnam, you collect the data of positions by
using Google Maps. Compare your result to the real data

1. Choosing a topic and object for the project


Our team has chosen Hanoi as the primary subject for applying Simpson's rule in calculating the
area value of the region for the following reasons:
- Significance: Hanoi is the large capital of Vietnam. Therefore, it is a location that almost
everyone, both domestically and internationally, is aware of and can roughly visualize the
area of this place. In addition, Hanoi is a central area, bordering other regions as well as
bodies of water, contributing to the diversity of Hanoi's terrain.
- Advantages in calculation

 Since it is a large area, and as mentioned above, Hanoi has clear boundaries, which
will be an advantage in collecting data for upcoming calculations.
Numerical methods – Topic 1

 As Hanoi is a focal location, known to many, public information about this location
will achieve a certain level of accuracy, thereby ensuring the input information is
accurate, and thus the calculated results are as close to reality as possible.

The picture below shows the actual shape of the area when it is shown in satellite Map

Figure 1: The area of Hanoi

2. Data collecting procedure


The collecting process includes 3 main stages
- Stage 1: Choosing and setting up the tool for generating data
- Stage 2: Import data
- Stage 3: Received generated data
The detailed steps are as procedure below. Our team will clearly explain each steps with
illustrating picture for best understanding and avoid misinformation
a. Step 1: Download the QGIS software to the device (Windows)
After considering many related applications, our team choose QGIS as our tool for
generating data.
Numerical methods – Topic 1

This tool allows you to create, edit, visualize, analyze, and publish geospatial information.

Figure 2.1 The QGIS logo


b. Step 2: Download the Vietnam map data
In this stage, our team using the GADM to download the data in form of latitude and
longitude. For the most precise result of the project, we prefer to use the newest version of
the Map, which is version 2.5, uploaded in July 2015. Since it is a website, our team have
also included the link of this tool here: https://gadm.org/.

Figure 2.2 Interface of the GADM application

After choosing Vietnam as download object, we choose Shapefile extension and download it for
further steps
c. Step 3: Import data into QGIS
In QGIS, we create a New project. Then we add map file into this app. Remind that, we can only
use data with the “.shp” extension only. Any other extension will cause the error dialog as the
app will not be able to generate the data for out project.
The downloaded data is divided into many types of extensions, however, as metioned before, we
only choose all the data of Vietnam area that have a “.shp” extension
Numerical methods – Topic 1

Figure 2.3 Choosing data with .shp extension for importing


d. Step 4: Choose the suitable option
After importing data, the application will show 3 options on the left side for us to choose,
which are:
- adm1: filter out the provinces
- adm2: display the boundaries of all districts
- adm3: display the boundaries of all communes. This option is used for the purpose of
measuring the area of smaller units
Based on our computing purpose, we will only choose by check in the adm1 option box
instead of all of them

Figure 2.4 Choosing the adm1 option


Numerical methods – Topic 1

e. Step 5: Choosing province


Right-click on VNM_adm1 (the adm1 option above), then select "Open Attribute Table" to
see a list of specific provinces and their order number in this map system. Each province area
will have its specific ID that shown besides its name.
Here, since we choose Hanoi is our object, we can observe that in the Hanoi row, the ID_1
column of Hanoi show the number of 23
For further application, we can also apply this way to generate data of other provinces and
cities by repeating this step similarly.

Figure 2.5 Choosing province and observe its ID number

f. Step 6: Choosing the information field


Continue to switch to the filter mode under the right-click frame from earlier. Select the
"Filter" mode. In this frame, select ID_1 to bring it down to the frame below.
Numerical methods – Topic 1

Figure 2.6 Choosing the information field

g. Step 7: Choose the ID number of the objective province


Click the equal sign in the operator section, then enter the corresponding order number that you
have looked up in the previous step. Then click "OK". Since the ID of Hanoi is 23, so the
importing function that we will use is “ID_1” = 23. That’s means we will choose the province
which has the ID of 23.
Numerical methods – Topic 1

Figure 2.7 Choose the province ID

h. Step 8: Create grid frame


To create a grid frame, we use the Vector tool in the toolbar above. Follow the steps below:
choose “Vector”  “Research tools”  “Create grid frame”. This step will create a grid
boundary around the shape of the area.

Figure 2.8 Create grid frame

i. Step 9: Choose division


In the dialog box, enter 0.001 for the degree (longitude, latitude) division. Then, click the
"Run" button below. This step will divide all the measurements of the area in to the 0.001
division format.
Numerical methods – Topic 1

Figure 2.9 Choose division

j. Step 10: Limit the area


Limit the part of the grid line that is within the corresponding boundary using the tool. This
stage including steps as: choosing “Vector”  “Research tools”  “Intersection”. After
choosing intersection, the tool will define all the intersection point between the grid part and
the shape of the area
Numerical methods – Topic 1

Figure 2.10 Limit the grid line

k. Step 11: Selecting layers


We will select the two layers that need to be shown as an intersection, that are the grid part
and the area shape. The detail steps for this stage can be observed clearly in the picture below

Figure 2.11 Select 2 intersection layers


Numerical methods – Topic 1

l. Step 12: Result after the intersection stage


After running the intersection function, the result can be seen as picture below

Figure 2.12 Result of intersection function

m. Step 13: Define the intersection point


We need to find the intersection points between the grid area within the boundary and, the
boundary of the area to be calculated. Steps for this stage can be done as shown in the two
figures below.
Firstly, we will excerpt the boundary point as following steps: choose “Vector” 
“Geometry tools”  “Excerpt peaks”
Numerical methods – Topic 1

Figure 2.13.1 Excerpt the peak

After that, we will choose the option as figure below

Figure 2.13.2 Choosing option

n. Step 14: The result after choosing peaks


After running the choosing peaks function, we can observe the result as figure below. The
figure shown the area, however, now, we also have the intersection point between the grid
part and the area shape together. All the points are now can be observed clearly in form of
circle points.
Numerical methods – Topic 1

Figure 2.14 Area with intersection points

o. Step 15: Adjust the coordinate


In this step, we will place the Oxy coordinate system according to longitude and latitude by
doing 2 main steps

Firstly, we choose the geometry properties for the shape by clicking: “Vector”  “Geometry
tools”  “Add geometry properties”
Numerical methods – Topic 1

Figure 2.15.1 Adding geometry properties

After that, we will choose options as shown in the figure below

Figure 2.15.2 Choosing option

p. Step 16: View properties


Now, we will right-click on the last layer that was created, and select "View Properties" in order
to view all the existing properties that can be shown
Numerical methods – Topic 1

Figure 2.16.1 Choosing “View properties” option

Then, the app will show us all the properties of the area, including the ID, Name, and the most
important information is the statistics of the latitude and longitude in 3 directions: left, top right
and bottom.

Figure 2.16.2 Properties showing

q. Step 17: Clearing data


We now can choose and keep the necessary data only, by remove unessential columns. With our
purpose, we only need to keep the Ox and Oy coordinate axis columns.
Numerical methods – Topic 1

The eliminating procedure can be done with the shortcut function as “Ctrl + L”

Figure 2.17.1 Open the Eliminating function

Figure 2.17.2 Choosing unnecessary data field that need to be eliminated

r. Step 18: Export data


Numerical methods – Topic 1

After eliminating all of the excess data, will we export the points as its value according to the
coordinate axis to an Excel file. Steps can be done as “Export”  “Save as”. Be careful to save
the file with the .xlsx extension to ensure that we will have an Excel file

Figure 2.18.1 Save as option

Figure 2.18.2 Fill in saving information for the export file


Numerical methods – Topic 1

s. Step 19: Filter data


We will filter the data using latitude as the origin in Excel from the exported original table.

Figure 2.19 Final data in Excel file

3. Final data
The final data can be seen clearly in the excel file. In this report, we will only show a part of
the final data as below
Numerical methods – Topic 1

Figure 3.1. First 25 data values of the latitude and the longitude

Besides, we also have the statistics about the minimum, maximum value of both latitude and
longitude, as well as the mean value of that 2 variable. All of that statistic values are shown in
the table below
Numerical methods – Topic 1

Figure 3.2 Statistic value of Longitude and Latitude


In our report, we will include here the Google Drive address that link to the Spreadsheet. All of
the data (as shown in figure above) is already included in this Spreadsheet.

Link: https://docs.google.com/spreadsheets/d/19UVZQWVXnYEXaA-iZoHXmJ-
LobvAPdj2/edit?usp=drive_link&ouid=100182846651200143264&rtpof=true&sd=true

For using this file, please download it to your computer with the “.xlsc” extension (Excel file).
Then, upload the file into the MATLAB Drive. Please also remind that if you change the file
name, you should change the “Location.xlsx” into your file name instead of “Location” in our
report.

4. Convert table
Below is the convert table that we use the resource from Wikipedia website. This convert table
show the relationship between the latitude and its related values. The concept of this calculation
is based on the Interpolation theory that we’ve already learned in our course

Figure 4 Covert table

Below is the value of average longitude that is already transformed to distance format. The
formula is also illustrated in the table.

Average Longitude Average distance North- South Average distance West – East
(20.9853 - 15)*(110.852 - (20.9853 - 15)*(96.486 -
20.9853
110.649)/(30 - 15) + 110.649 107.551)/(30 - 15) + 107.551
Numerical methods – Topic 1

Table 4 Example of using Interpolation formula for transforming value

5. Main Code session


Below is all of the code session. For better illustration, you can try importing by copying all this
code in put it in the Matlab app. The app will show step by step such as the setting up data or
generating data clearly

The content of the code is as below:

% Set up initial condition:


clc
clear all
% Setup and convert data
Longitude_Deviation = 0.001;
Root_Data = xlsread('MATLAB Drive/Location.xlsx',1,'A2:B3077');
Size_of_Root_Data = size(Root_Data);
Data = [];
Compare_Var = Root_Data(1,2);
Col = 1;
Row = 1;
for i = 1 : Size_of_Root_Data(1)
if Root_Data(i,2) == Compare_Var
Data(Row,Col) = Root_Data(i,1);
Row = Row + 1;
else
Data(1,Col+1) = Root_Data(i,1);
Compare_Var = Root_Data(i,2);
Col = Col + 1;
Row = 2;
end;
end
Size_of_Data = size(Data);
Numerical methods – Topic 1

% Convert degree to km
Lattitude_Convert = (20.9853 - 15)*(110.852 - 110.649)/(30 - 15) + 110.649;
Longitude_Convert = (20.9853 - 15)*(96.486 - 107.551)/(30 - 15) + 107.551;
% Compute y(i)
Lattitude = [];
for i = 1 : Size_of_Data(2)
Lattitude_i = 0;
for j = 1 : Size_of_Data(1)/2
Lattitude_i = Lattitude_i + abs(Data(2*j,i) - Data(2*j-1,i));
end;
Lattitude = [Lattitude Lattitude_i];
end;
y = Lattitude_Convert*Lattitude;
% Compute the area by using Simpson's method
w = Longitude_Convert*Longitude_Deviation;
y_first = 0;
y_last = 0;
y_odd = 0;
y_even = 0;
for i = 1 : Size_of_Data(2)
if i == 1
y_first = y(i);
elseif i == Size_of_Data(2)
y_last = y(i);
elseif i - 2*round(i/2) == 0
y_even = y_even + y(i);
else
y_odd = y_odd + y(i);
end;
end;
Area_of_province = (w/3)*(y_first + 4*y_odd + 2*y_even + y_last)
Numerical methods – Topic 1

6. Explaining the code


a. Set up initial condition: Firstly, we need to set up initial condition by the function
clc
clear all

b. Then, we will setup and convert data by


- Finding the division between the longitude
Longitude_Deviation = 0.001;
- Defining the size of data
Root_Data = xlsread('MATLAB Drive/Location.xlsx',1,'A2:B3077');
Size_of_Root_Data = size(Root_Data);

- Simply explain the code:


 Firstly, assign read the data in the Excel file by the function “xlsread”, with
o 1: the activating sheet that contains data
o A2:B3077: the range of the data
 Define the size of the “Root_Data”
 the result received from this step will be as below

It means, our data when generating into matrix form, has a size of 3076 rows and 2 columns

Data = [];
Compare_Var = Root_Data(1,2);
Col = 1;
Row = 1;
for i = 1 : Size_of_Root_Data(1)
if Root_Data(i,2) == Compare_Var
Data(Row,Col) = Root_Data(i,1);
Numerical methods – Topic 1

Row = Row + 1;
else
Data(1,Col+1) = Root_Data(i,1);
Compare_Var = Root_Data(i,2);
Col = Col + 1;
Row = 2;
end;
end
Size_of_Data = size(Data);

- Simply explaining steps


 Create an empty matrix named “Data”
 Assign the first value which is the value of row 1, column 2 to the variable named
“Compare_Var”
 Using loop function: from the first row of “Root_Data” to the last row of
“Root_Data”, starting with “Root_Data (1,2)”, if
o Root_Data (1,2)” is equal to “Compare_Var”, this value will be assigned into
the first column of the new table named “Data”. Then, the program will
move to the following value in the successive line and repeat the process. If
following values in still equal to the “Compare_Var” it will also be assigned
into the same column with the first value
o Else, the program will come to the next line of the and continue to compare
and assigned this value into the next column of the new table.

 The result received from this step will be as below


Numerical methods – Topic 1

Figure 6.1 Filtering data

With this table, we can conclude the concept that each column shows latitude that correspond
with each longitude. The same concept will be applied for all of the other longitude of the data.

c. Convert degree to km
Lattitude_Convert = (20.9853 - 15)*(110.852 - 110.649)/(30 - 15)
+ 110.649;
Longitude_Convert = (20.9853 - 15)*(96.486 - 107.551)/(30 - 15)
+ 107.551;
This step shows the covert formula of latitude and longitude value. The concept of this function
is based on the Interpolation formula. Combine it with the convertible shown above, we can
easily transform the value of latitude and longitude in our data into form of length measures in
km.

d. After that, we will compute y(i) value


Lattitude = [];
for i = 1 : Size_of_Data(2)
Lattitude_i = 0;
for j = 1 : Size_of_Data(1)/2
Lattitude_i = Lattitude_i + abs(Data(2*j,i) -
Data(2*j-1,i));
end;
Lattitude = [Lattitude Lattitude_i];
Numerical methods – Topic 1

end;
y = Lattitude_Convert*Lattitude;

- Simply explaining steps


 Create an empty value called “Lattitude”
 Using looping function, scan over half of the number of value
 For each increasing value of “j” and “i”, compute the result of “Data(2*j,i)” and
“Data(2*j-1,i)” and the sum of them
 Assign the result into the “Lattitude” matrix respectively for all results
 After having the “Lattitude” matrix, we will transform it into form of length b the
formula: “Lattitude_Convert*Lattitude”

- Aware that at this point, we will use the value of “Size_of_Data(1)/2” instead of
“Size_of_Data(1)” because for each step of the stage, we use 2 continuous value instead
of 1. That means, for each looping turn, we will scan over 2 value. So, the total number
of scanning turn will only be half of the total data.

- Remind that the function “for i = …” just only for defining the number of scanning
turn. One another important value: the number of value that will be scan over in each
time have not been defined yet in this step.

- One more thing that need to be focus here is, rows that have no value should be processed
before coming to this stage. The data processing step will replace the empty value with
“0” so that the computing steps will not be effected by this problem.

e. Compute the area by using Simpson's method


w = Longitude_Convert*Longitude_Deviation;
y_first = 0;
y_last = 0;
y_odd = 0;
y_even = 0;
Numerical methods – Topic 1

for i = 1 : Size_of_Data(2)
if i == 1
y_first = y(i);
elseif i == Size_of_Data(2)
y_last = y(i);
elseif i - 2*round(i/2) == 0
y_even = y_even + y(i);
else
y_odd = y_odd + y(i);
end;
end;
Area_of_province = (w/3)*(y_first + 4*y_odd + 2*y_even +
y_last)

- At this final stage, we will define 4 types of y value in order to apply the area formula
- Simply explain the code
 First of all, we will compute the value of w, which is the equal distance between
longitudes by the formula: “Longitude_Convert*Longitude_Deviation”
 Secondly, we set up 4 types of y and assign 0 value to it
 Using looping function with starting point when i=1, we will scan over the whole
longitude value of the data
o With “y_first”, we assign the first value of y (y(1))
o With “y_last”, we assign the last value of y (y(i))
 With the same process, other y values will be defined into 2 groups: even values
and odd value by the function: i – 2*round(i/2) == 0.
o The value of i will be an even number if the function is true. The y value now
will be assign to the y_even
o Otherwise, it will be an odd number and will be assigned into the y_odd
 The final value of “y_last” or “y_final” will be the total value of all the “y_last”/ “y
final
Numerical methods – Topic 1

 Finally, we compute the area of Hanoi by the Simpson’s rule, with the formula:
“Area_of_province = (w/3)*(y_first + 4*y_odd + 2*y_even + y_last)”
- With this final stage, we remind you two important things
 The value of “y_even” and “y_odd” is computed as a sum of all even or odd value.
This issue will not affect the final result since the in the Simpson’s rule, we will not
use the value of each even or odd variable, but the sum of it
 The concept of analyzing odd or even values can be explained as followed
o assume that we have i = 3, the formula i – 2*round(i/2) will become: 3 – 2*2
= -1 (3/2 = 1,5, the round up value of it will be 2). Since the result is
different from 0, we will conclude 3 is an odd number, as it is.
o On the other hands, assume that we have i = 4, the formula i – 2*round(i/2)
will become: 4 – 2*2 = 0 (4/2 = 2 is the whole number so we do not need to
round it up). Since the result is equal to 0, we will conclude 4 is an event
number, as it is.

7. Final result
After applying the above formula, we finally computed the approximate value of area of Hanoi.
The value is about 3432 km2. The appearance shown in the program is as the figure below:
Numerical methods – Topic 1

Figure 7.1 The result of the program

Note that, the program shown us the value of “3.4320e+03”, with “…e+03” means, to find the
actual value, we will need to multiply 3.4320 with 10 cubed, or 1000.

Besides, we also finding the actual value of the area of Hanoi. The real number that is published
on the government website is 3360 km2 as the “Area  Capital city and municipality” session
below

Figure 7.2 The actual value of the area of Hanoi

Compare with the real value of the area of Hanoi, which is about 3360 km2, we will calculate the
error of this application is about 2,14%
Numerical methods – Topic 1

Figure 7.2 Error of the calculation

V. Conclusion
By applying some acknowledgment that has been already taught in our course, we can
understand the concept of using Simpson's rules in approximating the existing as we have done
in this topic.

With the given topic, we chose Simpson's rules as the main numerical method to analyze data in
the form of Latitude and Longitude, then, generate them into a suitable statistical form that can be
used in our code.

In the coding session, firstly, we import the data in an Excel file into the Matlab applications. After
that, we start filtering all the necessary data, besides eliminating excess data so that we will a clear
data for our code without any hand-made filtering.

The main coding session includes 2 main stages: setting up data and computing the final value of
our object. By using a loop function that can help us scan over all the data, we can calculate the
area based on all of that statistical value.

In comparison to other methods to approximate the area such as measuring or other Calculus
methods such as Riemann Sums, Definite Integrals, and Method of Exhaustion…, Simpson's rule
is more flexible and simple as it only requires information about the latitude and longitude to
calculate the specific area without any obstacle.

Moreover, this is a potential and perfect method for this kind of request, since Simpson’s rule has
several advantages when it comes to numerical integration:

- Accuracy: Simpson’s rule provides a more accurate approximation of the area under the
curve, especially for curves that are not smooth or have rapid variations. It is based on the
Numerical methods – Topic 1

fact that given any three points, you can find the equation of a quadratic through those
points
- Efficiency: It requires fewer data points than the Trapezoidal Rule to achieve similar
accuracy. This makes it efficient for larger datasets
- Versatility: While rectangles and trapezoids work better for linear functions, Simpson’s
Rule works quite well on curves. It uses quadratic polynomial approximations instead of
straight lines, which gives more accurate results.
- Polynomial Interpolation: Simpson’s rule is one of the Newton-Cotes formulas used for
approximating the value of a definite integral. It approximates the function using fitting
polynomial identities found by Lagrange interpolation4.
- Exact Results for Polynomials: Simpson’s rule provides exact results for any polynomial
of degree three or less, since the fourth derivative of such a polynomial is zero at all
points

Overall, Simpson’s rule is a powerful and versatile method that is well-suited for analysing data
as well as computing the area of specific place approximated outcomes. It provides direct
estimates of value, is flexible and easy to use, and can handle a wide range of data types and
distributions.

VI. References

[1] N. J. H. Desmond J. Higham, Matlab Guide, 2016.


[2] R. Hamming, Numerical Methods for Scientists and Engineers, Dover Publications, 1973.
[3] R. Pratap, Getting Started with MATLAB 7: A Quick Introduction for Scientists and
Engineers, Oxford University Press, 2005.
[4] “Wolfram MathWorld,” [Online]. Available:
https://mathworld.wolfram.com/SimpsonsRule.html.
[5] “Wikipedia - Simpson's rule,” [Online]. Available:
https://en.wikipedia.org/wiki/Simpson%27s_rule.
[6] “Wikipedia - Longitude,” [Online]. Available: https://en.wikipedia.org/wiki/Longitude.
[7] E. S. David F. Mayers, An Introduction to Numerical Analysis, Cambridge University Press,
2012.
Numerical methods – Topic 1

[8] K. E. Atkinson, An Introduction to Numerical Analysis (2nd edition), John Wiley & Sons,
1989.
[9] J. D. F. A. M. B. Richard L. Burden, Numerical analysis, Cengage Learning, 2015.

You might also like