Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

CE50P-2/E01

Date:: 24/07/20
Date 05/06/20
Gonzaga, Vinz Scott Pangilinan
NUMERICAL CE-2
2018100253 DIFFERENTIATION AND
INTEGRATION
01/07/2020

Numerical Differentation Numerical Differentation


Ex a m p l e CW3 A (p a g e 1 o f CW3 )
Using 𝐷 ℎ 𝑓 of (6), approximate the derivative of the Compute for the derivative of 𝑓(𝑥)=cos𝑥 at 𝑥= /6 by
function 𝑓 𝑥 = 𝑒 𝑥 at 𝑥 = 0. Results for various values a) Forward Difference Formula
of ℎ are given in Table 3. b) Central Difference Formula
Table 3 c) Backward Difference Formula
h 𝐷 ℎ E r r o r R a t i o
Use the following for the values of
0 . 2 0 0 0 0 0 . 9 0 6 3 5 0 .0 9 3 6 5 0 .0 0 0 0 0
0 . 1 0 0 0 0 0 . 9 5 1 6 3 0 .0 4 8 3 7 1 .9 3 6 0 3 ℎ=0.1
0 . 0 5 0 0 0 0 . 9 7 5 4 1 0 .0 2 4 5 9 1 .9 6 7 3 5 =0.05 Upload Word file of CW3
Filename: CW3-Surname
0 . 0 2 5 0 0 0 . 9 8 7 6 0 0 .0 1 2 4 0 1 .9 8 3 5 1 =0.025 CW3A-Page1: Nu m e ri c a l D i ffe re n t i a t i o n
0 . 0 1 2 5 0 0 . 9 9 3 7 8 0 .0 0 6 2 2 1 .9 9 1 7 1 =0.0125 CW3B-Page2: Nu m e ri c a l In t e g ra t i o n
Solution could be presente d by using
=0.00625 Word-Equation Tool or handwritten

13 14

Numerical Differentation
LA3 -S HEE T1
Compute for the derivative of 𝑓(𝑥)=cos𝑥 at 𝑥= /6 by
a) Forward Difference Formula
b) Central Difference Formula
c) Backward Difference Formula
Use the following for the values of
ℎ=0.1
=0.05 Upload Excel file of LA3
Filename: LA3-Surname
=0.025 LA3-Sheet1: Nu m e ri c a l D i ffe re n t i a t i o n
=0.0125 LA3-Sheet2: Nu m e ri c a l In t e g ra t i o n
Formula should be inserted to cells for
=0.00625 each Table presented

15

3
Given:
π
f ( x )=cos ⁡(x ) at x=
6

f ' ( x )=−sin ( x )=−0.5000000000

a. Forward Difference Formula


f ( x +h ) −f ( x )
DhF=
h

h DhF

0.1
cos ( π6 + 0.1)−cos ⁡( π6 ) =−0.542432281
0.1

0.05
cos ( π6 + 0.05)−cos ⁡( π6 )=−0.521437818
0.05

0.025
cos ( π6 + 0.025)−cos ⁡( π6 )=−0.510772672
0.025

0.0125
cos ( π6 + 0.0125)−cos ⁡( π6 )=−0.505399568
0.0125

0.00625
cos ( π6 + 0.00625)−cos ⁡( π6 )=−0.502703065
0.00625

h DhF Error Ratio

0.1 -0.542432281 0.0424322811 0.0000000


0.05 -0.521437818 0.0214378176 1.9793191
0.025 -0.510772672 0.0107726720 1.9900186
0.0125 -0.505399568 0.0053995676 1.9950990
0.00625 -0.502703065 0.0027030654 1.9975719

b. Central Difference Formula


f ( x +h ) −f ( x−h )
D Ch =
2h

h D Ch

0.1
cos ( π6 + 0.1)−cos( π6 −0.1) =−0.499167083
2 ( 0.1 )

0.05
cos ( π6 + 0.05)−cos ( π6 −0.05 ) =−0.499791693
2 ( 0.05 )

0.025
cos ( π6 + 0.025)−cos ( π6 −0.025) =−0.499947918
2 ( 0.025 )

