0% found this document useful (0 votes)
90 views8 pages

Problem Set 11: Numerical Difference EXERCISE 7. Solve The Following Problems Using Numerical Differentiation Approximation

The document contains solutions to numerical differentiation problems using finite difference approximations. It provides the function values at different points, calculates the derivatives using forward, backward, and centered difference formulas, and compares the exact and numerical derivatives to determine the error. For estimating second derivatives and higher order derivatives, it finds that the 5-point centered difference formula provides the most accurate results. It then computes first order central difference approximations for various functions at specified points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views8 pages

Problem Set 11: Numerical Difference EXERCISE 7. Solve The Following Problems Using Numerical Differentiation Approximation

The document contains solutions to numerical differentiation problems using finite difference approximations. It provides the function values at different points, calculates the derivatives using forward, backward, and centered difference formulas, and compares the exact and numerical derivatives to determine the error. For estimating second derivatives and higher order derivatives, it finds that the 5-point centered difference formula provides the most accurate results. It then computes first order central difference approximations for various functions at specified points.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Name: Jo Ann D.

Arranguez
Course, Year and Section: BSIE 2-E
Advance Mathematics
Problem Set 11: Numerical Difference

EXERCISE 7. Solve the following problems using Numerical Differentiation approximation.

1.) Estimate the derivative of ( ) at using


finite divided differences and a step size of
Solution:
( )
( )
( )

Function values:
x f(x)
x-2h 0 1.2
x-h 0.25 1.103516
x 0.5 0.925
x+h 0.75 0.636328
x+2h 1 0.2

Forward Difference
( ) ( )
( )
( )
Backward Difference
( ) ( )
( )
( )
Centered Difference
( ) ( )
( )
( )

Exact Numerical Error


Forward -0.9125 -0.859375 5.82%
Backward -0.9125 -0.878125 3.77%
Centered -0.9125 -0.9125 0.00%

Therefore, the centered difference yields a perfect result.

2.) Use centered difference approximations to estimate the first and second derivatives of
at for
Solution:

;
Function values:
Column1 x f(x)
x-2h 1.8 6.049647464
x-h 1.9 6.685894442
x 2 7.389056099
x+h 2.1 8.166169913
x+2h 2.2 9.025013499

1st derivative
 3-Points Center Difference Formula
( ) ( )
( )
( )

 5-Points Center Difference Formula


( ) ( ) ( ) ( )
( )
( )

2nd derivative
 3-Points Center Difference Formula
( ) ( ) ( )
( )
( )

 5-Points Center Difference Formula


( ) ( ) ( ) ( ) ( )
( )
( )

1st derivative
Method Exact Numerical Error
3PCDF 7.3890561 7.40137735 0.16675%
5PCDF 7.3890561 7.38903144 0.00033%
2nd derivative
Method Exact Numerical Error
3PCDF 7.3890561 7.3952157 0.08336%
5PCDF 7.3890561 7.38904788 0.00011%

Therefore, for the first and second derivative, the 5-Points Center Difference Formula or the 2nd
order central difference approximations provides the least error as compared to the other one.

3.) Compute the first order central difference approximations for each of the following functions at
the specified location and for the specified step size.
Solutions:
a.)
The Exact Value is:

Function values:
Column1 x f(x)
x-2h -0.5 -17.125
x-h -0.25 -16.015625
x 0 -15
x+h 0.25 -13.984375
x+2h 0.5 -12.875

The 1st order central difference is:

( ) ( ) ( ) ( )
( )
( ) ( )
( )
( )
( )

The corresponding Error is:

| |

| |

b.)

The Exact Value is:


( ) ( )

Function Values:
x f(x)
x-2h 0.2 0.039202663
x-h 0.3 0.085980284
x 0.4 0.147369759
x+h 0.5 0.21939564
x+2h 0.6 0.297120821

The 1st order central difference is:


( ) ( ) ( ) ( )
( )
( ) ( )
( )
( )
( )

The corresponding Error is:

| |

| |

c.) ( )

The Exact Value is:


( )

