# Numerical Methods

Sometimes, the presence of operating conditions, domain of the problem, coefficients and constants makes the physical problem complicated to investigate. In that case, it is very difficult to analyze and solve the problem by using analytical methods. As such, numerical methods are to be used to investigate such problems. Accordingly, we have presented here two well-known numerical methods, viz. the FDM and the FEM.

## Finite Difference Method

Here, finite differences are used for the differentials of the dependent variables appearing in partial differential equations. As such, using some algorithm and standard arithmetic, a digital computer can be employed to obtain a solution. Two methods, viz. the Taylor series expansion and the polynomial representation, are considered in this chapter for approximating the differentials of a function *f.*

### Taylor Series Expansion

Given an analytical function *f(x), f(x* + Дх) can be expanded in a Taylor series about x as follows (Hoffmann and Chiang 2000):

The difference approximation *df/dx* can be obtained in the following way:

Considering *O* (Ax) = -AX|X2- - ----in Equation 5.26, we have

which is a difference approximation for the first partial derivative of *f* with respect to *x.*

If the subscript index *i* is used to represent the discrete points in the x-direction, Equation 5.27 is written as

Equation 5.28 is known as the first forward difference approximation of *df/dx,* which is of order (Дх). So, it is obvious that when the step size decreases, the error term is reduced and hence the accuracy of the approximation increases. Let us consider the Taylor series expansion of *f(x* - Дх) about x.

Solving for *df/dx,* we obtain

If the subscript index *i* is used to represent the discrete points in the x-direction, Equation 5.30 is written as

Equation 5.31 is named as the first backward difference approximation of *df/dx* having the order of Дx. Now, consider the Taylor series expansions (5.25) and (5.29), which are repeated here and can be written as

Subtracting Equation 5.29 from Equation 5.25, one obtains

solving for *df/dx,
*

For the index *i,* the difference approximation of*f* with respect to x is

The representation Equation 5.34 of *df/dx* is known as the central difference approximation of the order (Дх)^{2}. Three approximations for the first derivative of *df/dx* have been introduced. Furthermore, the derivations of the finite approximate expressions for the higher- order derivatives are considered.

Again, consider the Taylor series expansion

Expanding by using a Taylor series of *f(x* + 2 Дx) about x gives the following expansion:

Multiplying Equation 5.25 by 2 and subtracting it from Equation 5.35, we get

Now solving for d^{2}f/dx^{2}, we get

This equation can be represented as

Equation 5.39 represents the forward difference approximation for the second derivative of *f* with respect to x and is of the order Дx. Similarly, the approximation for the second derivative can be obtained by using the Taylor series expansions of *f(x* - Дx) and *f(x* - 2 Дx). The second derivatives are

These equations are backward and central approximations of *d ^{2}f/dx^{2},* respectively.