Numerical Solutions to CE Problems
LABORATORY MANUAL
Name:
Rating
Date:
I.
OBJECTIVE
1. To provide a laboratory manual to understand and explain basic numerical methods
used to solve mathematical problems in civil engineering applications.
2. To provide the implementation of algorithms using appropriate software tools (e.g.
MATLAB and Excel) to model and analyze civil engineering systems.
3. Apply numerical techniques such as root-finding, matrix operations, interpolation,
and numerical differentiation/integration to solve CE-related problems.
1
TABLE OF CONTENT
Descriptives
Pages
Introduction to Methods in finding Roots of Non-Linear Equation
Bisection Method
Method of False Position (Regula Falsi)
Newton-Raphson Method
Secant Method
Formatted: Left
2
Methods in finding Roots of Non-Linear Equation:
Introduction
There are two leading groups of methods in solving the function's roots: closed and open methods.
Some of the closed methods are:
1. Bisection Method
2. Method of False Position (Regula Falsi)
While the open methods are:
1. Newton-Raphson Method
2. Secant Method
3
CLOSED METHODS
Bisection Method:
The following is the step-by-step procedure to perform the Bisection Method:
1. Determine the values which are its upper and lower limits.
2. Determine the middle point value using the formula: 𝑋𝑚 = (𝑋𝑢 + 𝑋𝑙)/2, where Xu is
the upper limit or the upper interval and the Xl is the lower limit or the lower interval.
3. To choose the new interval for the new iteration remember the following:
a. If any of the f(Xl) and f(Xu) is the opposite sign of f(Xm). The interval will be retained
by the opposite sign of f(Xm) and the f(Xm).
b. Repeat the process.
Example:
Determine the root of 3𝑥^4 + 7𝑥^3 −15𝑥^2 +5𝑥 = 17 between [0, 2]. Use bisection method and
perform seven iterations.
Let the upper limit (Xu) be equal to 0 and the lower limit (Xl) be equal to 2
i
XL
XM
XU
fXL
fXM
fXU
FXLxfXm FXUxFXM
ERROR
1
0
1
2
-17
-17
37
289
-629
2
2
1
1.5
2
-17
-4.4375
37
75.4375
-164.188
1
3
1.5
1.75
2
-4.4375
11.46484
37
-50.8752
424.1992
0.5
4
1.5
1.625
1.75
-4.4375
2.471436 11.46484
-10.967
28.33462
0.25
5
1.5
1.5625
1.625
-4.4375
-1.22432 2.471436
5.432918
-3.02583
0.125
6
1.5625
1.59375
1.625
-1.22432
0.56087 2.471436
-0.68668
1.386154
0.0625
7
1.5625
1.578125
1.59375
-1.22432
-0.3471
0.424959
-0.19468 0.03125
0.56087
CHART:
BISECTION METHOD
30
20
10
0
-10
0
0.5
1
1.5
2
-20
4
Method of False Position (Regula Falsi):
The following is the step-by-step procedure to perform the False Position (Regula Falsi):
1.Determine the values which are its upper and lower limits.
𝑋𝑙𝑓(𝑋𝑢)−𝑋𝑢𝑓(𝑋𝑙)
2. Determine the middle point value using the formula: Xm=
𝑓(𝑋𝑢)−𝑓(𝑋𝑙)
,where Xu is the
upper limit or the upper interval and the Xl is the lower limit or the lower interval.
3. To choose the new interval for the new iteration remember the following:
a. If any of the f(Xl) and f(Xu) is the opposite sign of f(Xm). The interval will be retained
by the opposite sign of f(Xm) and the f(Xm).
b. Repeat the process.
Example: Determine the root of 3𝑥^4 + 7𝑥^3 −15𝑥^2 +5𝑥 = 17 between [0, 2]. Use bisection
method and perform seven iterations.
Let the upper limit (Xu) be equal to 0 and the lower limit (Xl) be equal to 2
i
XL
XM
XU
FXL
FXM
FXU
FXLxFXM FXUxFXM ERROR
1
0
0.62963
2
-17
-17.5796
37
298.8537
-650.446
2
2
0.62963
1.071014
2
-17.5796
-16.304
37
286.6178
-603.247
1.37037
3
1.071014
1.355161
2
-16.304
-10.2324
37
166.8294
-378.6 0.928986
4
1.355161
1.494859
2
-10.2324
-4.68148
37
47.90293
-173.215 0.644839
5
1.494859
1.551594
2
-4.68148
-1.81869
37
8.514158
-67.2915 0.505141
6
1.551594
1.572602
2
-1.81869
-0.66063
37
1.201482
-24.4433 0.448406
7
1.572602
1.5801
2
-0.66063
-0.23406
37
0.154626
-8.66018 0.427398
8
1.5801
1.582739
2
-0.23406
-0.08219
37
0.019237
-3.04105
0.4199
9
1.582739
1.583664
2
-0.08219
-0.02877
37
0.002365
-1.06453 0.417261
10
1.583664
1.583988
2
-0.02877
-0.01006
37
0.000289
-0.37223 0.416336
11
1.583988
1.584101
2
-0.01006
-0.00352
37
3.54E-05
-0.13011 0.416012
12
1.584101
1.58414
2
-0.00352
-0.00123
37
4.32E-06
-0.04547 0.415899
CHART:
FALSE POSITION CHART
50
0
0
0.5
1
1.5
2
-50
5
OPEN METHODS:
NEWTON-RAPHSON METHOD:
The following is the step-by-step procedure to perform the Newton-Rapson Method:
1. Choose the Xn value depending to the graph given if not then let a constant be its Xn
value.
2. Given the equation get the derivative.
3. Substitute the Xn value to get the values of f(x) and f’(x).
𝑓(𝑥)
4. To find the Xn for the next iteration use the equation: 𝑋𝑛 + 1 = 𝑋𝑛 𝑓′(𝑥)
5. Repeat.
Example: Determine the root of 3𝑥^4 + 7𝑥^3 −15𝑥^2 +5𝑥 = 17. Use Newton-Raphson Method
and perform 10 iterations.
Let Xn be equal to 3
F’(x)=12x^3+21x^2-30x+5
iterations
1
2
3
4
5
6
7
8
9
10
Xn
f(x)
f'(x)
3
2.310748
1.869832
1.648163
1.588287
1.58418
1.584161
1.584161
1.584161
1.584161
295
86.3615
22.33893
3.971329
0.239897
0.001074
2.18E-08
0
0
0
428
195.8686
100.7761
66.32605
58.4076
57.88514
57.88279
57.88279
57.88279
57.88279
NEWTON RHAPSON
500
400
300
200
100
0
0
1
2
fx
3
4
f'x
6
SECANT METHOD
The following is the step-by-step procedure to perform the Secant Method:
1. Set you’re a and b values
2. Substitute the a and b values to get the values of f(x).
𝑓(𝑏)(𝑏−𝑎)
3. to get the next iteration use the equation: 𝑋𝑛 = 𝑏 𝑓(𝑏)−𝑓(𝑎)
4. Remember to start the iterations at b not at a and to leap one at a time from a-b to b-Xn as
its new point to get the values
Example: Determine the root of 3𝑥4 + 7𝑥3 −15𝑥2 +5𝑥 = 17. Use Secant Method and perform 10
iterations.
Let a be equal to 2
Let b be equal to 3
iterations Xn
1
2
3
4
5
6
7
8
9
10
2
3
1.856589
1.768867
1.626006
1.591474
1.584486
1.584164
1.584161
1.584161
1.584161
fx
37
295
21.01958
13.02302
2.535067
0.426701
0.018783
0.00015
5.32E-08
1.56E-13
0
SECANT METHOD
350
300
250
200
150
100
50
0
0
0.5
1
1.5
2
2.5
3
3.5
7