003 Primer On Mathematics
003 Primer On Mathematics
003 Primer On Mathematics
1
Abdelal
This discussion will involve some mathematical
tools and methods and their applications in
engineering.
2
Abdelal
Models here are built using algebraic equations
that are not a function of time. They could be
linear or non-linear.
Y = aX +b (linear)
3
Abdelal
These are typically described by differential
equations, which are equations that contain
one or more derivatives.
1. Ordinary differential equations when there
is only one independent variable
𝒅𝒚
= 𝟓𝒙𝟐 + 𝟑 for example
𝒅𝒙
2. Partial differential equation, when there are
more than one independent variable
𝝏𝟐 𝒖
𝑼𝒕 = + 𝒆−𝒕 for example
𝝏𝒙𝟐
4
Abdelal
Mathematical analysis can be either analytical or
computational (Numerical)
5
Abdelal
Simple algebraic •Steady state concentration of a
equations contaminant in a completely mixed lake
6
Abdelal
7
Abdelal
Simple algebraic •Steady state concentration of a
equations contaminant in a completely mixed lake
8
Abdelal
The solution (root) is the independent variable
X, that when substituted into f(x) will make it
equal to zero.
a) Single linear equation, one variable, straight
forward.
b) A set of linear equations: typical examples
of these include chemical speciation
calculations
𝑎11 𝑥1 + 𝑎12 𝑥2 + 𝑎13 𝑥3 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 + 𝑎23 𝑥3 = 𝑏2
𝑎31 𝑥1 + 𝑎32 𝑥2 + 𝑎33 𝑥3 = 𝑏3
9
Abdelal
𝑎11 𝑥1 + 𝑎12 𝑥2 + 𝑎13 𝑥3 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 + 𝑎23 𝑥3 = 𝑏2
𝑎31 𝑥1 + 𝑎32 𝑥2 + 𝑎33 𝑥3 = 𝑏3
Here, m = number of equations = 3
n = number of varaiables = 3
If n = m then there is a unique solution.
The equations above can be represented in a
matrix format
Ax= b
Where x is the solution matrix x=A-1b
10
Abdelal
One method to solve these sets of equations is
using the Gauss-Seidel method.
11
Abdelal
Example: Solve the following set of equations
12
Abdelal
Another method for solving the system of
linear equations is Gauss elimination, this is
the method used by software such as Excel
solver.
13
Abdelal
14
Abdelal
c) Single, nonlinear equation
Here , the solution is either direct or indirect.
15
Abdelal
Indirect methods, repeated application of some
algorithm is implemented to yield an
approximate solution.
16
Abdelal
1- The Binary method
◦ Guess the values of XL and Xu those will bracket the
real root X such that XL < X and Xu>X. Also,
f(XL).f(Xu)<0.
◦ A new X, called Xr, is obtained, the process above is
repeated with either XL, Xr or with Xr, Xu depending
on wither the product of f(XL)f(Xr)<0 or f(Xu)f(Xr)<0
Xr=(XL+Xu)/2
◦ The process is repeated until the new guess is very
close to the old one.
17
Abdelal
k = 0.25 (1/day)
18
Abdelal
2- The Newton Raphson Method
Based on Taylor’s expansion which is based on
the statement that each smooth function can
be approximated as a polynomial
h here is Xn+1-Xn
19
Abdelal
Abdelal Wikipedia 20
The first derivative of the function at X is
equivalent to the slope
′
𝑓 𝑥𝑖 − 0
𝑓 𝑥𝑖 =
𝑥𝑖− 𝑥𝑖+1
Rearranging:
𝑓(𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 − ′
𝑓 (𝑥𝑖 )
22
Abdelal
Simple algebraic •Steady state concentration of a
equations contaminant in a completely mixed lake
23
Abdelal
Most environmental systems can be modeled as
ODE
24
Abdelal
If the values are other than zero, they are
referred to as boundary value problems.
25
Abdelal
A) Analytical solution of the ODE
The general form of an ODE may be stated as
follows:
with an IC of
27
Abdelal
2- First-order nonhomogeneous linear
equations: when an ODE can be expressed in
the form
29
Abdelal
Where s is given by:
30
Abdelal
4- Second-order equation with constant
coefficients: when the ODE can be expressed in
the form:
31
Abdelal
Where s is given by:
32
Abdelal
Example:
The buildup of the concentration, C, in a lake
due to a new step waste load input can be
described by the following equation
33
Abdelal
34
Abdelal
35
Abdelal
B-Computational Solutions of ODEs
Two of the more common computational
methods used for solving such equations,
Euler’s Method and the Runge-Kutta Method,
36
Abdelal
By ignoring terms of h2 and higher order, the
equation can be approximated by the
following:
37
Abdelal
Example:
Solve the previous
example numerically
38
Abdelal
39
Abdelal
1- Runge-Kutta method: the error in Euler’s
method stems from the assumption that the
slope at the beginning of the calculation step is
the same over the entire step.
40
Abdelal
Here, f is the derivative function, xn is the
independent variable, yn is the dependent variable
41
Abdelal
Example:
Employ the Runge Kutta method to integrate Y’
where:
Y’ =4e0.8t-0.5y
From t=0 to 1 using a step size of 1 with Y(0)
=2
42
Abdelal
43
Abdelal
44
Abdelal
Systems of coupled ODEs are rather common in
many environmental systems.
45
Abdelal
Higher order ODE need to be reduced to first
order equations, for example:
46
Abdelal
Hence, the original problem is now equivalent
to one with two coupled ODEs:
47
Abdelal
Simple algebraic •Steady state concentration of a
equations contaminant in a completely mixed lake
48
Abdelal
These are used when dependent variables are
expressed in more than one independent
variable.
49
Abdelal
To solve these, initial and boundary conditions
are required
50
Abdelal
Finite difference:
The continuous
model depicted by
the conceptual
model is replaced
with a set of
discrete points
arranged in a grid
pattern. Finite
difference grid.
51
Abdelal
Here the partial derivative is approximated by
difference according to Taylor’s expansion.
The procedure is as follows:
1- The problem domain is first divided into a
grid of n node points
2- The PDE is approximated
by difference equations
relating the functional
value at neighboring
points in the grid.
52
Abdelal
Finite difference:
3- Then, the resulting set of n equations in n
unknowns is solved to obtain the approximate
solution values at the node points
53
Abdelal
Consider the forward Taylor series expansion of a
function h(x) near a point x
h(x)
Solve for 1st derivative
h(x)
x x
x
x x x x x
h(x)
x x
x
x x x x x
hi-1 hi+1
hi
x x
x
ii-1 i i +1
𝑙 𝑙 𝑙 𝑙 𝑙
𝜕ℎ ℎ𝑖+1 − ℎ𝑖𝑙 𝜕ℎ ℎ𝑖+1 − ℎ𝑖−1
≈ ≈
𝜕𝑥 𝑖 ∆𝑥 𝜕𝑥 2∆𝑥
𝑖
1st x Derivative 1stx Derivative 1stx Derivative
(Backward) (Forward) (Central difference)
1st t Derivative i, l 1
(Backward) t
i 1, l i 1, l
i, l
x, i
x
i, l 1
1st t Derivative
(Forward)
hi-1 hi+1
hi
x x
i -1 i -1/ 2 i i +1/ 2 i +1
62
Abdelal
63
Abdelal
Consider a two dimensional steady state
governing equation for homogeneous isotropic
aquifers (Laplace equation)
𝜕2ℎ 𝜕2ℎ
2
+ 2=0
𝜕𝑥 𝜕𝑧
Develop the finite difference formulation for a
regular grid where a ∆x and ∆z are constant.
64
Abdelal
65
Abdelal
66
Abdelal