You are on page 1of 24

Prepared by;

Gabriel I. Gamana, CE

Numerical
Methods for
Engineering
Engr. Gabriel I. Gamana

1.0 Nonlinear Equations in One


Variable
2.0 Systems of Equations
3.0 Function Approximation and
Interpolation, Curve Fitting
Table of Contents 4.0 Numerical Differentiation and
Integration
5.0 Eigenvalue Problems
6.0 Ordinary Differential Equations
7.0 Partial Differential Equations

1
Prepared by;
Gabriel I. Gamana, CE

1.1 Introduction
1.2 Bracketing Methods
1.0 Nonlinear 1.2.1 Bisection Method
1.2.2 False Position Method
Equations in 1.3 Open Methods
One Variable 1.3.1 Fixed-Point Method
1.3.2 Newton-Raphson Method
1.3.3 Secant Method

1.1 Introduction

2
Prepared by;
Gabriel I. Gamana, CE

1.1 Introduction
Mathematical Modeling and Engineering Problem Solving
• In Engineering, problems can be solved by either using exact
analytical methods or approximation using numerical
methods
• The discrepancy between analytical methods and numerical
methods is what we called error.
• For many applied engineering problems, we cannot obtain
analytical solutions. Therefore, we cannot compute exactly
the errors associated with our numerical methods. In these
cases, we must settle for approximations of the errors.

1.1 Introduction

3
Prepared by;
Gabriel I. Gamana, CE

1.1 Introduction

1.1 Introduction
• Numerical methods are iterative solutions.
• There are no particular numerical methods that work for all
equations.
• The root depends on the initial guess.
• Accuracy measurement of the approximation can be
calculated using the equation:
𝑥 −𝑥
𝜀 = <𝜀
𝑥
Where: 𝜀 = relative error
𝜀 = stopping criterion
𝑥 = present iteration
𝑥 = previous iteration
8

4
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


• These techniques are called bracketing methods because
two initial guesses for the root are required. As the name
implies, these guesses must “bracket,” or be on either side of,
the root. The particular methods described herein employ
different strategies to systematically reduce the width of the
bracket and, hence, home in on the correct answer.
• For the bracketing methods, the root is located within an
interval prescribed by a lower and an upper bound. Repeated
application of these methods always results in closer
estimates of the true value of the root. Such methods are said
to be convergent because they move closer to the truth as
the computation progresses.

1.2 Bracketing Methods


1.2.1 Bisection Method
The bisection method, which is alternatively called binary
chopping, interval halving, or Bolzano’s method, is one type
of incremental search method in which the interval is always
divided in half. The process is repeated to obtain refined
estimates.

10

5
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


1.2.1.1 Procedures
1. Choose lower 𝑥 and upper 𝑥 guesses for the root such that
the function changes sign over the interval. This can be
checked by ensuring that 𝑓 𝑥 𝑓 𝑥 < 0.
2. An estimate of the root 𝑥 is determined by
𝑥 +𝑥
𝑥 =
2
3. Make the following evaluations to determine in which
subinterval the root lies
a. If 𝑓 𝑥 𝑓 𝑥 < 0, the root lies in the lower subinterval.
Therefore, set 𝑥 = 𝑥 and return to step 2.
b. If 𝑓 𝑥 𝑓 𝑥 > 0, the root lies in the lower subinterval.
Therefore, set 𝑥 = 𝑥 and return to step 2.
c. If 𝑓 𝑥 𝑓 𝑥 = 0 or more accurately, if 𝑓 𝑥 < 0.001
and 𝜀 < 𝜀, the root equals 𝑥 ; terminate the computation.
11

1.2 Bracketing Methods


Problem 1-1
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 𝑥 − 3𝑥 − 6𝑥 + 8

12

6
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


Problem 1-2
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛 𝑥 − 𝑒

13

1.2 Bracketing Methods


Problem 1-3
Find the roots of the equation below with a stopping criterion of
0.0001.
𝑥 + 3 2𝑥 − 10
+ =3
𝑥 −5 𝑥 +3