Function Values:
x f(x)
x-2h 2 0.786842889
x-h 2.5 1.100778369
x 3 1.557407725
x+h 3.5 2.338253564
x+2h 4 4.131728991

The 1st order central difference is:

( ) ( ) ( ) ( )
( )
( ) ( )
( )
( )
( )

The corresponding Error is:

| |

| |

( √ )
d.)
The Exact Value is:
( √ ) ( √ )

Function Values:
x f(x)
x-2h 0.6 0.629480393
x-h 0.8 0.540568549
x 1 0.479425539
x+h 1.2 0.433953583
x+2h 1.4 0.398354598

The 1st order central difference is:

( ) ( ) ( ) ( )
( )
( ) ( )
( )
( )
( )

The corresponding Error is:

| |

| |

e.)

The Exact Value is:

Function Values:
x f(x)
x-2h 1.6 6.553032424
x-h 1.8 7.849647464
x 2 9.389056099
x+h 2.2 11.2250135
x+2h 2.4 13.42317638

The 1st order central difference is:


( ) ( ) ( ) ( )
( )
( ) ( )
( )
( )
( )

The corresponding Error is:

| |

| |

Summary of results:
Exact Value Numerical Error
a 4 3.9998 0.005%
b 0.67454186 0.67450833 0.005%
c 1.14184 1.092487 4.322%
d -0.26003 -0.26028 0.096%
e 8.389056 8.388648 0.005%

4.) The objective of this problem is to compare second-order accurate forward, backward, and
centered finite-difference approximation of the first derivative of a function to the actual value
of the derivative. This will be done for ( )

a.) Use differential calculus to determine the correct value of the derivative at x=2.
( )
( )
( ) ( )

( )
( )

b.) To evaluate the centered finite-difference approximation start with . Thus, for the
first evaluation, the x values for the centered difference approximation will be
Then, decrease in increments of 0.01 down to a minimum value
of
h Central Error h Central Error h Central Error
0.5 -1.0430 0.6191 0.33 -1.0393 0.2622 0.16 -1.0373 0.0606
0.49 -1.0428 0.5934 0.32 -1.0392 0.2462 0.15 -1.0372 0.0533
0.48 -1.0425 0.5684 0.31 -1.0390 0.2308 0.14 -1.0371 0.0464
0.47 -1.0423 0.5439 0.30 -1.0389 0.2159 0.13 -1.0370 0.0400
0.46 -1.0420 0.5200 0.29 -1.0387 0.2015 0.12 -1.0370 0.0340
0.45 -1.0418 0.4968 0.28 -1.0386 0.1876 0.11 -1.0369 0.0286
0.44 -1.0415 0.4741 0.27 -1.0384 0.1743 0.1 -1.0369 0.0236
0.43 -1.0413 0.4520 0.26 -1.0383 0.1614 0.09 -1.0368 0.0191
0.42 -1.0411 0.4305 0.25 -1.0382 0.1491 0.08 -1.0368 0.0151
0.41 -1.0409 0.4096 0.24 -1.0381 0.1373 0.07 -1.0368 0.0166
0.4 -1.0407 0.3892 0.23 -1.0379 0.1260 0.06 -1.0367 0.0085
0.39 -1.0405 0.3694 0.22 -1.0378 0.1152 0.05 -1.0367 0.0059
0.38 -1.0403 0.3502 0.21 -1.0377 0.1048 0.04 -1.0367 0.0038
0.37 -1.0401 0.3315 0.20 -1.0376 0.0950 0.03 -1.0367 0.0021
0.36 -1.0399 0.3133 0.19 -1.0375 0.0857 0.02 -1.0366 0.0010
0.35 -1.0397 0.2958 0.18 -1.0374 0.0769 0.01 -1.0366 0.0003
0.34 -1.0395 0.2787 0.17 -1.0373 0.0685

c.) Repeat part (b) for the second-order forward & backward differences. (Note that these can
be done at the same time that the centered difference is computed in the loop.)

Second-order forward difference

h Forward Error h Forward Error h Forward Error