0.0125
cos ( π6 + 0.0125)−cos( π6 −0.0125 ) =−0.499986979
2 ( 0.0125 )

0.00625
cos ( π6 + 0.00625)−cos ⁡( π6 −0.00625) =−0.499996745
2( 0.00625)
h D Ch Error Ratio

0.1 -0.499167083 -0.00083291676 0


0.05 -0.499791693 -0.00020830729 3.99850028
0.025 -0.499947918 -0.00005208170 3.999625101
0.0125 -0.499986979 -0.00001302073 3.99990659
0.00625 -0.499996745 -0.00000325520 3.9999779212

c. Backward Difference Formula


f ( x )−f ( x−h )
DBh =
h

h DBh

0.1
cos ( π6 )−cos( π6 −0.1) =−0.455901885
0.1

0.05
cos ( π6 )−cos( π6 −0.05) =−0.478145568
0.05

0.025
cos ( π6 )−cos( π6 −0.025) =−0.489123165
0.025
0.0125
cos ( π6 )−cos( π6 −0.0125) =−0.494574391
0.0125

0.00625
cos ( π6 )−cos( π6 −0.00625) =−0.497290424
0.00625

h DBh Error Ratio

0.1 -0.455901885 -0.04409811459 0


0.05 -0.478145568 -0.02185443221 2.01781104
0.025 -0.489123165 -0.01087683544 2.009263846
0.0125 -0.494574391 -0.00542560903 2.00472157
0.00625 -0.497290424 -0.00270957578 2.0023832039
CW3B
01/07/2020

Numerical Integration Numerical Integration


Ex am p le CW3 B (p a g e 2 o f CW3 )
T R A P E Z O ID A L R U L E IM 1 / 3 L E Approximate the integral using
i x f(x ) w t * f(x ) i x f( x ) w t * f(x )
0 1 2 .7 1 8 3 1 .3 5 9 1 0 1 2 .7 1 8 3 0 .9 0 6 1 a) Trapezoidal Rule
1 1 .2 4 .2 2 0 7 4 .2 2 0 7 1 1 .2 4 .2 2 0 7 5 .6 2 7 6 b) Sim 1/3 Rule
2 1 .4 7 .0 9 9 3 7 .0 9 9 3 2 1 .4 7 .0 9 9 3 4 .7 3 2 9
3 1 .6 1 2 .9 3 5 8 1 2 .9 3 5 8 3 1 .6 1 2 .9 3 5 8 1 7 .2 4 7 8
4 1 .8 2 5 .5 3 3 7 2 5 .5 3 3 7 4 1 .8 2 5 .5 3 3 7 1 7 .0 2 2 5 𝑑𝑥
5 2 5 4 .5 9 8 2 5 4 .5 9 8 2 5 2 5 4 .5 9 8 2 7 2 .7 9 7 5 , 𝑛 = 10
6 2 .2 1 2 6 .4 6 9 4 1 2 6 .4 6 9 4 6 2 .2 1 2 6 .4 6 9 4 8 4 .3 1 2 9 0 1+ 𝑥
7 2 .4 3 1 7 .3 4 8 3 3 1 7 .3 4 8 3 7 2 .4 3 1 7 .3 4 8 3 4 2 3 .1 3 1 1
8 2 .6 8 6 2 .6 4 2 2 8 6 2 .6 4 2 2 8 2 .6 8 6 2 .6 4 2 2 5 7 5 .0 9 4 8 Upload Word file of CW3
9 2 .8 2 5 4 0 .2 0 4 8 2 5 4 0 .2 0 4 8 9 2 .8 2 5 4 0 .2 0 4 8 3 3 8 6 .9 3 9 8 Filename: CW3-Surname
1 0 3 8 1 0 3 .0 8 3 9 4 0 5 1 .5 4 2 0 1 0 3 8 1 0 3 .0 8 3 9 2 7 0 1 .0 2 8 0 CW3A-Page1: Nu m e ri c a l D i f f e re n t i a t i o n
a p p r o x = 1 4 3 8 . 7 4 7 1 a p p r o x = 1 4 4 2 .2 1 0 5 CW3B-Page2: Nu m e ri c a l In t e g ra t i o n
e r r o r = 4 .3 3 5 3 e r r o r = 0 .8 7 2 0 Solution could be presented by using
Word-Equation Tool or handwritten