14

7
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


Problem 1-4
Aerospace engineers compute the trajectories of the projectiles
like rockets. A related problem deals with the trajectory of a
thrown ball. The trajectory of a ball thrown by a right fielder is
defined by the (x, y) coordinates whose trajectory can be
modeled as:
𝑔𝑥
𝑦 = 𝑥 tan 𝜃 −
2𝑣 𝑐𝑜𝑠 𝜃
Find the approximate initial angle 𝜃 if 𝑣 = 20 𝑚/𝑠 and the
distance to second base is 40 m. Note that the throw leaves the
right fielder’s hand at an elevation of 1.8 m and the second
baseman receives it at 1 m.

15

1.2 Bracketing Methods


1.2.2 False-Position Method
Shortcoming of the bisection method is that, in dividing the
interval from 𝑥 to 𝑥 into equal halves, no account is taken of
the magnitudes of 𝑓(𝑥 ) and 𝑓(𝑥 ). For example, if 𝑓(𝑥 ) is
much closer to zero than 𝑓(𝑥 ), it is likely that the root is closer
to 𝑥 than to 𝑥 , as shown in figure below.

16

8
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


• An alternative method that exploits this graphical insight is to
join 𝑓(𝑥 ) and 𝑓(𝑥 ) by a straight line. The intersection of this
line with the x axis represents an improved estimate of the
root.
• The fact that the replacement of the curve by a straight line
gives a “false position” of the root, and is the origin of the
name, false position method, or in Latin, regula falsi. It is
also called the linear interpolation method.

17

1.2 Bracketing Methods


1.2.2.1 Procedures
1. Choose lower 𝑥 and upper 𝑥 guesses for the root such that
the function changes sign over the interval. This can be
checked by ensuring that 𝑓 𝑥 𝑓 𝑥 < 0.
2. An estimate of the root 𝑥 is determined by
𝑥 𝑓(𝑥 ) − 𝑥 𝑓(𝑥 )
𝑥 =
𝑓 𝑥 − 𝑓(𝑥 )
3. Make the following evaluations to determine in which
subinterval the root lies
a. If 𝑓 𝑥 𝑓 𝑥 < 0. the root lies in the lower subinterval.
Therefore, set 𝑥 = 𝑥 and return to step 2.
b. If 𝑓 𝑥 𝑓 𝑥 > 0. the root lies in the lower subinterval.
Therefore, set 𝑥 = 𝑥 and return to step 2.
c. If 𝑓 𝑥 𝑓 𝑥 = 0 or more accurately, if 𝑓 𝑥 < 0.001
and 𝜀 < 𝜀, the root equals 𝑥 ; terminate the computation.
18

9
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


1.2.2.2 Other Boundaries
1. Although the false-position method would seem to always be
the bracketing method of preference (false position is often
superior to bisection).
2. There are cases where it performs poorly (bisection yields
superior results) as shown in figure below.

19

1.2 Bracketing Methods


Problem 1-5
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 𝑥 − 3𝑥 − 6𝑥 + 8

20

10
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


Problem 1-6
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛 𝑥 − 𝑒

21

1.2 Bracketing Methods


Problem 1-7
Find the roots of the equation below with a stopping criterion of
0.0001.
𝑥 + 3 2𝑥 − 10
+ =3
𝑥 −5 𝑥 +3

22

11
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


Problem 1-8
Aerospace engineers compute the trajectories of the projectiles
like rockets. A related problem deals with the trajectory of a
thrown ball. The trajectory of a ball thrown by a right fielder is
defined by the (x, y) coordinates whose trajectory can be
modeled as:
𝑔𝑥
𝑦 = 𝑥 tan 𝜃 −
2𝑣 𝑐𝑜𝑠 𝜃
Find the approximate initial angle 𝜃 if 𝑣 = 20 𝑚/𝑠 and the
distance to second base is 40 m. Note that the throw leaves the
right fielder’s hand at an elevation of 1.8 m and the second
baseman receives it at 1 m.

