LA3 Numerical Differentiation and Integration Numerical Differentiation

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 4

CE50P-2/E01

Garcia, Sofia Isabelle G. July, 23, 2020


2018103501

LA3
NUMERICAL DIFFERENTIATION AND INTEGRATION
Numerical Differentiation
h
0.1
0.05
0.025
0.0125
0.00625

f(x)=cosx x= 0.5235987755983
f'(x)=-sinx
f'(pi/6)= -0.5

Forward Difference Formula

Forward Difference
h DF
Error Ratio
0.1 -0.54243 0.04243 0.00000
0.05 -0.52144 0.02144 1.97932
0.025 -0.51077 0.01077 1.99002
0.0125 -0.50540 0.00540 1.99510
0.00625 -0.50270 0.00270 1.99757

Central Difference Formula

Central Difference
h DC Error Ratio
0.1 -0.49917 0.00083 0.00000
0.05 -0.49979 0.00021 3.99850
0.025 -0.49995 0.00005 3.99963
0.0125 -0.49999 0.00001 3.99991
0.00625 -0.50000 0.00000 3.99998
Backward Difference

Backward Difference
h DB Error Ratio
0.1 -0.45590 0.04410 0.00000
0.05 -0.47815 0.02185 2.01781
0.025 -0.48912 0.01088 2.00926
0.0125 -0.49457 0.00543 2.00472
0.00625 -0.49729 0.00271 2.00238
CE50P-2/E01
Garcia, Sofia Isabelle G. July, 23, 2020
2018103501

LA3
NUMERICAL DIFFERENTIATION AND INTEGRATION
Numerical Integration

Given Problem

Actual Value 1.3258


f'(a)= 0
f'(b)= -0.0276816609
Trapezoidal Error= 0.000369088812

n 10
a 0
b 4
h 0.4

Trapezoidal Rule
i x f(x) wt * f(x)
0 0 1.0000 0.5000
1 0.4 0.8621 0.8621
2 0.8 0.6098 0.6098
3 1.2 0.4098 0.4098
4 1.6 0.2809 0.2809
5 2 0.2000 0.2000
6 2.4 0.1479 0.1479
7 2.8 0.1131 0.1131
8 3.2 0.0890 0.0890
9 3.6 0.0716 0.0716
10 4 0.0588 0.0294
Approximation 1.3258
Error 0.0000
f'''(a)= 0
f'''(b)= -0.017241172879
Simpson's Error= -2.452077921E-06

Simpson's Error
i x f(x) wt * f(x)
0 0 1.0000 0.3333
1 0.4 0.8621 1.1494
2 0.8 0.6098 0.4065
3 1.2 0.4098 0.5464
4 1.6 0.2809 0.1873
5 2 0.2000 0.2667
6 2.4 0.1479 0.0986
7 2.8 0.1131 0.1508
8 3.2 0.0890 0.0593
9 3.6 0.0716 0.0955
10 4 0.0588 0.0196
Approximation 1.3254
Error 0.0004

You might also like