SKMM 3023 Applied Numerical Methods

Size: px
Start display at page:

Download "SKMM 3023 Applied Numerical Methods"

Transcription

1 UNIVERSITI TEKNOLOGI MALAYSIA SKMM 3023 Applied Numerical Methods Numerical Differentiation ibn Abdullah Faculty of Mechanical Engineering Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 1 / 57

2 Outline 1 Introduction 2 Engineering Applications 3 Finite Difference Approximation Derivative Defined Taylor Series & Difference Formulae Centred Difference Formulae Richardson Extrapolation 4 Finite Difference in PDE 5 Curve-Fitting & Interpolation Collocation-Polynomials Fit Lagrange Polynomials Least Square Curve Fitting Divided Difference Polynomials 6 Bibliography Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 2 / 57

3 Introduction Why/When? 1 Finite Difference Approximation complex differential equations in many engineering applications, e.g. wave equation 1 2 u c 2 t = 2 u 2 x + 2 u 2 y + 2 u 2 z = 2 2 u may require numerical solutions due to presence of complex geometry, complicated boundary conditions, nonlinearity, large number of simultaneous differential equations, etc. 2 Polynomial Interpolation differentiation of discrete data, e.g. from experimental results tabulated below, requires an approximate numerical procedure. x y x y x y Exact Differentiation of known functions through differential calculus, e.g. distance traversed at a constant acceleration s = ut at2 where ds dt = v and d 2 s dt = dv 2 dt = a Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 3 / 57

4 Introduction Finite Difference Approximation Differential equations in many engineering applications require numerical solutions due to presence of complex geometry and/or complicated boundary conditions nonlinearity and/or large number of simultaneous differential equations, etc. as in 1 2 u c 2 t = 2 u 2 x + 2 u 2 y + 2 u 2 z = 2 2 u Derivatives in these differential equations are replaced by their discrete forms, known as finite-difference approximations. Use of finite-differences transforms an ordinary differential equation into an algebraic equation Taylor series used in computing derivatives using discrete methods is cumbersome for approximations of increasingly high accuracy or higher-order derivatives Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 4 / 57

5 Introduction Polynomial Interpolation If a function is very complicated or known only from values in a table (e.g. from experiments), it may be necessary to resort to numerical differentiation. In cases especially where data are obtained experimentally it is best to perform a least squares curve fit to data and then find the resulting polynomial. Formulae for numerical differentiation may easily be obtained by differentiating interpolation polynomials. The essential idea is that the derivatives f, f,... of a function are represented by the derivatives P n, P n,... of the interpolating polynomial P n more on this towards the end! Figure 1: Interpolating polynomial. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 5 / 57

6 Introduction Errors in Numerical Differentiation Numerical differentiation is avoided wherever it is possible because of several inherent difficulties: Integration describes an overall property of a function, whereas differentiation describes the slope of a function at a point. Integration is not sensitive to minor changes in the shape of a function, whereas differentiation is. Any small changes in a function can easily create large changes in its slope in the neighborhood of the change. Compared to integration, numerical differentiation is less reliable. Large errors may also occur in numerical differentiation based on Taylor series, which is cumbersome for approximations of high accuracy or higher-order derivatives. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 6 / 57

7 Engineering Applications Example 1 Problem Statement: The barrel and the recoil mechanism of a cannon, Figure 2, have a mass of 500 kg with a recoil spring stiffness of N/m. The response of the cannon, with a critically damped recoil mechanism, is given by x(t) = (c 1 + c 2t) ωnt (1) where c 1 = x 0, c 2 = ẋ 0 + ω nx 0, x 0 is the initial displacement, ẋ 0 is the initial velocity, and ω n = p k/m is the undamped natural frequency of the system. Figure 2: Recoil mechanism of a cannon. Find the recoil velocity of the cannon using numerical differentiation with x 0 = 0 and ẋ 0 = 5 m/s. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 7 / 57

8 Engineering Applications Example 2 Figure 3: Tilt thrust bearing. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 8 / 57

9 Engineering Applications Example 2 Problem Statement: The load carrying capacity of a tilt thrust bearing (P), shown in Figure 3, is given by j» ff 6µ(U1 U2)lb2 1 2(m 1) P = ln m (2) h 2 2 (m 1) 2 m + 1 where U 1 = surface velocity of the supporting plate, U 2 = surface velocity of the pad, m = h 1 /h 2 = tilt ratio, b = length of the lubricant flow path, h 1 = film thickness at entrance, h 2 = film thickness at exit, µ = viscosity of the lubricant, l = length of the bearing. The change in the load due to a small change in the tilt ratio, given by dp/dm, will be of interest from a design point of view. Find the value of dp/dm for the following data: b = 3.0 in h 1 = 0.10 in P = 5000 lb U 1 U 2 = 150 in/sec l = 1.5 in h 2 = 0.05 in µ = reyn Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 9 / 57

10 Engineering Applications Example 3 Problem Statement: The pressure (p) specific volume (v) relationship of superheated water vapour at 350 C is given by van der Waals equation where p = RT v b a v 2 (3) T = absolute temperature = K a = R = specific gas constant = kj/kg-k b = Expand the pressure in Taylor s series and estimate the value of p at v = 0.051, 0.054, and assuming that the value of p and its derivatives are known at v = Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 10 / 57

11 Finite Difference Approximation Derivative Defined Derivative of a function f(x) is defined as df(x) = f f(x + h) f(x) (x) = lim dx h 0 h x (4) where h is the step size, or a small increment x, and does not approach zero but remains a finite quantity. As h = x, Eq. (4) can also be written as f (x) f(x + x) f(x) x (5) Figure 4: Derivative defined. Given a function f(x), we wish to approximate its derivatives at a point x using the Taylor Series. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 11 / 57

12 Finite Difference Approximation Taylor Series Expansions For positive step sizes +h and +2h, forward Taylor series expansion gives f(x + h) = f(x) + h 1! f (x) + h2 2! f (x) + h3 3! f (x) + h4 4! f (x) +... (6) f(x + 2h) = f(x) + (2h) 1! f (x) + (2h)2 2! f (x) + (2h)3 3! f (x) + (2h)4 f (x) +... (7) 4! For negative step sizes h and 2h, backward Taylor series expansion gives f(x h) = f(x) + ( h) 1! f(x 2h) = f(x) + ( 2h) 1! f (x) + ( h2 ) 2! f (x) + ( 2h)2 2! f (x) + ( h3 ) 3! f (x) + ( 2h)3 3! f (x) + ( h4 ) f (x) +... (8) 4! f (x) + ( 2h)4 f (x) ! (9) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 12 / 57

13 Finite Difference Approximation Forward and backward FD of First Derivative to O(h) Accuracy Solving Eq. (6) for (df(x)/dx) i,j df(x) dx = f (x) = = f(x + h) f(x) f f (h) {z h } 2! 3! (h)2... {z } finite difference truncation error, O(h) f(x + h) f(x) h + O(h) For h = x and ignoring O(h), we get a first-order accurate (i.e. O(h)) forward difference formula of the first derivative as f (x) f(x + h) f(x) h (10) Figure 5: Forward difference formulation. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 13 / 57

14 Finite Difference Approximation Forward and backward FD of First Derivative to O(h) Accuracy Solving Eq. (8) for (df(x)/dx) i,j df(x) dx = f (x) = = f(x h) f(x) f f (h) {z h } 2! 3! (h)2... {z } finite difference truncation error, O(h) f(x h) f(x) h + O(h) For ( h) = ( x) and ignoring O(h), we get a first-order accurate (i.e. O(h)) backward difference formula of the first derivative as f (x) f(x) f(x h) h (11) Figure 6: Backward difference formulation. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 14 / 57

