Math 5 - Numerical Soltuions To Ce Problems: B S C E
Math 5 - Numerical Soltuions To Ce Problems: B S C E
College of Engineering
1 | Numerical Solutions to CE Problems 2
PREFACE
The main purpose of this module is to provide the student with a clear and detailed
presentation of the theory and application of engineering mechanics.
To achieve this objective despite of this pandemic due to COVID-19, this work has
been shaped by the comments and suggestions of the peer reviewer in the teaching
profession, as well as the other faculty members who will ensure quality of the
modules that will be distributed to the LGU.
The course Numerical Methods deals with the study of direct and iterative
numerical methods in engineering, determination of error bounds in calculations,
computation of series expansions, roots of algebraic and transcendental equations,
numerical differentiation and integration, solution to simultaneous linear and non-
linear equations, function approximation and interpolation, differential equations,
optimization, and their applications.
In this course, we will be using a particular software that could help us solve
different types of engineering problems from easy to a difficult one. The course
provides background on numerical analysis needed to solve civil engineering
problems numerically when their analytical solution is either not available or
difficult to obtain. MATLAB programming environment or its equivalent will be
introduced and used in the course.
2|P a g e
1 | Numerical Solutions to CE Problems 3
1.1 Introduction
Pre – Assessment
Solve the following problems.
Evaluation Criteria:
1. Timeliness 50%
2. Correctness 20%
3. Organization of Solution & Answer 20%
4. Cleanliness 10%
100%
1. ∫ 𝟒𝒙𝟔 − 𝟐𝒙𝟑 + 𝟕𝒙 − 𝟒 𝒅𝒙
2. ∫ 𝒙𝟕 − 𝟒𝟖𝒛𝟏𝟏 − 𝟓𝒛𝟏𝟔 𝒅𝒛
3. ∫ 𝟏𝟎𝒕−𝟑 + 𝟏𝟐𝒕−𝟗 + 𝟒𝒕𝟑 𝒅𝒕
4. ∫ 𝒘−𝟐 + 𝟏𝟎𝒘−𝟓 − 𝟖 𝒅𝒘
5. ∫ 𝟏𝟐𝒅𝒚
3|P a g e
1 | Numerical Solutions to CE Problems 4
Integral
Example 1. You can think of the derivative as representing a rate of change (speed
is one example of this). This makes it very useful for solving physics
problems.
From Physics problem statements:
𝒅𝒒
1. If 𝒒 is an amount of electric charge, the derivative is the change in that
𝒅𝒕
charge over time, or the electric current.
2. A second, more tangible example is to let s stand for distance; then the rate
𝒅𝒔
of change is what we call speed. Let’s investigate this second example in
𝒅𝒕
more detail to get a visceral sense of what instantaneous speed means.
4|P a g e
1 | Numerical Solutions to CE Problems 5
𝑑
ℎ = 0 − 10𝑡 = −10𝑡
𝑑𝑡
We know that the pumpkin hits the pavement 4 seconds after it’s dropped,
at time 𝑡 = 4, so the pumpkin’s speed is:
𝑚
ℎ′ (4) = (−10)(4) = −40 (𝑎𝑏𝑜𝑢𝑡 90 𝑚𝑝ℎ 𝑜𝑟 145 𝑘𝑝ℎ).
𝑠
5|P a g e
1 | Numerical Solutions to CE Problems 6
By examining these it’s not hard to discern the general pattern. The 𝑘𝑡ℎ
derivative must be
∞
𝑛=𝑘
Now substitute 𝑥 = 0:
∞
𝑛!
𝑓 𝑘 (0) = 𝑘! 𝑎𝑘 + ∑ 𝑎 0𝑛−𝑘 = 𝑘! 𝑎𝑘 ,
(𝑛 − 𝑘 ) ! 𝑛
𝑛=𝑘+1
𝑓 𝑘 (0)
𝑎𝑘 = .
𝑘!
Note the special case, obtained from the series for 𝑓 itself, that gives
𝑓(0) = 𝑎0.
So if a function 𝑓 can be represented by a series, we know just what series
it is. Given a function 𝑓, the series
∞
𝑓 (0) (0) 𝑛
∑ 𝑥
𝑛!
𝑛=0
is called the Maclaurin series for 𝑓.
1
Example 2. Find the Maclaurin series for 𝑓(𝑥 ) = (1−𝑥). We need to compute the
derivatives of 𝑓 (spot the pattern).
𝑓 (𝑥 ) = (1 − 𝑥)−1
𝑓′(𝑥 ) = (1 − 𝑥)−2
𝑓′′(𝑥) = 2(1 − 𝑥)−3
𝑓′′′(𝑥 ) = 3(1 − 𝑥)−4
𝑓 (4) (𝑥 ) = 4! (1 − 𝑥)−5
⋮
𝑓 𝑥 = 𝑛! (1 − 𝑥)−𝑛−1
𝑛( )
So
6|P a g e
1 | Numerical Solutions to CE Problems 7
∑ 1 ∙ 𝑥𝑛 = ∑ 𝑥𝑛
𝑛=0 𝑛=0
Note:
Matrix
- A matrix is a rectangular collection of variables or scalars contained within
a set of square [ ] or round ( ) brackets. A matrix consist of 𝑚 rows and 𝑛
columns.
Classification of Matrices
- Square Matrix
o A matrix whose number of rows 𝑚 is equal to the number of
columns 𝑛.
- Diagonal Matrix
o A diagonal matrix is a square matrix with all zero values except for
the 𝑎𝑖𝑗 value for all 𝑖 = 𝑗.
2 0 0
[0 3 0]
0 0 1
- Identity Matrix
o An identity matrix is a diagonal matrix with all non-zero entries
equal to 1.
1 0 0
[0 1 0]
0 0 1
- Scalar Matrix
o A scalar matrix is a diagonal matrix with all non-zero entries equal
to some other constant.
8 0 0
[0 8 0]
0 0 8
7|P a g e
1 | Numerical Solutions to CE Problems 8
- Triangular Matrix
o A triangular matrix has zero in all positions above or below the
diagonal.
Example.
1 4 1 3 0 2
Add [ 7 1 6] + [2 5 6]
−3 0 4 9 1 1
1+3 4+0 1+2 4 4 3
= [ 7 + 2 1 + 5 6 + 6] = [9 6 12]
−3 + 9 0 + 1 4 + 1 6 1 5
3. Multiplication of Matrices
- Multiplication of matrix can be done only if the number of columns of the
left-hand matrix is equal to the number of rows of the right-hand matrix.
Multiplication is accomplished by multiplying the elements in each right-
hand matrix column, adding the products, and then placing the sum at the
intersection point of the involved row and column.
Example 1.
2 3 1 3
If 𝐴 = [ ] 𝑎𝑛𝑑 𝐵 = [ ], find 𝐴 × 𝐵.
3 10 5 −2
Solution:
2 3 1 3
𝐴×𝐵 = [ ][ ]
3 10 5 −2
Example 2.
2 2(2) + 1(4) + 5(1)
2 1 5 𝟏𝟑
[ ] × [4] = [ ]=[ ]
1 4 7 1( 2) + 4 ( 4) + 7(1) 𝟐𝟓
1
Example 3.
8|P a g e
1 | Numerical Solutions to CE Problems 9
1 3 𝑥 5
If [ ] [ ] = [ ] then
2 4 𝑦 6
1𝑥 + 3𝑦 = 5
2𝑥 + 4𝑦 = 6
4. Division of Matrices
- Division of matrices can be accomplished only by multiplying the inverse
of the denominator matrix.
Example:
1 6 9
Determine the transpose of 𝐴 = [2 3 4]
7 1 5
Solution:
𝟏 𝟔 𝟗
𝑨 = [𝟐 𝟑 𝟒]
𝟕 𝟏 𝟓
Properties of Determinants
A. If a matrix has a row or column of zeros, the determinant is zero.
1 4 0 2 1 5
|4 5 0 | = 0 |0 0 0| = 0
1 7 0 4 1 9
1 2 5 2 1 5
|4 6 1 | = 0 |0 0 0| = 0
1 2 5 4 1 9
9|P a g e
1 | Numerical Solutions to CE Problems 10
2 0 0
|0 3 0| = 2(3)(5)
0 0 5
1 4 6 1 2 1
|2 5 2| = |4 5 7| = 0
1 7 9 6 2 9
E. If each of a column or row of a determinant is multiplied by 𝑚, the value
of the determinant is multiplied by 𝑚.
1 4 5 1 2×2 5 1 2 5
|4 6 1| = |4 3 × 2 1| = 2 |4 3 1|
2 8 4 2 4×2 4 2 4 4
1 4 5 1 4 5 + 1(3) 1 4 8
|4 6 1| = |4 6 1 + 4(3)| = |4 6 13|
2 8 4 2 8 4 + 2(3) 2 8 10
10 | P a g e
1 | Numerical Solutions to CE Problems 11
determinants and the second term form the 𝑘 𝑡ℎ column of the other
determinant.
4 1 2 2 1 2 2 1 2
|6 2 3| = | 5 2 3 | + | 1 2 3|
2 5 1 1 5 1 1 5 1
Example 1. Solve for x: (2nd order)
4 5
𝑥=| | = 4(3) − 2(5) = 2
2 3
Example 2. Solve for x: (3rd order)
1 −3 2
𝑥 = |2 1 −4|
3 −2 1
1 −4 −3 2 −3 2
𝑥 = 1| | − 2| |+3| |
−2 1 −2 1 1 −4
𝑥 = 1(1 − 8) − 2(−3 + 4) + 3(12 − 2) = 𝟐𝟏
+ − +
Use of sign: |− + −|
+ − +
Another Solution:
1 −3 2 1 −3
𝑥 = |2 1 −4| 2 1|
3 −2 1 3 −2
𝑥 = [1(1)(1) ± 3(−4)(3) + 2(2)(−2)]
− [3(1)(2) + (−2)(−4)(1) + 1(2)(−3)]
𝒙 = 𝟐𝟏
Example 3. Solve for x: (4th order)
2 0 1 −1
𝑥 = |1 2 −2 3|
3 −2 3 −2
4 −4 −2 − 3
By pivotal element method, select the element in the second row, first
column (since it’s unity)
11 | P a g e
1 | Numerical Solutions to CE Problems 12
−4 5 −7 −4 5
𝑥 = −1 | −8 9 −11| −8 9|
−12 6 −15 −12 6
𝑥 = −1{[540 + 660 + 336] − [756 + 264 + 600]} = 𝟖𝟒
+ − +
|− + − |
+ − +
or, the sign of the cofactor can be determined by the relation (−1)𝑖+𝑗 , where
𝑖 is column number and 𝑗 is the row number.
4. Classical Adjoint
The classical adjoint is a matrix formed from the transposed cofactor
matrix with the conventional sign arrangement. The resulting matrix is
represented as 𝐴𝑎𝑑𝑗 .
After solving the cofactors of each entry, the matrix of cofactors is:
12 | P a g e
1 | Numerical Solutions to CE Problems 13
−18 2 4
[−11 −14 5]
−10 −4 −8
The classical adjoint is
−18 −11 −10
𝐴𝑎𝑑𝑗 = [ 2 14 −4 ]
4 5 −8
The inverse, 𝐴−1 , of a matrix A is a matrix such that (𝐴)( 𝐴−1 ) = 𝐼, where
𝐼 is a square matrix with ones along the left-to-right diagonal and zeros
elsewhere.
4 5
Example 1. Determine the inverse of [ ]
2 3
Solution: The determinant is:
4 5
𝐷=| | = 4(3) − 2(5) = 2
2 3
The inverse is:
1 3 −5 3/2 −5/2
[ ]=[ ]
2 −2 4 −1 2
13 | P a g e
1 | Numerical Solutions to CE Problems 14
2.1 Introduction
Features of MATLAB
14 | P a g e
1 | Numerical Solutions to CE Problems 15
Uses of MATLAB
MATLAB is widely used as a computational tool in science and engineering
encompassing the fields of physics, chemistry, math and all engineering streams.
It is used in a range of applications including:
signal processing and Communications
image and video Processing
control systems
test and measurement
computational finance
computational biology
15 | P a g e
1 | Numerical Solutions to CE Problems 16
1. Current Folder - This panel allows you to access the project folders and files.
2. Command Window - This is the main area where commands can be entered at
the command line. It is indicated by the command prompt (>>).
16 | P a g e
1 | Numerical Solutions to CE Problems 17
17 | P a g e
1 | Numerical Solutions to CE Problems 18
Basic Syntax
Practice!
Type a valid expression, for example,
when you click the Execute button, or type Ctrl+E, MATLAB executes it
immediately and the result returned is:
when you click the Execute button, or type Ctrl+E, MATLAB executes it
immediately and the result returned is:
another example,
When you click the Execute button, or type Ctrl+E, MATLAB executes it
immediately and the result returned is:
Another example,
18 | P a g e
1 | Numerical Solutions to CE Problems 19
When you click the Execute button, or type Ctrl+E, MATLAB executes it
immediately and the result returned is:
Another example,
When you click the Execute button, or type Ctrl+E, MATLAB executes it
immediately and the result returned is:
MATLAB provides some special expressions for some mathematical symbols, like
pi for π, Inf for ∞, i (and j) for √-1 etc. Nan stands for 'not a number'.
Semicolon (;) indicates end of statement. However, if you want to suppress and
hide the MATLAB output for an expression, add a semicolon after the expression.
For example,
When you click the Execute button, or type Ctrl+E, MATLAB executes it
immediately and the result returned is:
19 | P a g e
1 | Numerical Solutions to CE Problems 20
Adding Comments
The percent symbol (%) is used for indicating a comment line. For example,
You can also write a block of comments using the block comment operators % {
and % }.
The MATLAB editor includes tools and context menu items to help you add,
remove, or change the format of comments.
Operator Purpose
+ Plus; addition operator
- Minus; subtraction operator
* Scalar and matrix multiplication operator
.* Array multiplication operator
^ Scalar and matrix exponentiation operator
.^ Array exponentiation operator
\ Left-division operator
/ Right-division operator
.\ Array left-division operator
./ Array right-division operator
: Colon; generates regularly spaced elements and represents an
entire row or column.
() Parentheses; encloses function arguments and array indices;
overrides precedence.
[ ] Brackets; enclosures array elements.
. Decimal point
… Ellipsis; line-continuation operator
, Comma; separates statements and elements in a row
; Semicolon; separates columns and suppresses display
% Percent sign; designates a comment and specifies formatting
- Quote sign and transpose operator
˙_ Non-conjugated transpose operator
= Assignment proper
20 | P a g e
1 | Numerical Solutions to CE Problems 21
Name Meaning
ans Most recent answer
eps Accuracy of floating-point precision
i,j The imaginary unit √-1.
Inf Infinity
Nan Undefined numerical result (not a number)
pi The number n
Naming Variables
Variable names consist of a letter followed by any number of letters, digits or
underscore.
MATLAB is case-sensitive.
Variable names can be of any length, however, MATLAB uses only first N characters,
where N is given by the function namelengthmax.
How to save your work?
The save command is used for saving all the variables in the workspace, as a file with
.mat extension, in the current directory.
For example,
You can reload the file anytime later using the load command.
21 | P a g e
1 | Numerical Solutions to CE Problems 22
22 | P a g e
1 | Numerical Solutions to CE Problems 23
23 | P a g e
1 | Numerical Solutions to CE Problems 24
24 | P a g e
1 | Numerical Solutions to CE Problems 25
Post – Assessment. Solve the following problems. Show your complete solution.
Evaluation Criteria:
Timeliness 50%
Correctness 20%
Organization of Solution & Answer 20%
Cleanliness 10%
100%
1. [𝐸] + [𝐵]
2. [𝐴] + [𝐹]
2
{𝐶 } = {6} [𝐷 ] = [5 4 3 − 7] 3. [𝐵] − [𝐸]
2 1 7 5 4. 7 × [𝐵]
1
5. {𝐶 }𝑇
6. [𝐸] × [𝐵]
1 5 6 7. [𝐵] × [𝐸]
[𝐸] = [7 1 3] 8. [𝐷 ]𝑇
4 0 6 9. [𝐺] × {𝐶 }
10. [𝐼 ] × [𝐵]
[𝐹 ] = [2 0 1
] ⌊𝐺 ⌋ = ⌊8 6 4⌋ 11. [𝐸]𝑇 × [𝐸]
1 7 4
12. {𝐶 }𝑇 × {𝐶 }
25 | P a g e
1 | Numerical Solutions to CE Problems 26
2.3 References
1. Ayyub, BilaL. Numerical Analysis for Engineers. 2016.
2. Tutorials Point (I) Pvt.Ltd. MATLAB Numerical Computing. 2014.
3. Kreyszig, E. and Norminton, E. 10th Edition. 2011.
2.4 Acknowledgement
The images, tables, figures and information contained in this module were
taken from the references cited above.
26 | P a g e
1 | Numerical Solutions to CE Problems 27
6700
27 | P a g e
1 | Numerical Solutions to CE Problems 28
28 | P a g e