0% found this document useful (0 votes)
131 views24 pages

CE-NSP224 - Module 7 - Numerical Differentiation

Module 7 of CE-NSP224 focuses on numerical differentiation techniques, including methods for both equally and unequally spaced data. It covers various approaches such as two-point forward and backward methods, central difference, and polynomial fitting for approximating derivatives. The module also includes practical exercises for calculating derivatives and their corresponding percent errors using different increment sizes.

Uploaded by

johnemmanueltano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
131 views24 pages

CE-NSP224 - Module 7 - Numerical Differentiation

Module 7 of CE-NSP224 focuses on numerical differentiation techniques, including methods for both equally and unequally spaced data. It covers various approaches such as two-point forward and backward methods, central difference, and polynomial fitting for approximating derivatives. The module also includes practical exercises for calculating derivatives and their corresponding percent errors using different increment sizes.

Uploaded by

johnemmanueltano
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 24
CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) Module 7: Numerical Differentiation Prepared By: Engr Carles Migue! imat, Ch. E. Topic Outline Q Introduction QQ Differentiation for Equally Spaced Data © Two-Point Forward Approach © Two-Point Backward Approach Central Difference Approach Ql Differentiation for Spaced Data © Using Direct-Fit Polynomials © Using Lagrange Polynomials © Divided Difference Polynomials Unequally INTRODUCTION Q@—Calculus is an essential mathematical tool that engineers must continuously deal with various systems and process where change is prominent. Q Recall that Calculus mainly deals with two essential mathematical process such as differentiation and integration. DIFFERENTIATION PROCESS The process of obtaining the derivative of a function is known as the differentiation. (~The mathematical process of differentiating means “to mark off by differences in or between. Hence, the derivative is known for its representation of the rate of change of a dependent variable with respect to an independent variable. Fundamentally, the derivative begins by a difference approximation definition as: Ay _ f+ Ax ax ix Fe) Where: x = independent variable y = dependent variable Recall from Calculus that the derivative of a given function continuous at some interval can be expressed as: ee ee pie ESIGN) MSP OO= Ge go Ax anno ox Forms of Functions and Approaches for Differenti mn The function to be differentiated will typically be in one of the following three forms: 1. A simple continuous function such as a polynomial, an exponential, or a trigonometric function — analytical or elementary methocs. 2. A complicated continuous function that 's difficult or impossible to differentiate Directly - approximate methods. 3. A tabulated function, where values of x and /(x) are given at a number of discrete points, as is often the case with experimental or field data - approximate methods. Notes: Some of the models may not represent a single function due to the discrete nature of the models. If modeled, this may lead to inaccurate calculation of derivatives at a certain point. Q Here, approximation of derivatives Catt be dune numerically Uirough approximation formulas and approaches. Q One of the approximation methods for differentiation is the use of difference approaches including divided differences. TO ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red by: Engr Carlos Miguel C Dacaimat Q Differentiation is a common mathematical tool in engineering in order to characterize the changes of variables quantitatively commonly in both time and space. 2 In fact, many of the laws and other generalizations that figure so prominently in our work are based on the predictable ways in which change manifests itself in the physical world. Example Mustration Mathematical Model 1. Newton’s Law of Motion Foma 2. Fouriers Law of Heat Conduction ax DIFFERENTIATION FOR EQUALLY SPACED DATA G2 For a data set to be equally spaced, the difference between x-values are equal and equidistant by a quantity h (or Ax) also known as the step size (or increment size). R= Xie ~ A. Two-Point Forward Approach Q Given either a continuous or discrete function with a step size Ax = x11 — x; oF h, the derivative of a given function f(x) at x = x; are follows: First Derivative: fie ~ po = Me FGixs) = Fd Second pre = f2 Mf fea) =A Gra) + FED Derivative: x) =f == Third eon (e)=TE) TEI TED) Derivative: i Conve: | Fre = Bf 8 a) 0 a+ a= MCI=TCD Where: ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE B. Two-P. kward Aj h Given cither a continuous or discrete function with a step size Ax = x, 1-1 oF hy the derivative of a given function f(x) at x = x; are follows: First Derivative: FG) =f Th _ feo ees Seanad, 7 @ Uh _fed— 7d + fed Derivative: PQ) =f? =pa= Tale (qi) = FO =O _ FD =H) + a) — Fees) Derivative: PG =f =x a Fourth Vfi i) — 4 ia) + 6f (Xia) — FH a ae pega) = fo = Th HO = Mie) + 6 Gea) — Mica) +10) Where: Di i Given either a continuous or discrete function with a step size Ax ‘iv — Xj OF Ax = x,— xi. oF h, the derivative of a given function f(x) at x = x, are follows: First Derivative: fa) = fO= EY Second Giza) — 2F ed) + Fa) Derivative: fcap = fo) = Ren Ley Third Derivative: Ped = f° ia) — Fina) + 6 i) — Fa) + FO Four | porcay pL Te) FG) MDE) Where; xin =a; +h Ming =a; + 2h Xj =x—h x 2 =x; —2h Calculation of Error Value (Relative Error): Inorder to determine the validity of approximation, relative error (as a percentage) can be calculated as: \Estimated Value — True Value| % Error = —————_—_" "x 100% True Value 2 Fstimated values is hased on the numerical derivative approximation. Whereas, the true value can be obtained using elementary or analytical methods in Calculus, if possible. ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 1. Approximate using forward difference approach the first derivative of the given function f(x) = e~* — cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (@)h=05 (b)h=0.25 @h=01 (@)h=0.05 (eh = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 @h=0.0005 Gj) h= 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 2. Approximate using backward difference approach the first derivative of the given function f(x) = e~* — cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 3. Approximate using central difference approach the first derivative of the given function f(x) = e~* ~ cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 4. Approximate using forward difference approach the first derivative of the given function f(x) = 2e”* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 5. Approximate using backward difference approach the first derivative of the given function f(x) = 2e”* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 6. Approximate using central difference approach the first derivative of the given function f(x) = 2e”* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 7. Approximate using forward difference approach the second derivative of the given function f(x) = e~* ~ cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 8. Approximate using backward difference approach the second derivative of the given function f(x) = e~* — cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 9. Approximate using central difference approach the second derivative of the given function f(x) = e~* ~ cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 10. Approximate using forward difference approach the second derivative of the given function f(x) = 2e”* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 11.Approximate using backward difference approach the second derivative of the given function f(x) = 2e?* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 12. Approximate using central difference approach the second derivative of the given function f(x) = 2e* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 13. Approximate using forward difference approach the third derivative of the given function f(x) — e~* — cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (@h=05 (b)h=0.25 (Oh=01 (d)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h=0.005 (h)h=0.001 (ih = 0.0005 (jh = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 14. Approximate using backward difference approach the third derivative of the given function f(x) = e~* — cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 15. Approximate using central difference approach the third derivative of the given. function f(x) = e~* ~ cos x at x = 1 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 16. Approximate using forward difference approach the third derivative of the given function f(x) = 2e”* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 17. Approximate using backward difference approach the third derivative of the given function f(x) = 2e?* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 18. Approximate using central difference approach the third derivative of the given function f(x) = 2e”* — 7x? at x = 2 using the following increment size. Calculate the percent error on each approximation. (a)h=05 — (b)h=0.25 (h=0.1 (@)h=0.05 (e)h = 0.025 (fh = 0.01 (g)h = 0.005 (h) h = 0.001 (i) h = 0.0005 i) h = 0.0001 ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE DIFFERENTIATION FOR UNEQUALLY SPACED DATA Q Fora data set to be unequally spaced, the difference between x-values is no longer equal and equidistant. NF Xigs — Mi FX Xia A. Using Direct Fit Polynomials Q This method is based on fitting the data directly by a polynomial and then differentiating the polynomial. Recall from previous module that the direct fit polynomial can be written as: Py(X) = dy + ayx + ax? + + + a,x” Q The polynomial P,(x) is determined by one of the following methods: 1. Regression (by Least Squares Method) - see Module 5 2. Interpolation - see Module 6 B. Using Lagrange Polynomials This method is based on obtaining the Lagrange Polynomial and then differentiating the polynomial - see Module 6 C. Using Divided Difference Polynomials Q This method is based on obtaining the Divided Difference Polynomial and then differentiating the polynomial - see Module 6 ‘Sample Problems 1. Given a set of data points: (—3,0), (1,2), (0, -2), (1,3) and (3,-1). Estimate the first- derivative value when x = 2 using an approximation polynomial obtained by: a) Direct-fit interpolation. b) Lagrange interpolation. ©) Divided Difference interpolation. d) Linear Spline Interpolation ©) Quadratic Spline Interpolation f) Linear regression. g) Quadratic regression. ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 2. Given a set of data points: (—3,0),(-1,2),(0,-2),(1,3) and (3,1). Estimate the second-derivative value when x = 0.5 using an approximation polynomial obtained by: a) Direct fit interpolation. b) Lagrange interpolation. c) Divided Difference interpolation. d) Linear Spline Interpolation e) Quadratic Spline Interpolation f) Linear regression. 9) Quadratic regression. ‘CE-NSP224 (NUMERICAL SOLUTIONS TO CE PROBLEMS) ‘MODULE 7: NUMERICAL DIFFERENTIATION red ty: Engr Carlos Miguel C_Dacaimat. ChE 3. Given a set of data points: (—3,0),(-1,2),(0,—2), (1,3) and (3,-1). Estimate the second-derivative value when x = —2.5 using an approximation polynomial obtained by: a) Direct fit interpolation. b) Lagrange interpolation. c) Divided Difference interpolation. d) Linear Spline Interpolation e) Quadratic Spline Interpolation f) Linear regression. 9) Quadratic regression.

You might also like