15 Finite Difference Approximation Forward and backward FD of First Derivative to O(h 2 ) Accuracy The common practice is to use forward and backward expressions of O(h 2 ). We can derive them by retaining more terms in the Taylor series. Multiply Eq. (6) by 4 and subtract it from Eq. (7) to eliminate f (x) or f(x + 2h) 4 f(x + h) = 3f(x) 2h f (x) + 2h3 3 f (x) +... (12) f (x) = f(x + 2h) + 4f(x + h) 3f(x) 2h + O(h 2 ) (13) Eq. (13) is the second-order accurate forward difference formula for f (x). The second-order accurate backward difference formula for f (x) may be obtained through similar process by expanding f(x h) and f(x 2h) using the Taylor series see Eqs.(8) and (9) resulting in f (x) = f(x 2h) 4f(x h) + 3f(x) 2h + O(h 2 ) (14) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 15 / 57

16 Finite Difference Approximation Centred FD of First Derivative to O(h 2 ) Accuracy If we substract Eq. (8) from Eq. (6) we get the second-order accurate centred difference formula for f (x) f f(x + h) f(x h) (x) = f (x) h h 3! f(x + h) f(x h) 2h (15) Figure 7: Central difference formulation. Adding Eq. (8) to Eq. (6) leads to the second-order accurate centred difference formula for f (x) Note:Accuracy of Eqs. (10) (11) and (15) can be improved by retaining the second-derivative term, f (x), and substituting it with Eq. (16). f f(x + h) 2f(x) + f(x h) (x) = h 2 f(x + h) 2f(x) + f(x h) h 2 (16) f iv (x) h ! Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 16 / 57

17 Finite Difference Approximation Centred FD of Higher Derivatives to O(h 2 ) and O(h 4 ) Accuracy Centred Difference Formulae of Order O(h 2 ) f f(x + h) f(x h) (x) (17) 2h f f(x + h) 2f(x) + f(x h) (x) h 2 (18) f (x) f (4) (x) f(x + 2h) f(x + h) + 2f(x h) f(x 2h) 2h 3 (19) f(x + 2h) 4f(x + h) + 6f(x) 4f(x h) + f(x 2h) h 4 (20) Centred Difference Formulae of Order O(h 4 ) f f(x + 2h) + 8f(x + h) 8f(x h) + f(x 2h) (x) (21) 12h f f(x + 2h) + 16f(x + h) 30f(x) + 16f(x h) f(x 2h) (x) 12h 2 (22) f (x) f (4) (x) f(x + 3h) + 8f(x + 2h) 13f(x + h) + 13f(x h) 8f(x 2h) + f(x 3h) 8h 3 (23) f(x + 3h) + 12f(x + 2h) 39f(x + h) + 56f(x) 39f(x h) + 12f(x 2h) f(x 3h) 6h 4 (24) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 17 / 57

18 Finite Difference Approximation Example 1 Effect of step size h Problem Statement: Let f(x) = sin(x), where x is measured in radians. Calculate approximations to f (0.8) using the centred difference formula of order O(h 2 ) with x = h = 0.1, x = h = 0.01, x = h = Carry eight or nine decimal places. Compare with the value f (0.8) = cos(0.8). Solution: Work through the example. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 18 / 57

19 Finite Difference Approximation Example 2 Effect of O(h 2 ) and O(h 4 ) Problem Statement: Compare the numerical differentiation by centred difference formulae of order O(h 2 ) and order O(h 4 ). Let f(x) = x 3 and find approximations for f (2). Use order O(h 2 ) with x = h = 0.05 Use order O(h 4 ) with x = h = 0.05 Solution: Work through the example. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 19 / 57

20 Finite Difference Approximation Centred Difference Formulae Programming Example Problem Statement: Take a look at ܽ ½º to study sample computation of the derivative of a function using forward difference formula Take a look at ܾ ½º to study sample computation of the derivative of a function using central difference formula Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 20 / 57

21 Richardson Extrapolation Two approaches normally used to improve derivative estimates decrease step size h use higher-order formula that employs more points There is also a third approach Richardson extrapolation a method often used to improve the results of a numerical method, from a method of order O(h n ) it gives us a method of order O(h n+1 ). Richardson extrapolation uses two derivatives to compute a third, more accurate approximation. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 21 / 57