0.5 -1.0305 -0.5940 0.33 -1.0333 -0.3219 0.16 -1.0356 -0.0955
0.49 -1.0306 -1.5776 0.32 -1.0335 -0.3068 0.15 -1.0357 -0.0851
0.48 -1.0308 -0.5612 0.31 -1.0336 -0.2918 0.14 -1.0359 -0.0752
0.47 -1.0310 -0.5449 0.30 -1.0338 -0.2769 0.13 -1.0359 -0.0658
0.46 -1.0312 -0.5286 0.29 -1.0339 -0.2623 0.12 -1.0360 -0.0569
0.45 -1.0313 -0.5123 0.28 -1.0341 -0.2478 0.11 -1.0361 -0.0485
0.44 -1.0315 -0.4961 0.27 -1.0342 -0.2336 0.1 -1.0362 -0.0406
0.43 -1.0317 -0.4799 0.26 -1.0344 -0.2196 0.09 -1.0363 -0.0334
0.42 -1.0318 -0.4637 0.25 -1.0345 -0.2058 0.08 -1.0364 -0.0268
0.41 -1.0320 -0.4476 0.24 -1.0346 -0.1923 0.07 -1.0365 -0.0208
0.4 -323.0000 -0.4316 0.23 -1.0348 -0.1790 0.06 -1.0365 -0.0155
0.39 -1.0323 -0.4156 0.22 -1.0349 -0.1661 0.05 -1.0366 -0.0109
0.38 -1.0325 -0.3997 0.21 -1.0350 -0.1534 0.04 -1.0366 -0.0071
0.37 -1.0327 -0.3839 0.20 -1.0352 -0.1411 0.03 -1.0366 -0.0040
0.36 -1.0328 -0.3683 0.19 -1.0353 -0.1291 0.02 -1.0366 -0.0018
0.35 -1.0330 -0.3527 0.18 -1.0354 -0.1175 0.01 -1.0366 -0.0004
0.34 -1.0331 -0.3373 0.17 -1.0356 -0.1063

Second-order backward difference

h Backward Error h Backward Error h Backward Error


0.5 -1.0089 -2.6784 0.33 -1.0276 -0.8680 0.16 -1.0350 -0.1544
0.49 -1.0104 -2.5267 0.32 -1.0283 -0.8026 0.15 -1.0352 -0.1336
0.48 -1.0119 -2.3818 0.31 -1.0290 -0.7406 0.14 -1.0324 -0.1145
0.47 -1.0134 -2.2434 0.30 -1.0296 -0.6821 0.13 -1.0356 -0.0972
0.46 -1.0147 -2.1113 0.29 -1.0301 -0.6268 0.12 -1.0358 -0.0815
0.45 -1.0161 -1.9852 0.28 -1.0307 -0.5747 0.11 -1.0359 -0.0674
0.44 -1.0173 -1.8649 0.27 -1.0312 -0.5256 0.1 -1.0361 -0.0549
0.43 -1.0185 -1.7501 0.26 -1.0317 -0.4794 0.09 -1.0362 -0.0438
0.42 -1.0196 -1.6408 0.25 -1.0321 -0.4360 0.08 -1.0363 -0.0340
0.41 -1.0207 -1.5366 0.24 -1.0325 -0.3953 0.07 -1.0364 -0.0257
0.4 -1.0217 -1.4375 0.23 -1.0329 -0.3572 0.06 -1.0364 -0.0186
0.39 -1.0227 -1.3431 0.22 -1.0333 -0.3215 0.05 -1.0365 -0.0127
0.38 -1.0236 -1.2533 0.21 -1.0336 -0.2882 0.04 -1.0365 -0.0080
0.37 -1.0245 -1.1680 0.20 -1.0340 -0.2572 0.03 -1.0366 -0.0040
0.36 -1.0254 -1.0870 0.19 -1.0343 -0.2284 0.02 -1.0366 -0.0019
0.35 -1.0262 -1.0101 0.18 -1.0345 -0.2018 0.01 -1.0366 -0.0005
0.34 -1.0269 -0.9371 0.17 -1.0348 -0.1771

d.) Plot the results of (b) and (c) versus x. Include the exact result on the plot for comparison.

Therefore, the three methods yield the same result with the exact result.

You might also like