23

1.2 Bracketing Methods


Problem 1-9
For the simply supported beam shown below. Determine the
location where the deflection is -1.00 mm. EI = 154,386.875 kN
m2, with a stopping criterion of 0.0001.

𝑑 𝑦 𝑀
=
𝑑𝑥 𝐸𝐼

24

12
Prepared by;
Gabriel I. Gamana, CE

1.2 Bracketing Methods


Determining Initial Guesses
• Plotting of the function is usually very useful in guiding you to
determine all possible roots.
• Another option is to incorporate an incremental search at the
beginning of the computer program. This consists of starting
at one end of the region of interest and then making function
evaluations at small increments across the region. When the
function changes sign, it is assumed that a root falls within
the increment.
• A partial remedy for such cases is to compute the first
derivative of the function at the beginning and the end of
each interval. If the derivative changes sign, it suggests that
a minimum or maximum may have occurred and that the
interval should be examined more closely for the existence of
a possible root.
25

1.3 Open Methods


In contrast, the open methods described in this chapter are
based on formulas that require only a single starting value of x
or two starting values that do not necessarily bracket the root. As
such, they sometimes diverge (move away) from the true root
as the computation progresses. However, when the open
methods converge, they usually do so much more quickly than
the bracketing methods.

26

13
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


1.3.1 Fixed-Point Method
Open methods employ a formula to predict the root. Such a
formula can be developed for simple fixed-point iteration (or, as
it is also called, one-point iteration or successive
substitution) by rearranging the function 𝑓 𝑥 = 0 so that 𝑥 is
on the left-hand side of the equation:
𝑓 𝑥 =𝑔 𝑥 −𝑥
0=𝑔 𝑥 −𝑥
𝑥 = 𝑔(𝑥 )

27

1.3 Open Methods


1.3.1.1 Convergence
• True percent relative error for each iteration is roughly
proportional to the error from the previous iteration. This
property, called linear convergence, and a characteristic of
fixed-point iteration.
• If 𝑔′ 𝑥 < 1 the errors decrease each iteration, therefore the
solution will converge.

28

14
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


• If 𝑔′ 𝑥 > 1 the errors increase each iteration, therefore the
solution will diverge.

29

1.3 Open Methods


Problem 1-10
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 𝑥 − 3𝑥 − 6𝑥 + 8

30

15
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


Problem 1-11
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛 𝑥 − 𝑒

31

1.3 Open Methods


1.3.2 Newton-Raphson Method
Newton's method, also known as Newton-Raphson's method
is another iteration method for solving equations 𝑓 𝑥 = 0 ,
where 𝑓 𝑥 is assumed to have a continuous derivative 𝑓′ 𝑥 .
The method is commonly used because of its simplicity and
great speed.

32

16
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


The underlying idea is that we approximate the graph of 𝑓 𝑥 by
suitable tangents. Using an approximate value 𝑥 obtained from
the graph of 𝑓 𝑥 , we let 𝑥 be the point of intersection of the
x-axis and the tangent to the curve of 𝑓 at 𝑥 .
𝑓 𝑥
𝑥 =𝑥 −
𝑓′ 𝑥

33

1.3 Open Methods


1.3.2.1 Convergence
• True percent relative error for each iteration is roughly
proportional to the square of the previous error.
• This means that the number of correct decimal places
approximately doubles with each iteration. Such behavior is
referred to as quadratic convergence.
−𝑓′′ 𝑥
𝜀 . ≅ 𝜀 ,
2𝑓′ 𝑥
• There is no general convergence criterion for Newton-
Raphson. Its convergence depends on the nature of the
function and on the accuracy of the initial guess. The only
remedy is to have an initial guess that is “sufficiently” close to
the root.

34

17
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


Problem 1-12
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 𝑥 − 3𝑥 − 6𝑥 + 8

35

1.3 Open Methods