22 Richardson Extrapolation In integration, Richardson extrapolation provides a means to obtain an improved integral estimate I by formula I I(h 2) + h1 1 «2 2) I(h 1)] (25) 1[I(h h 2 where I(h 1) and I(h 2) are integral estimates using two step sizes h 1 and h 2. Eq. (25) is usually written for the case where h 2 = 1 h1 to give 2 I 4 3 I(h2) 1 3 I(h1) (26) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 22 / 57

23 Richardson Extrapolation In similar fashion, Eq. (26) can be written for derivatives, D, as D 4 3 D(h2) 1 3 D(h1) (27) for centred-difference approximations with O(h 2 ). The application of this formula will yield a new derivative estimate of O(h 4 ) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 23 / 57

24 Richardson Extrapolation Example 3 Problem Statement: Using the function f(x) = 0.1x x 3 0.5x x estimate the first derivative at x = 0.5 employing step sizes h 1 = 0.5 and h 2 = Compute an improved estimate with Richardson extrapolation. As a comparison, the true value is Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 24 / 57

25 Finite Difference Approximation Finite Difference in PDE So far we dealt with total or ordinary derivatives where function f depends on a single independent variable x. In many engineering problems, function f depends on two or more independent variables. We use notation (i, j) to designate the pivot point if there are two independent variables, (i, j, k) for three see Figure 8 and so on as the respective counters in x, y and z directions. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 25 / 57

26 Finite Difference Approximation Finite Difference in PDE (a) (b) Figure 8: Two- and three-dimensional grid systems. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 26 / 57

27 Finite Difference Approximation Finite Difference in PDE Consider f(x, y). Finite-difference approximation for the partial derivative f(x, y) x at (x = x i, y = y j ) can be found by fixing value of y at y j and treat f(x, y j ) as a one-variable function. Forward-difference approximation of f/ x is f f(x i + x, y j ) f(x i, y j ) (28) x i,j x Backward-difference approximation of f/ x is f f(x i, y j ) f(x i x, y j ) (29) x i,j x Central-difference approximation of f/ x is f f(x i + x, y j ) f(x i x, y j ) x 2 x i,j (30) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 27 / 57

28 Finite Difference Approximation Finite Difference in PDE Similarly, finite-difference approximation for the partial derivative f(x, y) y at (x = x i, y = y j ) can be found by fixing value of x at x i and treat f(x i, y) as a one-variable function. Forward-difference approximation of f/ y is f f(x i, y j + y) f(x i, y j ) (31) y i,j y Backward-difference approximation of f/ y is f f(x i, y j ) f(x i, y j y) (32) y i,j y Central-difference approximation of f/ x is f f(x i, y j + y) f(x i, y j y) y 2 y i,j (33) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 28 / 57

29 Finite Difference Approximation Finite Difference in PDE Central-difference approximation of 2 f/ x 2 2 f f(x i + x, y j ) 2f(x i, y j ) + f(x i x, y j ) (34) x 2 i,j ( x) 2 Central-difference approximation of 2 f/ y 2 2 f f(x i, y j + y) 2f(x i, y j ) + f(x i, y j y) (35) y 2 i,j ( y) 2 Central-difference approximation of 2 f/ x y 2 f `f(xi + x, y j + y) f(x i + x, y j y) f(x i x, y j + y) + f(x i x, y j y) x y i,j (4 x y) (36) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 29 / 57

30 Curve-Fitting & Interpolation The function f(x), which is to be differentiated, may be a known function, or a set of discrete data. In general, known functions can be differentiated exactly. Differentiation of discrete data, however, requires an approximate numerical procedure. To perform numerical differentiation, an approximating function (normally a polynomial) curve is fit to the discrete data, or a subset of the discrete data, and the approximating function is differentiated. The best-fitting curve can be obtained through various methods and we shall look at approximating function obtained through collocation-polynomials fit, Lagrange interpolation formula, least-squares regression, and divided difference fit which can be applied to both unequally spaced data and equally spaced data. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 30 / 57

31 Curve-Fitting & Interpolation Collocation-Polynomials Fit Also known as the method of direct fit polynomials. Based on fitting the data directly by a polynomial, which is given by P n(x) = a 0 + a 1x + a 2x a nx n (37) where P n(x) is determined by one of the following methods: Given N = n + 1 points, [x i, f(x i )], determine the exact nth-degree polynomial that passes through the data points. Given N > n + 1 points, [x i, f(x i )], determine the least squares nth-degree polynomial that best fits the data points a much detailed coverage on this later! Derivatives obtained by differentiating the approximating polynomial f P n = a 1 + 2a 2x + 3a 3x f P n = 2a 2 + 5a 3x +... (38a) (38b) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 31 / 57

32 Curve-Fitting & Interpolation Lagrange Polynomials Can be used for both unequally spaced data and equally spaced data. It is based on fitting second degree Lagrange polynomial, Eq. (39), to a (sub)set of three discrete data pairs, e.g. (a, f(a)), (b, f(b)), and (c, f(c)), such that P 2(x) = (x b)(x c) (a b)(a c) Differentiating Eq. (39) yields f P 2(x) = f(a) + (x a)(x c) (b a)(b c) (x a)(x b) f(b) + f(c) (39) (c a)(c b) 2x (b + c) 2x (a + c) 2x (a + b) f(a) + f(b) + (a b)(a c) (b a)(b c) (c a)(c b) f(c) (40a) f P 2f(a) 2 (x) = (a b)(a c) + 2f(b) (b a)(b c) + 2f(c) (c a)(c b) (40b) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 32 / 57

33 Curve-Fitting & Interpolation Least Square Curve Fitting The methods of least squares assumes that the best-fit curve of a given type is the curve that has the minimal sum of the deviations squared (least square error) from a given set of data. Suppose that the data points are (x 1, y 1), (x 2, y 2),..., (x n, y n) where x is the independent variable and y is the dependent variable. The fitting curve f(x) has the deviation (error) d from each data point, i.e., d 1 = y 1 f(x 1), d 2 = y 2 f(x 2),... d n = y n f(x n). According to the method of least squares, the best fitting curve has the property that: Π = d d d 2 n = d 2 i = [y i f(x i )] 2 = a minimum Polynomials are one of the most commonly used types of curves in curve fitting. Methods of least squares curve fitting using polynomials include: least-squares line (i.e. 1 st degree polynomial) method, least-squares parabola (i.e. 2 nd degree polynomial) method, least-squares m th degree polynomials method multiple regression least-squares Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 33 / 57

34 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares Line Method To approximate the given set of data, (x 1, y 1), (x 2, y 2),..., (x n, y n) where n 2, the least-squares line uses a straight line y = a + bx The best fitting curve f(x) has the least square error, i.e., Π = = [ y i f(x i )] 2 [ y i (a + bx i )] 2 = a minimum where a and b are unknown coefficients while all x i and y i are given. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 34 / 57

35 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares Line Method To obtain the least square error, the unknown coefficients a and b must yield zero first derivatives Π a = 2 xi 0 [ y i (a + bx i )] = 0 Π b = 2 xi 1 [ y i (a + bx i )] = 0 Expanding the above equations, we have: xi 0 y i = a xi 1 y i = a xi 0 + b xi 1 + b x 1 i x 2 i The unknown coefficients a, and b can hence be obtained by solving the above system of linear equations. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 35 / 57

36 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares Parabola Method To approximate the given set of data, (x 1, y 1), (x 2, y 2),..., (x n, y n) where n 3, the least-squares line uses a second order polynomial y = a + bx + cx 2 The best fitting curve f(x) has the least square error, i.e., Π = = [ y i f(x i )] 2 [ y i (a + bx i + cxi 2 )] 2 = a minimum where a, b and c are unknown coefficients while all x i and y i are given. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 36 / 57

37 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares Parabola Method To obtain the least square error, the unknown coefficients a, b and c must yield zero first derivatives Π a = 2 xi 0 [ y i (a + bx i + cxi 2 )] = 0 Π b = 2 xi 1 [ y i (a + bx i + cxi 2 )] = 0 Π c = 2 xi 2 [ y i (a + bx i + cxi 2 )] = 0 Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 37 / 57

38 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares Parabola Method Expanding the above equations, we have: xi 0 y i = a xi 1 y i = a xi 2 y i = a xi 0 + b xi 1 + b xi 2 + b xi 1 + c xi 2 + c xi 3 + c The unknown coefficients a, b, and c can be obtained by solving the above system linear equations. x 2 i x 3 i x 4 i Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 38 / 57

39 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares m th Polynomial Method To approximate the given set of data, (x 1, y 1), (x 2, y 2),..., (x n, y n) where n m + 1, the least-squares line uses an m th degree polynomial y = a 0 + a 1x + a 2x a mx m The best fitting curve f(x) has the least square error, i.e., Π = = [ y i f(x i )] 2 [ y i (a 0 + a 1x i + a 2xi a mxi m )] 2 = a minimum where a 0, a 1, a 2... and a m are unknown coefficients while all x i and y i are given. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 39 / 57

40 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares m th Polynomial Method To obtain the least square error, the unknown coefficients a 0, a 1, a 2... and a m must yield zero first derivatives Π a = 2 xi 0 [ y i (a 0 + a 1x i + a 2xi a mxi m )] = 0 Π b = 2 xi 1 [ y i (a 0 + a 1x i + a 2xi a mxi m )] = 0 Π b = 2 xi 2 [ y i (a 0 + a 1x i + a 2xi a mxi m )] = Π b = 2 xi m [ y i (a 0 + a 1x i + a 2xi a mxi m )] = 0 Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 40 / 57

41 Curve-Fitting & Interpolation Least Square Curve Fitting Least-squares m th Polynomial Method Expanding the above equations, we have: xi 0 y i = a 0 xi 1 y i = a 0 xi 2 y i = a xi m y i = a 0 xi 0 + a 1 xi 1 + a 1 xi 2 + a 1 xi 1 + a 2 xi 2 + a 2 xi 3 + a 2 xi a m xi a m x 4 i a m xi m + a 1 x m+1 i + a 2 x m i x m+2 i a m x m+1 i x m+2 i x m+m i The unknown coefficients a 0, a 1, a 2,..., and a m can be obtained by solving the above system of linear equations. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 41 / 57

42 Curve-Fitting & Interpolation Least Square Curve Fitting Multiple Regression This method estimates the outcomes (dependent variables) which may be affected by more than one control parameter (independent variables) or there may be more than one control parameter being changed at the same time. To approximate the given set of data of two independent variables x and y and one dependent variable z, e.g. (x 1, y 1, z 1), (x 2, y 2, z 2),..., (x n, y n, z n), where n 3, in the linear relationship case: z = a + bx + cy the best fitting curve f(x) has the least square error, i.e., Π = = [ z i f(x i, y i )] 2 [ z i (a + bx i + cy i )] 2 = a minimum where a, b and c are unknown coefficients while all x i and y i are given. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 42 / 57

43 Curve-Fitting & Interpolation Least Square Curve Fitting Multiple Regression To obtain the least square error, the unknown coefficients a, b and c must yield zero first derivatives Π a = 2 xi 0 [ z i (a + bx i + cy i )] = 0 Π b = 2 xi 1 [ z i (a + bx i + cy i )] = 0 Π c = 2 yi 1 [ z i (a + bx i + cy i )] = 0 Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 43 / 57

44 Curve-Fitting & Interpolation Least Square Curve Fitting Multiple Regression Expanding the above equations, we have: xi 0 z i = a xi 1 z i = a yi 1 z i = a xi 0 + b xi 1 + c xi 1 + b xi 2 + c yi 1 + b x i y i + c y 1 i x i y i The unknown coefficients a, b, and c can be obtained by solving the above system linear equations. y 2 i Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 44 / 57

45 Polynomial Interpolation Divided Difference Polynomials Can be used for both unequally spaced data and equally spaced data. Given the points (x 0, y 0), (x 1, y 1), (x 2, y 2), (x 3, y 3), we construct a divided difference table: x i y i = f (0) i x 0 y 0 = f (0) 0 x 1 y 1 = f (0) 1 x 2 y 2 = f (0) 2 x 3 y 3 = f (0) 3 f (1) 0 f (1) 1 f (1) 2 f (1) i f (2) i f (3) i = f(0) f (0) 1 0 x 1 x 0 f (2) = f(1) f (1) x 2 x 0 = f(0) f (0) 2 1 f (3) = f(2) f (2) 1 0 x 2 x 1 0 x 3 x 0 f (2) = f(1) f (1) x 3 x 1 = f(0) f (0) 3 2 x 3 x 2 from which we derive the divided difference polynomial representing these points: P n(x) = f (0) i + (x x 0) f (1) i + (x x 0)(x x 1) f (2) i + (x x 0)(x x 1)(x x 2) f (3) i (41) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 45 / 57

46 Polynomial Interpolation Divided Difference Polynomials Differentiating Eq. (41) yields f P n(x) = f (1) i + [2x (x 0 + x 1)] f (2) i + [3x 2 2(x 0 + x 1 + x 2) x + (x 0 x 1 + x 0 x 2 + x 1 x 2)] f (3) i (42a) f P n (x) = 2f (2) i + [6x 2(x 0 + x 1 + x 2)] f (3) (42b) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 46 / 57

47 Curve-Fitting & Interpolation Example 1 Problem Statement: Evaluate the derivatives by numerical differentiation formulae developed by fitting direct fit polynomial, Lagrange polynomial, and divided difference polynomial to the following set of discrete data: x y The exact derivatives at x = 3.5 are f (3.5) = and f (3.5) = Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 47 / 57

48 Curve-Fitting & Interpolation Example 1 Solution: Fit the quadratic polynomial, P 2(x) = a 0 + a 1x + a 2x 2 2, to the three data points: = a 0 + a 1(3.4) + a 2(3.4) 2 (43a) = a 0 + a 1(3.5) + a 2(3.5) 2 (43b) = a 0 + a 1(3.6) + a 2(3.6) 2 (43c) Solving for a 0, a 1, and a 2 by Gauss elimination gives a 0 = , a 1 = , and a 2 = Substituting these values into Eqs. (5.7a) and (5.7b) and evaluating at x = 3.5 yields the solution for direct fit polynomial: P 2 (3.5) = ( )(3.5) = (43d) P 2 (3.5) = (43e) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 48 / 57

49 Curve-Fitting & Interpolation Example 1 Solution: continued... Substituting the tabular values into Eqs. (40a) and (40b) and evaluating at x = 3.5 yields the solution for the Lagrange polynomial P 2(3.5) ( ) 2(3.5) ( ) 2 (3.5) = ( ) + ( )( ) ( )( ) ( ) 2(3.5) ( ) + ( ) = (44a) ( )( ) P 2 (3.5) = 2( ) ( )( ) + 2( ) ( )( ) 2( ) + = (44b) ( )( ) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 49 / 57

50 Curve-Fitting & Interpolation Example 1 Solution: continued... Construct a divided difference table for the tabular data to use the divided difference polynomial: x i f (0) f (1) f (2) i i i Substituting these values into Eqs. (42a) and (42b) yields the solution for the divided difference polynomial: P 2 (3.5) = [2(3.5) ( )]( ) = (45a) P 2 (3.5) = 2( ) = (45b) Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 50 / 57

51 Curve-Fitting & Interpolation Example 1 Solution: continued... The results obtained by the three procedures are identical since the same three points are used in all three procedures. The error in f (3.5) is Error = f (3.5) P 2 (3.5) = ( ) = The error in f (3.5) is Error = f (3.5) P 2 (3.5) = = Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 51 / 57

52 Curve-Fitting & Interpolation Example 2: Using Matlab Problem Statement: An experiment yields the following tabulated x-y pairs: x y x (cont... ) y (cont... ) Perform a curve fit to the data and find the approximating polynomial. Determine the derivative at x = 0.5. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 52 / 57

53 Curve-Fitting & Interpolation Example 2: Using Matlab Solution: To find a polynomial that fits at a set of data we use the command ÔÓÐÝ Ø Ü Ý Òµ, where Ü is a vector containing x-axis values, Ý is a vector containing y-axis values and Ò is the order of the polynomial that we want to fit. Matlab Session Ü ¼º¼¼¼ ¼º½¼¼ ¼º¾¼ ¼º ¼ ¼º ¼ ¼º ¼ ¼º ¼ ¼º ¼ ¼º ¼ ¼º ¼ ½º¼¼ Ý ¹¼º ½º º¾ º½ º¼ º º º º º ¼ ½½º¾ Ò ¾ È ÔÓÐÝ Ø Ü Ý Òµ Next we differentiate the polynomial Matlab Session È ÔÓÐÝ Ö Èµ Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 53 / 57

54 Curve-Fitting & Interpolation Example 2: Using Matlab Solution: continued... and compute the slope at x = 0.5 Matlab Session ÐÓÔ Ó ÔÓÐÝ ÔÓÐÝÚ Ð È ¼º µ We could easily plot the approximating polynomial over the original x-y points to see effect of the fitting on the approximation of derivatives Matlab Session Ü ¼º¼ ¼º¼½ ½º¼ Ý ÔÓÐÝÚ Ð È Ü µ ÔÐÓØ Ü Ý ³Ó³ Ü Ý ³Ö¹³µ Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 54 / 57

55 Curve-Fitting & Interpolation Example 3: Using Matlab Problem Statement: An experiment yields unequally spaced data in x and y x y x y x y Determine the differences between adjacent elements of both x and y vectors and compute divided-difference approximations of the derivative. Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 55 / 57

56 Curve-Fitting & Interpolation Example 3: Using Matlab Solution: To differentiate unequally spaced data in x and y we use the command ܵ and ݵ, where Ü is a vector containing x values, Ý is a vector containing y values Matlab Session ܵ ݵ To compute divided-difference approximations of the derivative we perform vector division of y differences by x differences Matlab Session Ý Ü Ýµº» ܵ Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 56 / 57

57 Bibliography 1 STEVEN C. CHAPRA & RAYMOND P. CANALE (2009): Numerical Methods for Engineers, 6ed, ISBN , McGraw-Hill 2 SINGIRESU S. RAO (2002): Applied Numerical Methods for Engineers and Scientists, ISBN X, Prentice Hall 3 DAVID KINCAID & WARD CHENEY (1991): Numerical Analysis: Mathematics of Scientific Computing, ISBN , Brooks/Cole Publishing Co. 4 STEVEN C. CHAPRA (2012): Applied Numerical Methods with MATLAB for Engineers and Scientists, 3ed, ISBN , McGraw-Hill 5 JOHN H. MATHEWS & KURTIS D. FINK (2004): Numerical Methods Using Matlab, 4ed, ISBN , Prentice Hall 6 WILLIAM J. PALM III (2011): Introduction to MATLAB for Engineers, 3ed, ISBN , McGraw-Hill Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Numerical Differentiation 57 / 57

SKMM 3023 Applied Numerical Methods

SKMM 3023 Applied Numerical Methods UNIVERSITI TEKNOLOGI MALAYSIA SKMM 3023 Applied Numerical Methods Ordinary Differential Equations ibn Abdullah Faculty of Mechanical Engineering Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Ordinary

More information

SKMM 3023 Applied Numerical Methods

SKMM 3023 Applied Numerical Methods SKMM 3023 Applied Numerical Methods Solution of Nonlinear Equations ibn Abdullah Faculty of Mechanical Engineering Òº ÙÐÐ ÚºÒÙÐÐ ¾¼½ SKMM 3023 Applied Numerical Methods Solution of Nonlinear Equations

More information

SME 3023 Applied Numerical Methods

SME 3023 Applied Numerical Methods UNIVERSITI TEKNOLOGI MALAYSIA SME 3023 Applied Numerical Methods Solution of Nonlinear Equations Abu Hasan Abdullah Faculty of Mechanical Engineering Sept 2012 Abu Hasan Abdullah (FME) SME 3023 Applied

More information

SME 3023 Applied Numerical Methods

SME 3023 Applied Numerical Methods UNIVERSITI TEKNOLOGI MALAYSIA SME 3023 Applied Numerical Methods Ordinary Differential Equations Abu Hasan Abdullah Faculty of Mechanical Engineering Sept 2012 Abu Hasan Abdullah (FME) SME 3023 Applied

More information

Numerical Methods. King Saud University

Numerical Methods. King Saud University Numerical Methods King Saud University Aims In this lecture, we will... find the approximate solutions of derivative (first- and second-order) and antiderivative (definite integral only). Numerical Differentiation

More information

Computational Methods for Engineers Programming in Engineering Problem Solving

Computational Methods for Engineers Programming in Engineering Problem Solving Computational Methods for Engineers Programming in Engineering Problem Solving Abu Hasan Abdullah January 6, 2009 Abu Hasan Abdullah 2009 An Engineering Problem Problem Statement: The length of a belt

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 5 Chapter 19 Numerical Differentiation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Chapter 5: Numerical Integration and Differentiation

Chapter 5: Numerical Integration and Differentiation Chapter 5: Numerical Integration and Differentiation PART I: Numerical Integration Newton-Cotes Integration Formulas The idea of Newton-Cotes formulas is to replace a complicated function or tabulated

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 5 Chapter 21 Numerical Differentiation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University 1 All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Chap. 19: Numerical Differentiation

Chap. 19: Numerical Differentiation Chap. 19: Numerical Differentiation Differentiation Definition of difference: y x f x x i x f x i As x is approaching zero, the difference becomes a derivative: dy dx lim x 0 f x i x f x i x 2 High-Accuracy

More information

Interpolation. P. Sam Johnson. January 30, P. Sam Johnson (NITK) Interpolation January 30, / 75

Interpolation. P. Sam Johnson. January 30, P. Sam Johnson (NITK) Interpolation January 30, / 75 Interpolation P. Sam Johnson January 30, 2015 P. Sam Johnson (NITK) Interpolation January 30, 2015 1 / 75 Overview One of the basic ideas in Mathematics is that of a function and most useful tool of numerical

More information

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ).

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ). 1 Interpolation: The method of constructing new data points within the range of a finite set of known data points That is if (x i, y i ), i = 1, N are known, with y i the dependent variable and x i [x

More information

Engg. Math. II (Unit-IV) Numerical Analysis

Engg. Math. II (Unit-IV) Numerical Analysis Dr. Satish Shukla of 33 Engg. Math. II (Unit-IV) Numerical Analysis Syllabus. Interpolation and Curve Fitting: Introduction to Interpolation; Calculus of Finite Differences; Finite Difference and Divided

More information

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80

More information

MMJ 1113 Computational Methods for Engineers

MMJ 1113 Computational Methods for Engineers Faculty of Mechanical Engineering Engineering Computing Panel MMJ 1113 Computational Methods for Engineers Engineering Problem Solving Abu Hasan Abdullah Feb 2013 Ùº Òº ÙÐÐ ÚºÒÙÐÐ MMJ 1113 Computational

More information

Numerical Methods School of Mechanical Engineering Chung-Ang University

Numerical Methods School of Mechanical Engineering Chung-Ang University Part 5 Chapter 19 Numerical Differentiation Prof. Hae-Jin Choi hjchoi@cau.ac.kr 1 Chapter Objectives l Understanding the application of high-accuracy numerical differentiation formulas for equispaced data.

More information

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20 Exam 2 Average: 85.6 Median: 87.0 Maximum: 100.0 Minimum: 55.0 Standard Deviation: 10.42 Fall 2011 1 Today s class Multiple Variable Linear Regression Polynomial Interpolation Lagrange Interpolation Newton

More information

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error In this method we assume initial value of x, and substitute in the equation. Then modify x and continue till we

More information

Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i

Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i LECTURE 6 NUMERICAL DIFFERENTIATION To find discrete approximations to differentiation (since computers can only deal with functional values at discrete points) Uses of numerical differentiation To represent

More information

Numerical Methods. Roots of Equations

Numerical Methods. Roots of Equations Roots of Equations by Norhayati Rosli & Nadirah Mohd Nasir Faculty of Industrial Sciences & Technology norhayati@ump.edu.my, nadirah@ump.edu.my Description AIMS This chapter is aimed to compute the root(s)

More information

Applied Numerical Analysis

Applied Numerical Analysis Applied Numerical Analysis Using MATLAB Second Edition Laurene V. Fausett Texas A&M University-Commerce PEARSON Prentice Hall Upper Saddle River, NJ 07458 Contents Preface xi 1 Foundations 1 1.1 Introductory

More information

The Tangent Parabola The AMATYC Review, Vol. 23, No. 1, Fall 2001, pp

The Tangent Parabola The AMATYC Review, Vol. 23, No. 1, Fall 2001, pp The Tangent Parabola The AMATYC Review, Vol. 3, No., Fall, pp. 5-3. John H. Mathews California State University Fullerton Fullerton, CA 9834 By Russell W. Howell Westmont College Santa Barbara, CA 938

More information

9.6 Predictor-Corrector Methods

9.6 Predictor-Corrector Methods SEC. 9.6 PREDICTOR-CORRECTOR METHODS 505 Adams-Bashforth-Moulton Method 9.6 Predictor-Corrector Methods The methods of Euler, Heun, Taylor, and Runge-Kutta are called single-step methods because they use

More information

New implicit method for analysis of problems in nonlinear structural dynamics

New implicit method for analysis of problems in nonlinear structural dynamics Applied and Computational Mechanics 5 (2011) 15 20 New implicit method for analysis of problems in nonlinear structural dynamics A. A. Gholampour a,, M. Ghassemieh a a School of Civil Engineering, University

More information

Finite Difference and Finite Element Methods

Finite Difference and Finite Element Methods Finite Difference and Finite Element Methods Georgy Gimel farb COMPSCI 369 Computational Science 1 / 39 1 Finite Differences Difference Equations 3 Finite Difference Methods: Euler FDMs 4 Finite Element

More information

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b) Numerical Methods - PROBLEMS. The Taylor series, about the origin, for log( + x) is x x2 2 + x3 3 x4 4 + Find an upper bound on the magnitude of the truncation error on the interval x.5 when log( + x)

More information

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9 TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1 Chapter 01.01 Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9 Chapter 01.02 Measuring errors 11 True error 11 Relative

More information

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science EAD 115 Numerical Solution of Engineering and Scientific Problems David M. Rocke Department of Applied Science Computer Representation of Numbers Counting numbers (unsigned integers) are the numbers 0,

More information

Numerical and Statistical Methods

Numerical and Statistical Methods F.Y. B.Sc.(IT) : Sem. II Numerical and Statistical Methods Time : ½ Hrs.] Prelim Question Paper Solution [Marks : 75 Q. Attempt any THREE of the following : [5] Q.(a) What is a mathematical model? With

More information

Identification Methods for Structural Systems. Prof. Dr. Eleni Chatzi Lecture March, 2016

Identification Methods for Structural Systems. Prof. Dr. Eleni Chatzi Lecture March, 2016 Prof. Dr. Eleni Chatzi Lecture 4-09. March, 2016 Fundamentals Overview Multiple DOF Systems State-space Formulation Eigenvalue Analysis The Mode Superposition Method The effect of Damping on Structural

More information

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations ECE257 Numerical Methods and Scientific Computing Ordinary Differential Equations Today s s class: Stiffness Multistep Methods Stiff Equations Stiffness occurs in a problem where two or more independent

More information

Numerical and Statistical Methods

Numerical and Statistical Methods F.Y. B.Sc.(IT) : Sem. II Numerical and Statistical Methods Time : ½ Hrs.] Prelim Question Paper Solution [Marks : 75 Q. Attempt any THREE of the following : [5] Q.(a) What is a mathematical model? With

More information

Quartic Equation. By CH vd Westhuizen A unique Solution assuming Complex roots. Ax^4 + Bx^3 + Cx^2 + Dx + E = 0

Quartic Equation. By CH vd Westhuizen A unique Solution assuming Complex roots. Ax^4 + Bx^3 + Cx^2 + Dx + E = 0 Quartic Equation By CH vd Westhuizen A unique Solution assuming Complex roots The general Quartic is given by Ax^4 + Bx^3 + Cx^ + Dx + E = 0 As in the third order polynomial we are first going to reduce

More information

Section Taylor and Maclaurin Series

Section Taylor and Maclaurin Series Section.0 Taylor and Maclaurin Series Ruipeng Shen Feb 5 Taylor and Maclaurin Series Main Goal: How to find a power series representation for a smooth function us assume that a smooth function has a power

More information

Numerical Methods for Engineers

Numerical Methods for Engineers Numerical Methods for Engineers SEVENTH EDITION Steven C Chopra Berger Chair in Computing and Engineering Tufts University Raymond P. Canal Professor Emeritus of Civil Engineering of Michiaan University

More information

Curve Fitting. Objectives

Curve Fitting. Objectives Curve Fitting Objectives Understanding the difference between regression and interpolation. Knowing how to fit curve of discrete with least-squares regression. Knowing how to compute and understand the

More information

What are Numerical Methods? (1/3)

What are Numerical Methods? (1/3) What are Numerical Methods? (1/3) Numerical methods are techniques by which mathematical problems are formulated so that they can be solved by arithmetic and logic operations Because computers excel at

More information

Section 5.8. Taylor Series

Section 5.8. Taylor Series Difference Equations to Differential Equations Section 5.8 Taylor Series In this section we will put together much of the work of Sections 5.-5.7 in the context of a discussion of Taylor series. We begin

More information

Curve Fitting and Interpolation

Curve Fitting and Interpolation Chapter 5 Curve Fitting and Interpolation 5.1 Basic Concepts Consider a set of (x, y) data pairs (points) collected during an experiment, Curve fitting: is a procedure to develop or evaluate mathematical

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 5 Chapter 17 Numerical Integration Formulas PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Taylor Series and Numerical Approximations

Taylor Series and Numerical Approximations Taylor Series and Numerical Approximations Hilary Weller h.weller@reading.ac.uk August 7, 05 An introduction to the concept of a Taylor series and how these are used in numerical analysis to find numerical

More information

446 CHAP. 8 NUMERICAL OPTIMIZATION. Newton's Search for a Minimum of f(x,y) Newton s Method

446 CHAP. 8 NUMERICAL OPTIMIZATION. Newton's Search for a Minimum of f(x,y) Newton s Method 446 CHAP. 8 NUMERICAL OPTIMIZATION Newton's Search for a Minimum of f(xy) Newton s Method The quadratic approximation method of Section 8.1 generated a sequence of seconddegree Lagrange polynomials. It

More information

DRAFT - Math 101 Lecture Note - Dr. Said Algarni

DRAFT - Math 101 Lecture Note - Dr. Said Algarni 2 Limits 2.1 The Tangent Problems The word tangent is derived from the Latin word tangens, which means touching. A tangent line to a curve is a line that touches the curve and a secant line is a line that

More information

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam Jim Lambers MAT 460/560 Fall Semester 2009-10 Practice Final Exam 1. Let f(x) = sin 2x + cos 2x. (a) Write down the 2nd Taylor polynomial P 2 (x) of f(x) centered around x 0 = 0. (b) Write down the corresponding

More information

November 20, Interpolation, Extrapolation & Polynomial Approximation

November 20, Interpolation, Extrapolation & Polynomial Approximation Interpolation, Extrapolation & Polynomial Approximation November 20, 2016 Introduction In many cases we know the values of a function f (x) at a set of points x 1, x 2,..., x N, but we don t have the analytic

More information

Preliminary Examination in Numerical Analysis

Preliminary Examination in Numerical Analysis Department of Applied Mathematics Preliminary Examination in Numerical Analysis August 7, 06, 0 am pm. Submit solutions to four (and no more) of the following six problems. Show all your work, and justify

More information

CHAPTER 1 INTRODUCTION TO NUMERICAL METHOD

CHAPTER 1 INTRODUCTION TO NUMERICAL METHOD CHAPTER 1 INTRODUCTION TO NUMERICAL METHOD Presenter: Dr. Zalilah Sharer 2018 School of Chemical and Energy Engineering Universiti Teknologi Malaysia 16 September 2018 Chemical Engineering, Computer &

More information

BMEN 398: MATLAB Module: Higher Order Differential Equations; SIMULINK Fall 2005 Updated 8/21/2005 Hart

BMEN 398: MATLAB Module: Higher Order Differential Equations; SIMULINK Fall 2005 Updated 8/21/2005 Hart BMEN 398: MATLAB Module: Higher Order Differential Equations; SIMULINK Fall 2005 Updated 8/21/2005 Hart Higher Order ODEs: (Rao, 2002) Although we can now write MATLAB code to find numerical solutions

More information

Chapter Two: Numerical Methods for Elliptic PDEs. 1 Finite Difference Methods for Elliptic PDEs

Chapter Two: Numerical Methods for Elliptic PDEs. 1 Finite Difference Methods for Elliptic PDEs Chapter Two: Numerical Methods for Elliptic PDEs Finite Difference Methods for Elliptic PDEs.. Finite difference scheme. We consider a simple example u := subject to Dirichlet boundary conditions ( ) u

More information

1.1 GRAPHS AND LINEAR FUNCTIONS

1.1 GRAPHS AND LINEAR FUNCTIONS MATHEMATICS EXTENSION 4 UNIT MATHEMATICS TOPIC 1: GRAPHS 1.1 GRAPHS AND LINEAR FUNCTIONS FUNCTIONS The concept of a function is already familiar to you. Since this concept is fundamental to mathematics,

More information

Numerical Integra/on

Numerical Integra/on Numerical Integra/on The Trapezoidal Rule is a technique to approximate the definite integral where For 1 st order: f(a) f(b) a b Error Es/mate of Trapezoidal Rule Truncation error: From Newton-Gregory

More information

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places. NUMERICAL METHODS 1. Rearranging the equation x 3 =.5 gives the iterative formula x n+1 = g(x n ), where g(x) = (2x 2 ) 1. (a) Starting with x = 1, compute the x n up to n = 6, and describe what is happening.

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 6 Chapter 20 Initial-Value Problems PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

Limits and Continuity. 2 lim. x x x 3. lim x. lim. sinq. 5. Find the horizontal asymptote (s) of. Summer Packet AP Calculus BC Page 4

Limits and Continuity. 2 lim. x x x 3. lim x. lim. sinq. 5. Find the horizontal asymptote (s) of. Summer Packet AP Calculus BC Page 4 Limits and Continuity t+ 1. lim t - t + 4. lim x x x x + - 9-18 x-. lim x 0 4-x- x 4. sinq lim - q q 5. Find the horizontal asymptote (s) of 7x-18 f ( x) = x+ 8 Summer Packet AP Calculus BC Page 4 6. x

More information

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

Integration, differentiation, and root finding. Phys 420/580 Lecture 7 Integration, differentiation, and root finding Phys 420/580 Lecture 7 Numerical integration Compute an approximation to the definite integral I = b Find area under the curve in the interval Trapezoid Rule:

More information

Taylor and Maclaurin Series. Copyright Cengage Learning. All rights reserved.

Taylor and Maclaurin Series. Copyright Cengage Learning. All rights reserved. 11.10 Taylor and Maclaurin Series Copyright Cengage Learning. All rights reserved. We start by supposing that f is any function that can be represented by a power series f(x)= c 0 +c 1 (x a)+c 2 (x a)

More information

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science EAD 115 Numerical Solution of Engineering and Scientific Problems David M. Rocke Department of Applied Science Taylor s Theorem Can often approximate a function by a polynomial The error in the approximation

More information

Modeling nonlinear systems using multiple piecewise linear equations

Modeling nonlinear systems using multiple piecewise linear equations Nonlinear Analysis: Modelling and Control, 2010, Vol. 15, No. 4, 451 458 Modeling nonlinear systems using multiple piecewise linear equations G.K. Lowe, M.A. Zohdy Department of Electrical and Computer

More information

CS 257: Numerical Methods

CS 257: Numerical Methods CS 57: Numerical Methods Final Exam Study Guide Version 1.00 Created by Charles Feng http://www.fenguin.net CS 57: Numerical Methods Final Exam Study Guide 1 Contents 1 Introductory Matter 3 1.1 Calculus

More information

Chapter 4: Interpolation and Approximation. October 28, 2005

Chapter 4: Interpolation and Approximation. October 28, 2005 Chapter 4: Interpolation and Approximation October 28, 2005 Outline 1 2.4 Linear Interpolation 2 4.1 Lagrange Interpolation 3 4.2 Newton Interpolation and Divided Differences 4 4.3 Interpolation Error

More information

2.2. Methods for Obtaining FD Expressions. There are several methods, and we will look at a few:

2.2. Methods for Obtaining FD Expressions. There are several methods, and we will look at a few: .. Methods for Obtaining FD Expressions There are several methods, and we will look at a few: ) Taylor series expansion the most common, but purely mathematical. ) Polynomial fitting or interpolation the

More information

34.3. Resisted Motion. Introduction. Prerequisites. Learning Outcomes

34.3. Resisted Motion. Introduction. Prerequisites. Learning Outcomes Resisted Motion 34.3 Introduction This Section returns to the simple models of projectiles considered in Section 34.1. It explores the magnitude of air resistance effects and the effects of including simple

More information

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by 1. QUESTION (a) Given a nth degree Taylor polynomial P n (x) of a function f(x), expanded about x = x 0, write down the Lagrange formula for the truncation error, carefully defining all its elements. How

More information

Numerical Integration and Numerical Differentiation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Numerical Integration and Numerical Differentiation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Numerical Integration and Numerical Differentiation Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.tw Integration 2 Mean for discrete and continuous data

More information

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 4

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 4 2.29 Spring 2015 Lecture 4 Review Lecture 3 Truncation Errors, Taylor Series and Error Analysis Taylor series: 2 3 n n i1 i i i i i n f( ) f( ) f '( ) f ''( ) f '''( )... f ( ) R 2! 3! n! n1 ( n1) Rn f

More information

Polynomial Functions. Linear Graphs and Linear Functions 1.3

Polynomial Functions. Linear Graphs and Linear Functions 1.3 Polynomial Functions Linear Graphs and Linear Functions 1.3 Forms for equations of lines (linear functions) Ax + By = C Standard Form y = mx +b Slope-Intercept (y y 1 ) = m(x x 1 ) Point-Slope x = a Vertical

More information

MA2501 Numerical Methods Spring 2015

MA2501 Numerical Methods Spring 2015 Norwegian University of Science and Technology Department of Mathematics MA5 Numerical Methods Spring 5 Solutions to exercise set 9 Find approximate values of the following integrals using the adaptive

More information

Families of Functions, Taylor Polynomials, l Hopital s

Families of Functions, Taylor Polynomials, l Hopital s Unit #6 : Rule Families of Functions, Taylor Polynomials, l Hopital s Goals: To use first and second derivative information to describe functions. To be able to find general properties of families of functions.

More information

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004 Department of Applied Mathematics and Theoretical Physics AMA 204 Numerical analysis Exam Winter 2004 The best six answers will be credited All questions carry equal marks Answer all parts of each question

More information

Numerical Methods. Scientists. Engineers

Numerical Methods. Scientists. Engineers Third Edition Numerical Methods for Scientists and Engineers K. Sankara Rao Numerical Methods for Scientists and Engineers Numerical Methods for Scientists and Engineers Third Edition K. SANKARA RAO Formerly,

More information

Numerical interpolation, extrapolation and fi tting of data

Numerical interpolation, extrapolation and fi tting of data Chapter 6 Numerical interpolation, extrapolation and fi tting of data 6.1 Introduction Numerical interpolation and extrapolation is perhaps one of the most used tools in numerical applications to physics.

More information

TEST CODE: MMA (Objective type) 2015 SYLLABUS

TEST CODE: MMA (Objective type) 2015 SYLLABUS TEST CODE: MMA (Objective type) 2015 SYLLABUS Analytical Reasoning Algebra Arithmetic, geometric and harmonic progression. Continued fractions. Elementary combinatorics: Permutations and combinations,

More information

New Material Section 1: Functions and Geometry occurring in engineering

New Material Section 1: Functions and Geometry occurring in engineering New Material Section 1: Functions and Geometry occurring in engineering 1. Plotting Functions: Using appropriate software to plot the graph of a function Linear f(x) = mx+c Quadratic f(x) = Px +Qx+R Cubic

More information

Numerical Methods for Engineers and Scientists

Numerical Methods for Engineers and Scientists Numerical Methods for Engineers and Scientists Second Edition Revised and Expanded Joe D. Hoffman Department of Mechanical Engineering Purdue University West Lafayette, Indiana m MARCEL D E К К E R MARCEL

More information

Introduction to Numerical Analysis

Introduction to Numerical Analysis Introduction to Numerical Analysis S. Baskar and S. Sivaji Ganesh Department of Mathematics Indian Institute of Technology Bombay Powai, Mumbai 400 076. Introduction to Numerical Analysis Lecture Notes

More information

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates

ab = c a If the coefficients a,b and c are real then either α and β are real or α and β are complex conjugates Further Pure Summary Notes. Roots of Quadratic Equations For a quadratic equation ax + bx + c = 0 with roots α and β Sum of the roots Product of roots a + b = b a ab = c a If the coefficients a,b and c

More information

Numerical Methods for Engineers. and Scientists. Applications using MATLAB. An Introduction with. Vish- Subramaniam. Third Edition. Amos Gilat.

Numerical Methods for Engineers. and Scientists. Applications using MATLAB. An Introduction with. Vish- Subramaniam. Third Edition. Amos Gilat. Numerical Methods for Engineers An Introduction with and Scientists Applications using MATLAB Third Edition Amos Gilat Vish- Subramaniam Department of Mechanical Engineering The Ohio State University Wiley

More information

Ma 530 Power Series II

Ma 530 Power Series II Ma 530 Power Series II Please note that there is material on power series at Visual Calculus. Some of this material was used as part of the presentation of the topics that follow. Operations on Power Series

More information

1.Chapter Objectives

1.Chapter Objectives LU Factorization INDEX 1.Chapter objectives 2.Overview of LU factorization 2.1GAUSS ELIMINATION AS LU FACTORIZATION 2.2LU Factorization with Pivoting 2.3 MATLAB Function: lu 3. CHOLESKY FACTORIZATION 3.1

More information

MA2501 Numerical Methods Spring 2015

MA2501 Numerical Methods Spring 2015 Norwegian University of Science and Technology Department of Mathematics MA2501 Numerical Methods Spring 2015 Solutions to exercise set 7 1 Cf. Cheney and Kincaid, Exercise 4.1.9 Consider the data points

More information

Math 3313: Differential Equations Second-order ordinary differential equations

Math 3313: Differential Equations Second-order ordinary differential equations Math 3313: Differential Equations Second-order ordinary differential equations Thomas W. Carr Department of Mathematics Southern Methodist University Dallas, TX Outline Mass-spring & Newton s 2nd law Properties

More information

SOUTH AFRICAN TERTIARY MATHEMATICS OLYMPIAD

SOUTH AFRICAN TERTIARY MATHEMATICS OLYMPIAD SOUTH AFRICAN TERTIARY MATHEMATICS OLYMPIAD. Determine the following value: 7 August 6 Solutions π + π. Solution: Since π

More information

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science EAD 115 Numerical Solution of Engineering and Scientific Problems David M. Rocke Department of Applied Science Multidimensional Unconstrained Optimization Suppose we have a function f() of more than one

More information

Math 578: Assignment 2

Math 578: Assignment 2 Math 578: Assignment 2 13. Determine whether the natural cubic spline that interpolates the table is or is not the x 0 1 2 3 y 1 1 0 10 function 1 + x x 3 x [0, 1] f(x) = 1 2(x 1) 3(x 1) 2 + 4(x 1) 3 x

More information

Dynamical Systems & Lyapunov Stability

Dynamical Systems & Lyapunov Stability Dynamical Systems & Lyapunov Stability Harry G. Kwatny Department of Mechanical Engineering & Mechanics Drexel University Outline Ordinary Differential Equations Existence & uniqueness Continuous dependence

More information

M.SC. PHYSICS - II YEAR

M.SC. PHYSICS - II YEAR MANONMANIAM SUNDARANAR UNIVERSITY DIRECTORATE OF DISTANCE & CONTINUING EDUCATION TIRUNELVELI 627012, TAMIL NADU M.SC. PHYSICS - II YEAR DKP26 - NUMERICAL METHODS (From the academic year 2016-17) Most Student

More information

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration. Unit IV Numerical Integration and Differentiation Numerical integration and differentiation quadrature classical formulas for equally spaced nodes improper integrals Gaussian quadrature and orthogonal

More information

(x + 1)(x 2) = 4. x

(x + 1)(x 2) = 4. x dvanced Integration Techniques: Partial Fractions The method of partial fractions can occasionally make it possible to find the integral of a quotient of rational functions. Partial fractions gives us

More information

Integration of Ordinary Differential Equations

Integration of Ordinary Differential Equations Integration of Ordinary Differential Equations Com S 477/577 Nov 7, 00 1 Introduction The solution of differential equations is an important problem that arises in a host of areas. Many differential equations

More information

MAT 460: Numerical Analysis I. James V. Lambers

MAT 460: Numerical Analysis I. James V. Lambers MAT 460: Numerical Analysis I James V. Lambers January 31, 2013 2 Contents 1 Mathematical Preliminaries and Error Analysis 7 1.1 Introduction............................ 7 1.1.1 Error Analysis......................

More information

Math Numerical Analysis Mid-Term Test Solutions

Math Numerical Analysis Mid-Term Test Solutions Math 400 - Numerical Analysis Mid-Term Test Solutions. Short Answers (a) A sufficient and necessary condition for the bisection method to find a root of f(x) on the interval [a,b] is f(a)f(b) < 0 or f(a)

More information

1D Heat equation and a finite-difference solver

1D Heat equation and a finite-difference solver 1D Heat equation and a finite-difference solver Guillaume Riflet MARETEC IST 1 The advection-diffusion equation The original concept applied to a property within a control volume from which is derived

More information

7. Piecewise Polynomial (Spline) Interpolation

7. Piecewise Polynomial (Spline) Interpolation - 64-7 Piecewise Polynomial (Spline Interpolation Single polynomial interpolation has two major disadvantages First, it is not computationally efficient when the number of data points is large When the

More information

Newton's forward interpolation formula

Newton's forward interpolation formula Newton's Interpolation Formulae Interpolation is the process of approximating a given function, whose values are known at N + 1 tabular points, by a suitable polynomial, P N (x) of degree N which takes

More information

Fixed point iteration and root finding

Fixed point iteration and root finding Fixed point iteration and root finding The sign function is defined as x > 0 sign(x) = 0 x = 0 x < 0. It can be evaluated via an iteration which is useful for some problems. One such iteration is given

More information

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 9

2.29 Numerical Fluid Mechanics Spring 2015 Lecture 9 Spring 2015 Lecture 9 REVIEW Lecture 8: Direct Methods for solving (linear) algebraic equations Gauss Elimination LU decomposition/factorization Error Analysis for Linear Systems and Condition Numbers

More information

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn Review Taylor Series and Error Analysis Roots of Equations Linear Algebraic Equations Optimization Numerical Differentiation and Integration Ordinary Differential Equations Partial Differential Equations

More information

Elements of Floating-point Arithmetic

Elements of Floating-point Arithmetic Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow

More information

GENG2140, S2, 2012 Week 7: Curve fitting

GENG2140, S2, 2012 Week 7: Curve fitting GENG2140, S2, 2012 Week 7: Curve fitting Curve fitting is the process of constructing a curve, or mathematical function, f(x) that has the best fit to a series of data points Involves fitting lines and

More information

Section x7 +

Section x7 + Difference Equations to Differential Equations Section 5. Polynomial Approximations In Chapter 3 we discussed the problem of finding the affine function which best approximates a given function about some

More information