13 14

Numerical Integration
LA3 -S HE E T2
Approximate the integral using
a) Trapezoidal Rule
b) Sim 1/3 Rule

𝑑𝑥
, 𝑛 = 10
0 1+ 𝑥
Upload Excel file of LA3
Filename: LA3-Surname
LA3-Sheet1: Nu m e ri c a l D i f f e re n t i a t i o n
LA3-Sheet2: Nu m e ri c a l In t e g ra t i o n
Formula should be inserted to cells for
each Table presented

15

a. TRAPEZOIDAL RULE

C T N ( f ) ≈T n ( f ) + E Tn ( f )
h
T n ( f )=h ( f ( x ) +2 f ( x 1 ) ⋯+ 2 f ( x n−1 ) + f ( x n ) ] )
2[ 0
b−a
h=
n

T h2 ' ( ) ' ( )
En ≈− [ f b −f a ]
12

i x f(x) wt × f(x)
0 0 1 0.5
1 0.4 0.862068966 0.862068966
2 0.8 0.609756098 0.609756098
3 1.2 0.409836066 0.409836066
4 1.6 0.280898876 0.280898876
5 2 0.2 0.2
6 2.4 0.147928994 0.147928994
7 2.8 0.113122172 0.113122172
8 3.2 0.088967972 0.088967972
9 3.6 0.071633238 0.071633238
10 4 0.058823529 0.029411765
Approx 1.325818747
Error -1.0832E-06
T 1.325449658
E 0.000369089
Actual 1.325817664

1 1
Wt × f ( x 0 ) =
( )2 1+ 02
=0.5

Wt × f ( x )=1
5
( 1+21 )=0.2
2

1 1
2 ( 1+ 4 )
Wt × f ( x )=
10 =0.029411765
2

10
T n ( f )=h × ∑ ( Wt × f ( x ) )i=1.325449658
i=0

ETn ( f )=0.000369089
¿=1.325449658+ 0.000369089=1.325818747
Error= Actual−¿=1.325817664−1.325818747=0.000369089
B. SIMPSONS’S 1/3 RULE

C S N ( f ) ≈ Sn ( f ) + E Sn ( f )
h
Sn ( f ) =h( f ( x 0 ) +4 f ( x odd ) +2 f ( x even ) +f ( x n ) ] )
3[
b−a
h=
n

S h 4 ' '' ( ) ' '' ( )


En ( f ) ≈− [f b −f a ]
180
i x f(x) wt × f(x)
0 0 1 0.333333333
1 0.4 0.862068966 1.149425287
2 0.8 0.609756098 0.406504065
3 1.2 0.409836066 0.546448087
4 1.6 0.280898876 0.187265918
5 2 0.2 0.266666667
6 2.4 0.147928994 0.098619329
7 2.8 0.113122172 0.150829563
8 3.2 0.088967972 0.059311981
9 3.6 0.071633238 0.095510984
10 4 0.058823529 0.019607843
Approx 1.325406771
Error 0.000410893
T 1.325409223
E -2.45208E-06
Actual 1.325817664

1 1
Wt × f ( x 0 ) =
( )
3 1+02
=0.333333333
4 1
Wt × f ( x 5 )=
( )3 1+ 22
=0.266666667

2 1
3 ( 1+2 )
Wt × f ( x ) =
6 =0.098619329
2

1 1
3 ( 1+ 4 )
Wt × f ( x )=
10 =0.019607843
2

10
T n ( f )=h × ∑ ( Wt × f ( x ) )i=1.325409223
i=0

ETn ( f )=−2.45208E-06

¿=1.325409223+(−2.45208E-06)=1.325406771
Error= Actual−¿=1.325817664−1.325406771=0.000410893

You might also like