Problem 1-13
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛 𝑥 − 𝑒

36

18
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


Problem 1-14
Find the roots of the equation below with a stopping criterion of
0.0001.
𝑥 + 3 2𝑥 − 10
+ =3
𝑥 −5 𝑥 +3

37

1.3 Open Methods


Problem 1-15
Aerospace engineers compute the trajectories of the projectiles
like rockets. A related problem deals with the trajectory of a
thrown ball. The trajectory of a ball thrown by a right fielder is
defined by the (x, y) coordinates whose trajectory can be
modeled as:
𝑔𝑥
𝑦 = 𝑥 tan 𝜃 −
2𝑣 𝑐𝑜𝑠 𝜃
Find the approximate initial angle 𝜃 if 𝑣 = 20 𝑚/𝑠 and the
distance to second base is 40 m. Note that the throw leaves the
right fielder’s hand at an elevation of 1.8 m and the second
baseman receives it at 1 m.

38

19
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


Problem 1-16
For the simply supported beam shown below. Determine the
location where the deflection is -1.00 mm. EI = 154,386.875 kN
m2, with a stopping criterion of 0.0001.

𝑑 𝑦 𝑀
=
𝑑𝑥 𝐸𝐼

39

1.3 Open Methods


Problem 1-17
The saturation concentration of dissolved oxygen in freshwater
can be calculated with the equation below where 𝜎 is the
saturation concentration of dissolved oxygen in freshwater at 1
atm (mg/L) and 𝑇 is the absolute temperature (𝐾). Determine
the maximum and minimum temperature in ( ℃ ) for the
recommended dissolved oxygen of 4-14 mg/L for shallow water
fish.

40

20
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


Problem 1-18
Find the positive root of the equation below with a stopping
criterion of 0.0001.
𝑓 𝑥 =𝑥 −1

41

1.3 Open Methods


1.3.3 Secant Method
Newton's method is very powerful but has the disadvantage that
the derivative 𝑓′ 𝑥 may sometimes be a far more difficult
expression than 𝑓 𝑥 itself and its evaluation therefore
computationally expensive. The derivative can be approximated
by a backward finite divided difference.
𝑓 𝑥 −𝑓 𝑥
𝑓′ 𝑥 ≅
𝑥 −𝑥

42

21
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


This approximation can be substituted into the Newton-Raphson
equation to yield the iterative equation:
𝑥 −𝑥
𝑥 =𝑥 −𝑓 𝑥
𝑓 𝑥 −𝑓 𝑥

43

1.3 Open Methods


1.3.3.1 Secant Method vs False-Position Method
• Note the similarity between the secant method and the false-
position method. Both use two initial estimates to compute
an approximation of the slope of the function that is used to
project to the x axis for a new estimate of the root.
• In false-position method two estimates always bracket the
root. Therefore, for all practical purposes, the method always
converges because the root is kept within the bracket.
• In contrast, the secant method replaces the values in strict
sequence, with the new value 𝑥 replacing 𝑥 and 𝑥
replacing 𝑥 . As a result, the two values can sometimes lie
on the same side of the root. For certain cases, this can lead
to divergence.

44

22
Prepared by;
Gabriel I. Gamana, CE

1.3 Open Methods


Problem 1-19
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 𝑥 − 3𝑥 − 6𝑥 + 8

45

1.3 Open Methods


Problem 1-20
Find the roots of the equation where 𝑓 𝑥 = 0 with a stopping
criterion of 0.0001.
𝑓 𝑥 = 3𝑥 + 𝑠𝑖𝑛 𝑥 − 𝑒

46

23
Prepared by;
Gabriel I. Gamana, CE

References
• Chapra, S. C. & Canale, R. P. “Numerical Methods for
Engineers” 7th Edition, McGraw-Hill Education, 2015
• Kreyszig, E. “Advanced Engineering Mathematics” 9th
Edition, John Wiley & Sons. Inc., Singapore, 2006

47

24

You might also like