Portfolio For Module 2
Portfolio For Module 2
Intramuros ,Manila
MSE126P:
Numerical Methods
Submitted to:
Mr. Eric Miranda
Submitted by:
Alyssa Sarah E. Arenas
B20
February 2021
SW2A
Instructions: Determine the difference in derivations from Free Approximation, Central Difference
Derivative and Richardson Extrapolation.
y=x 4 + 5 x 3 +3 x 2+1
For your iteration, start at h = 1, decreasing at 0.1 interval till the program results to division by zero.
Formula:
( y ( x +h ) − y ( x ) )
y ' (x )=lim
h→0 h
For Central Difference Derivative:
( y ( x +h/2 )− y ( x−h/2 ))
y ' (x )=lim
h→0 h
For Richardson Extrapolation
'
y ( x )=lim
( 64 D cd ( 4h )−20 D ( h2 )+ D ( h) )
cd cd
h →0 h
where D cd is the slope ¿ Central Difference Derivative
For h=1
First Approximation
(( x +1) ¿ ¿ 4+5 ( x+ 1 )3+ 3 ( x +1 )3 +1)−( x 4 +5 x 3 +3 x2 +1)
y ' ( x )= ¿
1
¿ 4 x3 +21 x 2+25 x +9
L et x=3
3 2
¿ 4 ( 3 ) +21 ( 3 ) +25 ( 3 ) +9
¿ 381
Let x=3
5
¿ 4 (3)3 +15(3)2+ 7(3)+
4
¿ 265.25
Richardson Extrapolation
5
y ' (x )=
( (
64 4 x3 +15 x 2+ 7 x+
4 )( 14 ))−(20( 4 x + 15 x +7 x+ 54 )( 12 ))+( 4 x +15 x +7 x + 54 )( 1)
3 2 3 2
1
55
64 x 3+240 x 2 +112 x+20−44 x3 −165 x 2−77 x−
4
¿
1
25
¿ 20 x 3+75 x 2 +35 x+
4
Let x=3
25
¿ 20(3)3 +75(3)2 +35(3)+
4
¿ 1326.25
For h=0.9
First Approximation
(( x+0.9)¿ ¿ 4 +5(x +0.9)3 +3( x +0.9)3+ 1)−( x 4 +5 x 3+ 3 x 2 +1)
y ' (x )= ¿
0.9
3.6 x 3 +18.36 x 2+ 20.466 x +6.7311
¿
0.9
Let x=3
3.6(3)3+ 18.36(3)2+ 20.466(3)+6.7311
¿
0.9
¿ 367.299
Richardson Extrapolation
3.6 x3 +13.5 x 2+ 6.129 x +0.91125 0.9 3.6 x3 +13.5 x 2+ 6.129 x +0.91125
y ' (x )=
( (
64
0.9 )( )) ( (
4
− 20
0.9 )( 0.2
0.9
18 x 3 +67.5 x 2+30.645 x +4.55625
¿
0.9
Let x=3
18(3)3+ 67.5(3)2+30.645 (3)+ 4.55625
¿
0.9
¿ 1322.2125
For h=0.8
First Approximation
(( x+0.8) ¿ ¿ 4+5( x +0.8)3 +3(x +0.8)3 +1)−(x 4 +5 x 3 +3 x2 +1)
y ' (x )= ¿
0.8
3.2 x 3 +15.84 x 2+16.448 x +4.8896
¿
0.8
Let x=3
3.2(3)3 +15.84 (3)2+16.448 (3)+ 4.8896
¿
0.8
¿ 353.992
Let x=3
3.2(3)3 +12(3)2 +5.312(3)+0.64
¿
0.8
¿ 263.72
Richardson Extrapolation
3.2 x 3 +12 x 2 +5.312 x +0.64 0.8 3.2 x3 +12 x 2+5.312 x+ 0.64 0.8 3.2 x 3
y ' (x )=
( (
64
0.8 )( )) ( (
4
− 20
0.8 )( )) (
2
+
0.8
16 x 3 +60 x 2+ 26.56 x +3.2
¿
0.8
Let x=3
16(3)3+ 60(3)2+ 26.56(3)+3.2
¿
0.8
¿ 13 18 .6
For h=0.7
First Approximation
(( x+0.7)¿ ¿ 4+5( x+0.7)3 +3( x+0.7)3 +1)−( x 4 +5 x3 +3 x 2+ 1)
y ' (x )= ¿
0.7
3 2
2.8 x +13.44 x + 12.922 x +3.4251
¿
0.7
Let x=3
2.8(3)3+ 13.44(3)2 +12.922(3)+3.4251
¿
0.7
¿ 3 41 . 073
Richardson Extrapolation
2.8 x 3 +10.5 x 2+ 4.543 x+0.42875 0.7 2.8 x 3+10.5 x 2+ 4.543 x+ 0.42875
y ' (x )=
( (
64
0.7 )( )) ( (
4
− 20
0.7 )( 0.2
0. 7
14 x3 +52.5 x 2+ 22.715 x +2.14375
¿
0.7
Let x=3
14(3)3 +52.5(3)2+ 22.715(3)+ 2.14375
¿
0.7
¿ 13 15 . 4125
For h=0.6
First Approximation
(( x+0.6)¿ ¿ 4+5(x +0.6)3 +3( x +0.6)3 +1)−( x 4 +5 x 3 +3 x 2+ 1)
y ' (x )= ¿
0.6
2.4 x3 +11.16 x2 +9.864 x +2.2896
¿
0.6
Let x=3
3 2
2.4(3) +11.16 (3) +9.864 (3)+2.2896
¿
0.6
¿ 3 28 .536
Let x=3
2.4(3)3 +9(3)2 +3.816(3)+0.27
¿
0. 6
¿ 26 2 .53
Richardson Extrapolation
2.4 x 3+ 9 x 2 +3.816 x+ 0.27 0. 6 2.4 x 3 +9 x 2+ 3.816 x +0.27 0.6 2.4 x 3+
y ' (x )=
( (
64
0.6 )( )) ( (
4
− 20
0.6 )( )) (
2
+
0. 6
12 x3 + 45 x2 +19.08 x+ 1,35
¿
0.6
Let x=3
12(3)3 + 45(3)2+ 19.08(3)+ 1,35
¿
0.6
¿ 13 12 . 65
For h=0.5
First Approximation
(( x+0.5) ¿ ¿ 4 +5( x +0.5)3 +3(x +0.5)3+ 1)−(x 4 +5 x 3+ 3 x 2 +1)
y ' (x )= ¿
0.5
2 x 3 +9 x 2+7.25 x +1.4375
¿
0.5
Let x=3
2(3)3 + 9(3)2+7.25 (3)+1.4375
¿
0.5
¿ 3 16 .375
Let x=3
2(3)3 +7.5( 3)2 +3.125(3)+0.15625
¿
0.5
¿ 26 2 .0625
Richardson Extrapolation
2 x 3 +7.5 x2 +3.125 x+ 0.15625 0.5 2 x3 +7.5 x 2+ 3.125 x +0.15625
y ' (x )=
( (
64
0.5 )( ) ) ( (
4
− 20
0.5 )( 0.52 ))+(
0. 5
10 x 3 +37.5 x2 +15.625 x+ 0.78125
¿
0.5
Let x=3
10(3)3+37.5 (3)2+15.625( 3)+0.78125
¿
0.5
¿ 13 10 .3125
For h=0.4
First Approximation
(( x+0.4 )¿ ¿ 4+5 (x+ 0.4)3+ 3(x+ 0.4)3 +1)−(x 4 +5 x 3 +3 x2 +1)
y ' (x )= ¿
0.4
1.6 x 3 +6.96 x 2+ 5.056 x +0.8256
¿
0. 4
Let x=3
1.6(3)3+ 6.96(3)2+ 5.056(3)+0.8256
¿
0. 4
¿ 3 04 . 584
Let x=3
1.6(3)3+ 6(3)2 +2.464(3)+0.08
¿
0. 4
¿ 26 1 .68
Richardson Extrapolation
1.6 x 3 +6 x 2 +2.464 x+ 0.08 0.4 1.6 x 3 +6 x 2+ 2.464 x+ 0.08 0.4 1.6 x 3 +
y ' (x )=
( (
64
0.4 )( )) ( (
4
− 20
0.4 )( )) (
2
+
0.5
8 x 3 +30 x 2+12.32 x +0.4
¿
0.4
Let x=3
8(3)3 +30(3)2+ 12.32(3)+ 0.4
¿
0.4
¿ 13 08 . 4
For h=0.3
First Approximation
(( x+0.3) ¿ ¿ 4 +5( x +0.3)3 +3(x +0.3)3+ 1)−(x 4 +5 x 3+ 3 x 2 +1)
y ' (x )= ¿
0.3
1.2 x 3 +5.04 x 2+3.258 x +0.4131
¿
0. 3
Let x=3
1.2(3)3 +5.04 (3)2+3.258 (3)+ 0.4131
¿
0.3
¿ 293 .157
Let x=3
1.2(3)3 + 4.5(3)2+ 1.827(3)+0.03375
¿
0. 3
¿ 26 1 .3825
Richardson Extrapolation
1.2 x 3 +4.5 x 2+ 1.827 x +0.03375 0.3 1.2 x 3 +4.5 x 2+ 1.827 x +0.03375 0. 3
y ' (x )=
( (
64
0.3 )( )) (
4
− 20
0.3 2( ))
0.5
6 x3 +22.5 x 2+ 9.135 x +0. 16875
¿
0. 3
Let x=3
6(3)3 +22.5(3)2+ 9.135(3)+0.16875
¿
0.3
¿ 13 0 6 . 9125
For h=0.2
First Approximation
(( x+0. 2)¿ ¿ 4+5 ( x+ 0.2)3 +3(x +0. 2)3 +1)−(x 4+ 5 x 3 +3 x 2+1)
y ' (x )= ¿
0. 2
0.8 x 3 +3.24 x 2 +1.832 x +0.1616
¿
0. 2
Let x=3
0.8(3)3+ 3.24(3)2 +1.832(3)+ 0.1616
¿
0. 2
¿ 282 .088
Let x=3
0.8(3)3+ 3(3)2+ 1.208(3)+ 0.01
¿
0. 2
¿ 26 1 .17
Richardson Extrapolation
0.8 x3 +3 x 2+ 1.208 x +0.01 0. 2 0.8 x 3 +3 x2 +1.208 x+ 0.01 0. 2 0.8 x 3+ 3
y ' (x )=
( (
64
0.2 )( ) ) (
4
− 20
0.2 ( )) (
2
+
0.2
4 x 3 +15 x2 +6.04 x +0.05
¿
0.2
Let x=3
4 (3)3 +15 (3)2 +6.04 (3)+0.05
¿
0.2
¿ 13 05 . 85
For h=0.1
First Approximation
(( x+0. 1)¿ ¿ 4+5 ( x+ 0.1)3+ 3(x +0.1)3 +1)−( x 4 +5 x 3 +3 x2 +1)
y ' (x )= ¿
0. 1
0.4 x 3+1.56 x 2 +0.754 x +0.0351
¿
0.1
Let x=3
0.4(3)3 +1.56(3)2 +0.754 (3)+ 0.0351
¿
0. 1
¿ 271 .371
Let x=3
0.4(3)3 +1.5(3)2 +0.601(3)+0.00125
¿
0. 1
¿ 2 44 . 8155
Richardson Extrapolation
0.4 x 3+ 1.5 x 2 +0.601 x+0.00125 0.1 0.4 x 3+1.5 x 2 +0.601 x +0.00125 0. 1
y ' (x )=
( (
64
0.1 )( )) (
4
− 20
0.1 ( ))
2
+
0. 1
2 x 3 +7.5 x 2 +3 .005 x +0.0 062 5
¿
0. 1
Let x=3
2(3)3 +7.5( 3)2 +3.005(3)+0.00625
¿
0.1
¿ 13 05 .212 5
For h=0.0
First Approximation
(( x+0. 0) ¿ ¿ 4 +5( x +0. 0)3+3 (x+ 0.0)3 +1)−( x 4+ 5 x 3 +3 x 2+1)
y ' (x )= ¿
0. 0
¿ UNDEFINED
Richardson Extrapolation
Since D cd from Central Difference Derivative is undefined, this is also UNDEFINED .
SUMMARY
CONCLUSION
If we are to derive y=x 4 + 5 x 3 +3 x 2+1, we will get y=4 x 3 +15 x 2 +6 x and if we let x=3,
PROGRAMMING 3
INTRODUCTION
Derivative could be described as the rate of change of a function with respect to a
variable. Geometrically, it could be interpreted as the slope of the function’s graph or in a more
precise way, the slope of the tangent line at a point (Britannica,2017).
Alongside the usual way of finding the derivatives of a function, several approximation
methods could also be used in order to determine such. Starting with First Approximation,
which I believe is also known as the Forward Difference, is denoted by the equation:
' ( y ( x +h ) − y (x))
y ( x )=lim
h →0 h
( y ( x +h )− y ( x) )
where is the slope of the graph.
h
Another method is called the Central Difference Derivative denoted by:
h h
where ( ( ) ( 2 ) ) is the slope of the graph and can also be denoted by D
y x+ − y x−
2 cd ( h ).
h
Lastly, is Richardson Extrapolation with the equation:
'
y ( x )=lim
( 64 D cd ( 4h )−20 D ( h2 )+ D ( h) )
cd cd
h →0 h
where Dcd ( h ), as mentioned earlier, is the slope derived from the Central Difference Derivative.
The main objective of this paper is to determine the difference in derivatives between
using the differentiation function in MATLAB and using different approximation methods
namely First Approximation, Central Difference Derivative and Richardson Extrapolation using
the equation
y=x 4 + 5 x 3 +3 x 2+1
and with iteration starting from h = 1 at 0.1 interval until the program results to division by
zero, in other terms, when h=0.
METHODOLOGY
Now starting with the First Approximation Next is the Central Difference Derivative.
Method, as seen in the introduction part , the Here, the slope is a function (x+(h/2))--
slope is a function of (x+h)--which I named y1, which I named y3, subtracted by the
subtracted by the function of (x)--which I named function of (x-(h/2))--which I named y4,
incorporated the equation in the introduction for incorporated the equation in the
First Approximation and named it d1. introduction for Central Difference
Derivative and named it d2.
fprintf('\nFor h = \n %0.1f \n',h); d3=(((64*d2*(h/4))-
fprintf('\nThe value obtained using First Approximation is: \n (20*d2*(h/2))+(d2*h)))/h;
%0.4f \n',d1)
fprintf('The value obtained using Central Difference Derivative Last would be through the
is: \n %0.4f \n',d2) Richardson EXtrapolation Method.
This is based from the slope
fprintf('The value obtained using Richardson Extrapolation acquired in the Central Fifference
is: \n %0.4f \n',d3)
Derivative that's why as I
Then, I used the 'disp' function in order to show the incporate the equation for the
values obtained using the First Approximation, Central Richardson Extrapolation, I used
Difference
x = 3; Derivative, and the Richardson the variable d2 obtained in the
Extrapolation. e1 = d1-d4;former step.
d4 =I used
4*x^3the+%0.1f
15*x^2for the
+ first one since
what I need are just h values with 1 decimal point. On e2 = d2-d4;
6*x;
the other displays, I used %0.4f for it to display values
upI also
to 4 again
decimalsetplaces.
the value of x to be 3, e3 = d3-d4;
and incorporated the equation
obtained by using the derivative Now in order to see how big the difference is
function in MATLAB denoted by d4 as between the values obtained using the three
obtained in the first few steps. methods and the theoretical value obtained by using
the derivative function in MATLAB, I've set the error
or the difference between the values obtained from
the derivative function (d4) and First
Approximation(d1) as e1, Central Difference
Derivative(d2) as e2, and Richardson
Extrapolation(d3) as e3.
CODE
RESULTS
CONCLUSION
In general, we can say that since these are approximations, it is to be expected that these
won’t give the exact values. Based from the acquired values, although First Approximation
method also gave a quite close value to the value acquired using the derivative function in
MATLAB, using the Central Difference Derivative gave a more precise and accurate value with
the least value of errors from the applied range of h = 1 to h = 0 and an x value of three. On the
other hand, the Richardson Extrapolation gave a far value from the expected value. In my
opinion, it would still be better to use the derivative function in MATLAB than these
approximations.
Reference:
Britannica, The Editors of Encyclopaedia. "Derivative". Encyclopedia Britannica, 22 Sep. 2017,
https://www.britannica.com/science/derivative-mathematics. Accessed 5 February 2021.
SW2B
Instructions: Get the integral of y = sin(x) + cos(x) between x= 0 to pi. The number of data point
n=100. Use Trapezoidal Rule, Simpson’s Rule, Simpson’s 3/8 Rule and Boole’s Rule. Compare
the 4 Rules. Which rule produce the best output?
Formula:
Solution:
Using Microsoft Excel, I first determined the x and y values:
n x y = sin(x)+ cos(x)
1 0 1
2 0.031415927 1.030917319
3 0.062831853 1.060817248
4 0.09424778 1.089670278
5 0.125663706 1.117447935
6 0.157079633 1.144122806
7 0.188495559 1.169668565
8 0.219911486 1.194060003
9 0.251327412 1.217273048
10 0.282743339 1.239284792
11 0.314159265 1.260073511
12 0.345575192 1.279618689
13 0.376991118 1.297901039
14 0.408407045 1.314902516
15 0.439822972 1.330606344
16 0.471238898 1.344997024
17 0.502654825 1.358060354
18 0.534070751 1.369783443
19 0.565486678 1.38015472
20 0.596902604 1.389163952
21 0.628318531 1.396802247
22 0.659734457 1.403062066
23 0.691150384 1.407937233
24 0.72256631 1.411422935
25 0.753982237 1.413515733
26 0.785398163 1.414213562
27 0.81681409 1.413515733
28 0.848230016 1.411422935
29 0.879645943 1.407937233
30 0.91106187 1.403062066
31 0.942477796 1.396802247
32 0.973893723 1.389163952
33 1.005309649 1.38015472
34 1.036725576 1.369783443
35 1.068141502 1.358060354
36 1.099557429 1.344997024
37 1.130973355 1.330606344
38 1.162389282 1.314902516
39 1.193805208 1.297901039
40 1.225221135 1.279618689
41 1.256637061 1.260073511
42 1.288052988 1.239284792
43 1.319468915 1.217273048
44 1.350884841 1.194060003
45 1.382300768 1.169668565
46 1.413716694 1.144122806
47 1.445132621 1.117447935
48 1.476548547 1.089670278
49 1.507964474 1.060817248
50 1.5393804 1.030917319
51 1.570796327 1
52 1.602212253 0.968095801
53 1.63362818 0.935236209
54 1.665044106 0.901453651
55 1.696460033 0.866781468
56 1.727875959 0.831253876
57 1.759291886 0.794905936
58 1.790707813 0.757773521
59 1.822123739 0.719893274
60 1.853539666 0.68130258
61 1.884955592 0.642039522
62 1.916371519 0.602142849
63 1.947787445 0.561651933
64 1.979203372 0.520606735
65 2.010619298 0.479047761
66 2.042035225 0.437016024
67 2.073451151 0.394553006
68 2.104867078 0.351700611
69 2.136283004 0.308501131
70 2.167698931 0.264997196
71 2.199114858 0.221231742
72 2.230530784 0.177247959
73 2.261946711 0.133089253
74 2.293362637 0.088799204
75 2.324778564 0.044421521
76 2.35619449 0
77 2.387610417 -0.044421521
78 2.419026343 -0.088799204
79 2.45044227 -0.133089253
80 2.481858196 -0.177247959
81 2.513274123 -0.221231742
82 2.544690049 -0.264997196
83 2.576105976 -0.308501131
84 2.607521902 -0.351700611
85 2.638937829 -0.394553006
86 2.670353756 -0.437016024
87 2.701769682 -0.479047761
88 2.733185609 -0.520606735
89 2.764601535 -0.561651933
90 2.796017462 -0.602142849
91 2.827433388 -0.642039522
92 2.858849315 -0.68130258
93 2.890265241 -0.719893274
94 2.921681168 -0.757773521
95 2.953097094 -0.794905936
96 2.984513021 -0.831253876
97 3.015928947 -0.866781468
98 3.047344874 -0.901453651
99 3.078760801 -0.935236209
100 3.110176727 -0.968095801
101 3.141592654 -1
Afterwards, I determined the step size for each method using the formula stated in the previous
pages:
step size(h)
Trapezoidal Rule 3.141592654
Simpson's Rule 1.570796327
Simpson's 3/8 Rule 1.047197551
Boole's Rule 0.785398163
Then, using the formula on the previous pages, for each method, I calculated the values with
the help of the functions in MS Excel:
Trapezoidal Rule
1.999835504
Simpson's Rule
1.333223669
Simpson's 3/8 Rule
2.027364924
Boole's Rule
3.983485549
If we are to compute for the integral of the given equation y=sin(x)+cos(x) when you set the
boundaries to be x=0 to pi , it would be equal to 2. As observed in the values calculated above,
we could see that this value is closest to the value obtained using the Simpson’s 3/8 Rule, thus
this method can be considered as the most accurate among the methods in integration
approximation.
PROGRAMMING 4
INTRODUCTION
Integration, usually indicated by the integral sign “∫” could be described as a method of finding a
function g(x) whose derivative is Dg(x) which is equal to a given function f(x). It is also usually known as
the opposite of differentiation. Moving on, an indefinite integral is usually denoted by
∫ f ( x ) dx
while a definite integral could be denoted as
b
∫ f ( x ) dx
a
where a and b are the limits of integration and is equal to g ( b ) −g (a)and still, Dg ( x )=f ( x ) .
Like differentiation, integration also has different methods of approximation. One of which is the
Trapezoidal Rule ,also known as Trapezium Rule, where the boundaries between the ordinates’ ends are
taken as straight thus, the areas between the irregular boundary lines and the baseline are considered
as trapezoids(. It is usually denoted by the formula:
Another one is using the Simpson’s Rule where the definite integral value is approximated using
quadratic function. As compared to the Trapezoidal rule, in this case, the boundaries between the
ordinates’ ends are taken as forming a parabola’s arc, thus, also known as parabolic rule and is denoted
as:
We also have a technique called the Simpson’s 3/8 Rule or simply finding the definite integral
approximation using the cubic function and is denoted by:
Last is the Boole’s Rule where given a partition P=(a=x0,x1,...,xN=b) of the interval (a,b), the integral
on each subinterval (xi−1,xi) is integrated by the quartic function that interpolates five equally spaced
points in that subinterval.
To summarize, such formulas could also be simplified to:
METHODOLOGY
h = (b-a)/(4*N);
i = 0:N-1;
xi = a+4*i*h;
xi1 = a+4*(i+0.25)*h;
xi2 = a+4*(i+0.5)*h;
xi3 = a+4*(i+0.75)*h;
xi4 = a+4*(i+1)*h;
i5 = (2*h/45)*sum(7*f(xi)
+32*f(xi1)+12*f(xi2)+32*f(xi3)+7*(xi4));
Last is the Boole's Rule where h is equal to b-a divided by 4.
Again i was indexed to a value from 0 to 100-1 or 99. f0 was
represented by xi, f1 by xi1,f2 by xi2, f3 by xi3 and f4 by xi4.
was based from the formula in the introduction part.
fprintf(' Using the Integral Function in MATLAB, the result is %0.9f. \n',
i1);
fprintf(' Using Trapezoidal Rule, the result is %0.9f. \n', i2);
fprintf(' Using Simpsons Rule, the result is %0.9f. \n', i3);
fprintf(' Using Simpsons 3/8 Rule , the result is %0.9f. \n', i4);
fprintf(' Using Booles Rule, e1=abs(i1-i2);
the result is %0.9f. \n', i5);
Then I used 'fprint'e2=abs(i1-i3);
in order to display the results from the
e3=abs(i1-i4);
aforementioned methods. Note that I used '%0.9f' in order
to display answer toe4=abs(i1-i5);
about 9 decimal places so that it's not
too long nor too short to display the differences between
Denoted by e1 ti e4, I then determined the error,
the acqui red answers.
rather, the difference between the methods and the
true value ibtained from in the built-in integal
fprintf(' The difference between Integral Function in MATLAB and Trapezoidal Rule is is %0.9f. \n', e1);
function in MATLAB.
fprintf(' The difference between Integral Function in MATLAB and Simpsons Rule is is %0.9f. \n', e2);
fprintf(' The difference between Integral Function in MATLAB and Simpsons 3/8 Rule is is %0.9f. \n',
e3);
fprintf(' The difference between Integral Function in MATLAB and Booles Rule is is %0.9f. \n', e4);
Lastly, I used the 'fprint' function in order to display the values I have obtained in the
CODE
previous step. The difference between the value obtained between Integral function
in MATLAB and Trapezoidal Rule was e1, e2 was for Integral Function and Simpson's
Rule, e3 was for Integral function and Simpson's 3/8 Rule and e4 was for integral
function and Boole's Rule.
RESULTS
CONCLUSION
Based on the above results, we can see that Simpson’s 3/8 Rule gave the closest value, in
fact, in this case, maybe equal to the one obtained using the built-in integral function in MATLAB which
is 2. Although the Simpson’s Rule could also be considered close to this true value, you can observe that
at some point in the 9th decimal place there would be some errors. This is followed by the Trapezoidal
Rule with error of about 0.0002 and last would be using the Boole’s Rule with error of about 0.2346.
Again, since the methods used are all just approximations, there would be times that the result in
Simpson’s 3/8 would have a more notable difference when compared to the value obtained by using the
built-in integral function in MATLAB. In my opinion, it would still be better to use this function in
MATLAB than the aforementioned approximations if you really want to obtain a concise and accurate
value.
QUIZ 2
Instructions: Given the set of data points below, determine the total area under the graph and
determine the slope at x-500. Use any technique we discuss on integration and derivatives.
Solution: Using MS Excel, I first listed the x and y values and determined their respective CDC
derivatives:
CDC
x y derivative
1 4
2 8 4
3 12 4
4 16 4
5 20 4
6 24 4
7 28 4
8 32 4
9 36 4
10 40 4
11 44 4
12 48 4
13 52 4
14 56 4
15 60 4
16 64 4
17 68 4
18 72 4
19 76 4
20 80 4
21 84 4
22 88 4
23 92 4
24 96 4
25 100 4
26 104 4
27 108 4
28 112 4
29 116 4
30 120 4
31 124 4
32 128 4
33 132 4
34 136 4
35 140 4
36 144 4
37 148 4
38 152 4
39 156 4
40 160 4
41 164 4
42 168 4
43 172 4
44 176 4
45 180 4
46 184 4
47 188 4
48 192 4
49 196 4
50 200 4
51 204 4
52 208 4
53 212 4
54 216 4
55 220 4
56 224 4
57 228 4
58 232 4
59 236 4
60 240 4
61 244 4
62 248 4
63 252 4
64 256 4
65 260 4
66 264 4
67 268 4
68 272 4
69 276 4
70 280 4
71 284 4
72 288 4
73 292 4
74 296 4
75 300 4
76 304 4
77 308 4
78 312 4
79 316 4
80 320 4
81 324 4
82 328 4
83 332 4
84 336 4
85 340 4
86 344 4
87 348 4
88 352 4
89 356 4
90 360 4
91 364 4
92 368 4
93 372 4
94 376 4
95 380 4
96 384 4
97 388 4
98 392 4
99 396 4
100 400 4
101 404 4
102 408 4
103 412 4
104 416 4
105 420 4
106 424 4
107 428 4
108 432 4
109 436 4
110 440 4
111 444 4
112 448 4
113 452 4
114 456 4
115 460 4
116 464 4
117 468 4
118 472 4
119 476 4
120 480 4
121 484 4
122 488 4
123 492 4
124 496 4
125 500 4
126 504 4
127 508 4
128 512 4
129 516 4
130 520 4
131 524 4
132 528 4
133 532 4
134 536 4
135 540 4
136 544 4
137 548 4
138 552 4
139 556 4
140 560 4
141 564 4
142 568 4
143 572 4
144 576 4
145 580 4
146 584 4
147 588 4
148 592 4
149 596 4
150 600 4
151 604 4
152 608 4
153 612 4
154 616 4
155 620 4
156 624 4
157 628 4
158 632 4
159 636 4
160 640 4
161 644 4
162 648 4
163 652 4
164 656 4
165 660 4
166 664 4
167 668 4
168 672 4
169 676 4
170 680 4
171 684 4
172 688 4
173 692 4
174 696 4
175 700 4
176 704 4
177 708 4
178 712 4
179 716 4
180 720 4
181 724 4
182 728 4
183 732 4
184 736 4
185 740 4
186 744 4
187 748 4
188 752 4
189 756 4
190 760 4
191 764 4
192 768 4
193 772 4
194 776 4
195 780 4
196 784 4
197 788 4
198 792 4
199 796 4
200 800 4
201 804 4
202 808 4
203 812 4
204 816 4
205 820 4
206 824 4
207 828 4
208 832 4
209 836 4
210 840 4
211 844 4
212 848 4
213 852 4
214 856 4
215 860 4
216 864 4
217 868 4
218 872 4
219 876 4
220 880 4
221 884 4
222 888 4
223 892 4
224 896 4
225 900 4
226 904 4
227 908 4
228 912 4
229 916 4
230 920 4
231 924 4
232 928 4
233 932 4
234 936 4
235 940 4
236 944 4
237 948 4
238 952 4
239 956 4
240 960 4
241 964 4
242 968 4
243 972 4
244 976 4
245 980 4
246 984 4
247 988 4
248 992 4
249 996 4
250 1000 4
251 1004 4
252 1008 4
253 1012 4
254 1016 4
255 1020 4
256 1024 4
257 1028 4
258 1032 4
259 1036 4
260 1040 4
261 1044 4
262 1048 4
263 1052 4
264 1056 4
265 1060 4
266 1064 4
267 1068 4
268 1072 4
269 1076 4
270 1080 4
271 1084 4
272 1088 4
273 1092 4
274 1096 4
275 1100 4
276 1104 4
277 1108 4
278 1112 4
279 1116 4
280 1120 4
281 1124 4
282 1128 4
283 1132 4
284 1136 4
285 1140 4
286 1144 4
287 1148 4
288 1152 4
289 1156 4
290 1160 4
291 1164 4
292 1168 4
293 1172 4
294 1176 4
295 1180 4
296 1184 4
297 1188 4
298 1192 4
299 1196 4
300 1200 4
301 1204 4
302 1208 4
303 1212 4
304 1216 4
305 1220 4
306 1224 4
307 1228 4
308 1232 4
309 1236 4
310 1240 4
311 1244 4
312 1248 4
313 1252 4
314 1256 4
315 1260 4
316 1264 4
317 1268 4
318 1272 4
319 1276 4
320 1280 4
321 1284 4
322 1288 4
323 1292 4
324 1296 4
325 1300 4
326 1304 4
327 1308 4
328 1312 4
329 1316 4
330 1320 4
331 1324 4
332 1328 4
333 1332 4
334 1336 4
335 1340 4
336 1344 4
337 1348 4
338 1352 4
339 1356 4
340 1360 4
341 1364 4
342 1368 4
343 1372 4
344 1376 4
345 1380 4
346 1384 4
347 1388 4
348 1392 4
349 1396 4
350 1400 4
351 1404 4
352 1408 4
353 1412 4
354 1416 4
355 1420 4
356 1424 4
357 1428 4
358 1432 4
359 1436 4
360 1440 4
361 1444 4
362 1448 4
363 1452 4
364 1456 4
365 1460 4
366 1464 4
367 1468 4
368 1472 4
369 1476 4
370 1480 4
371 1484 4
372 1488 4
373 1492 4
374 1496 4
375 1500 4
376 1504 4
377 1508 4
378 1512 4
379 1516 4
380 1520 4
381 1524 4
382 1528 4
383 1532 4
384 1536 4
385 1540 4
386 1544 4
387 1548 4
388 1552 4
389 1556 4
390 1560 4
391 1564 4
392 1568 4
393 1572 4
394 1576 4
395 1580 4
396 1584 4
397 1588 4
398 1592 4
399 1596 4
400 1600 27
401 1650 50
402 1700 50
403 1750 50.2122315
404 1800.424463 25.58306
405 1801.16612 0.7407425
406 1801.905948 0.738918
407 1802.643956 0.737102
408 1803.380152 0.7352955
409 1804.114547 0.733498
410 1804.847148 0.7317085
411 1805.577964 0.7299285
412 1806.307005 0.728157
413 1807.034278 0.7263935
414 1807.759792 0.724639
415 1808.483556 0.722893
416 1809.205578 0.7211555
417 1809.925867 0.719426
418 1810.64443 0.7177045
419 1811.361276 0.7159915
420 1812.076413 0.714287
421 1812.78985 0.7125905
422 1813.501594 0.710902
423 1814.211654 0.7092215
424 1814.920037 0.7075485
425 1815.626751 0.7058835
426 1816.331804 0.7042265
427 1817.035204 0.7025775
428 1817.736959 0.700936
429 1818.437076 0.699302
430 1819.135563 0.6976755
431 1819.832427 0.6960565
432 1820.527676 0.6944455
433 1821.221318 0.692842
434 1821.91336 0.6912455
435 1822.603809 0.6896565
436 1823.292673 0.688075
437 1823.979959 0.6865
438 1824.665673 0.6849325
439 1825.349824 0.6833725
440 1826.032418 0.6818195
441 1826.713463 0.6802735
442 1827.392965 0.678734
443 1828.070931 0.677202
444 1828.747369 0.675677
445 1829.422285 0.6741585
446 1830.095686 0.6726465
447 1830.767578 0.671142
448 1831.43797 0.669644
449 1832.106866 0.6681525
450 1832.774275 0.666668
451 1833.440202 0.6651895
452 1834.104654 0.663718
453 1834.767638 0.6622525
454 1835.429159 0.660794
455 1836.089226 0.659342
456 1836.747843 0.6578955
457 1837.405017 0.656456
458 1838.060755 0.655023
459 1838.715063 0.653596
460 1839.367947 0.652175
461 1840.019413 0.65076
462 1840.669467 0.6493515
463 1841.318116 0.6479495
464 1841.965366 0.646553
465 1842.611222 0.645162
466 1843.25569 0.6437775
467 1843.898777 0.6423995
468 1844.540489 0.641027
469 1845.180831 0.6396595
470 1845.819808 0.6382985
471 1846.457428 0.636944
472 1847.093696 0.6355945
473 1847.728617 0.6342505
474 1848.362197 0.632912
475 1848.994441 0.6315795
476 1849.625356 0.630253
477 1850.254947 0.628932
478 1850.88322 0.627616
479 1851.510179 0.6263055
480 1852.135831 0.625001
481 1852.760181 0.6237015
482 1853.383234 0.6224075
483 1854.004996 0.621119
484 1854.625472 0.6198355
485 1855.244667 0.6185575
486 1855.862587 0.617285
487 1856.479237 0.6160175
488 1857.094622 0.614755
489 1857.708747 0.6134975
490 1858.321617 0.6122455
491 1858.933238 0.610999
492 1859.543615 0.609757
493 1860.152752 0.60852
494 1860.760655 0.6072885
495 1861.367329 0.6060615
496 1861.972778 0.6048395
497 1862.577008 0.6036225
498 1863.180023 0.6024105
499 1863.781829 0.6012035
500 1864.38243 0.6000005
501 1864.98183 0.598803
502 1865.580036 0.5976105
503 1866.177051 0.596422
504 1866.77288 0.595239
505 1867.367529 0.5940605
506 1867.961001 0.592886
507 1868.553301 0.5917165
508 1869.144434 0.590552
509 1869.734405 0.589392
510 1870.323218 0.588236
511 1870.910877 0.587085
512 1871.497388 0.5859385
513 1872.082754 0.584796
514 1872.66698 0.583658
515 1873.25007 0.582525
516 1873.83203 0.581396
517 1874.412862 0.5802715
518 1874.992573 0.5791515
519 1875.571165 0.578035
520 1876.148643 0.576924
521 1876.725013 0.5758165
522 1877.300276 0.574713
523 1877.874439 0.5736145
524 1878.447505 0.57252
525 1879.019479 0.5714295
526 1879.590364 0.570343
527 1880.160165 0.5692605
528 1880.728885 0.5681825
529 1881.29653 0.5671085
530 1881.863102 0.566038
531 1882.428606 0.5649725
532 1882.993047 0.5639105
533 1883.556427 0.5628525
534 1884.118752 0.5617985
535 1884.680024 0.560748
536 1885.240248 0.559702
537 1885.799428 0.55866
538 1886.357568 0.5576215
539 1886.914671 0.556587
540 1887.470742
In order
Stress Strain Curve to
2000 visualize
1800 f(x) = 3.86 x + 27.84 the
R² = 0.99
1600 results, I
1400 first
1200
graphed
Stress
1000
800 Linear () the stress
600 strain
400 values:
200
0
0 100 200 300 400 500 600
Strain
As computed through the Central Difference Derivative, the slope of the curve at x=500 is about
0.6. Compared to the usual formula used in finding the approximation of derivative using the Central
Difference Derivative, with the presence of both a and y coordinates of the graph, it was easier to
determine its value just by subtracting the y values in between the respective y value of x=500 then
dividing it by h or in this case, can also be taken as ∆ x . Still, note that the formula used was still based
on the Central Difference Derivative Formula:
We can also observe in the graph that at around x=100 to about x=399, there is a straight diagonal line,
thus may have meant that there is a constant value for the slope. However, at the later points, there
were some small changes this, there could also be observable changes in the values of slopes. In fact,
starting from around x=405, the slope becomes closer and closer to 0 since the line is closer to becoming
a horizontal line and as we know, horizontal lines have slopes equal to 0.
Now in order to determine the area under the curve, I used the Trapezoidal Rule Approximation. Using
the Trapezoidal Rule denoted by:
or simply,
I was able to determine the area under the curve which is:
Trapezoidal Rule:
509751.365
Here, b was the last x value while a is the first x value. In other
terms these are the upper and lower boundaries, respectively. It was then multiplied by the sum of the y
value of the last x value which is 1887.470742 or f1 and the y value of the first x value which is 4 that
serves as the f0.