Advanced Computational Methods
Advanced Computational Methods
Lecture 1
Review of Numerical Methods
Algorithm
a+b
1 Start with the interval [a, b ] and compute the midpoint c = 2 .
2 Evaluate f (c) and determine the new interval [a, c] or [c, b ] based
on the sign of f (a) · f (c).
3 Repeat until the desired accuracy is achieved.
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
7 / 153
Example
Use the Bisection method to find a root of the equation
x 3 − 4x − 8.95 = 0 accurate to three decimal places.
Solution
Here, f (x) = x 3 − 4x − 8.95 = 0
f (xn )
xn+1 = xn − (1)
f ′ (xn )
f (xn )
xn+1 = xn − (2)
f ′ (xn )
• Iteration 1:
• x1 = 2 − 24 = 1.5
• Iteration 2:
• x2 = 1.5 − −0.25
3 = 1.41
• Continue iterating until convergence is achieved.
Jacobi Method
- Decomposes matrix A into D , L , and U .
- Iteration formula updates each component of x based on previous
values.
- New estimates for unknown variables are calculated using previous
estimates.
Gauss-Seidel Method
- Decomposes matrix A into L , D , and U .
- Updates each component of x in a sequential manner.
- Uses most recent component values for calculating subsequent
values.
Both methods converge to the exact solution under certain
conditions, such as diagonal dominance of A or positive definiteness.
3x1 + x2 = 9
x1 + 2x2 = 8
Using the Jacobi method, we can iterate to find the solution to this
system.
h i
tarting with an initial guess x (0) = 0 0 , the Jacobi iteration formula is
given by:
x (k +1) = D −1 (b − (L + U )x (k ) )
where D is the diagonal of A , L is the lower triangular part of A , and U
is the upper triangular part of A .
We iterate until convergence to get the solution.
b 1
(k ) (k ) (k )
x1 (k +1) = 1 − a12 x2 + a13 x3 + · · · a1n xn
a11 a11
b2 1
(k +1) (k ) (k ) (k )
x2 = − a x + a23 x3 + · · · a2n xn
a22 a22 21 1
b3 1
(k +1) (k ) (k ) (k )
x3 = − a x + a32 x2 + · · · a3n xn
a33 a33 31 1
..
.
bn 1
(k +1) (k ) (k ) (k )
xn = − a x + an2 x3 + · · · an(n−1) xn−1
ann ann n1 1
The process is continued till convergence is secured.
5x1 + x2 + 2x3 = 10
−3x1 + 9x2 + 4x3 = −14
x1 + 2x2 + 7x3 = −33
using the Gauss-Seidel method correct to two decimal places, with the
h iT
initial approximation x (0) = 0 0 0 .
1 (0)
(1) (0)
x1 =2 − x2 + 2x3 = 2
5
14 1
(1) (1) (0)
x2 = − − −x1 + 4x3 = −0.8889
9 9
33 1 (1)
(1) (1)
x3 = − − x + 2x2 = −4.746
7 7 1
• Second approximation:
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
32 / 153
Gauss-Seidel Method
3x1 + x2 = 9 x1 + 2x2 =8
Introduction
• A differential equation is an equation that contains derivatives of
an unknown function.
Introduction
• A differential equation is an equation that contains derivatives of
an unknown function.
• ODE: An equation involving the derivatives of an unknown
function y of a single variable x over an interval x ∈ (I ).
Introduction
• A differential equation is an equation that contains derivatives of
an unknown function.
• ODE: An equation involving the derivatives of an unknown
function y of a single variable x over an interval x ∈ (I ).
• Ordinary Differential Equations (ODEs) are equations involving an
unknown function of one variable and its derivatives.
Introduction
• A differential equation is an equation that contains derivatives of
an unknown function.
• ODE: An equation involving the derivatives of an unknown
function y of a single variable x over an interval x ∈ (I ).
• Ordinary Differential Equations (ODEs) are equations involving an
unknown function of one variable and its derivatives.
• Numerical methods are often used to approximate the solutions
of ODEs when analytical solutions are not possible.
yi +1 = yi + hf (ti , yi )
Example
dy
Consider the differential equation dt = −2y with the initial condition
y(0) = 1.
Example
Consider the differential equation dy
dt = −2y with the initial condition
y(0) = 1.Approximate the solution using the explicit Euler method with
a time step size of h = 0.1.
Example
Consider the differential equation dy
dt = −2y with the initial condition
y(0) = 1.Approximate the solution using the explicit Euler method with
a time step size of h = 0.1.
Solution
At time t = 0, y(0) = 1. Using the explicit Euler method:
Example
Consider the differential equation dy
dt = −2y with the initial condition
y(0) = 1.Approximate the solution using the explicit Euler method with
a time step size of h = 0.1.
Solution
At time t = 0, y(0) = 1. Using the explicit Euler method:
Example
Consider the differential equation dy
dt = −2y with the initial condition
y(0) = 1.Approximate the solution using the explicit Euler method with
a time step size of h = 0.1.
Solution
At time t = 0, y(0) = 1. Using the explicit Euler method:
Example
Consider the differential equation dy
dt = −2y with the initial condition
y(0) = 1.Approximate the solution using the explicit Euler method with
a time step size of h = 0.1.
Solution
At time t = 0, y(0) = 1. Using the explicit Euler method:
yi +1 = yi + h (ti − yi )
y1 = 1 + 0.1(0 − 1) = 1 − 0.1 = 0.9
y2 = 0.9 + 0.1(0.1 − 0.9) = 0.9 + 0.1(−0.8) = 0.9 − 0.08 = 0.82
..
.
yi +1 = yi + h (ti − yi )
yi +1 = yi + h (ti − yi )
..
.
yi +1 = yi + h (ti − yi )
y1 = 1 + 0.1(0 − 1) = 1 − 0.1 = 0.9
y2 = 0.9 + 0.1(0.1 − 0.9) = 0.9 + 0.1(−0.8) = 0.9 − 0.08 = 0.82
..
.
dP
= 0.02P
dt
Using the explicit Euler method with a step size h = 1 year:
Let’s assume an initial population size of P0 = 1000.
Iteration 1:
P1 = 1000 + 1 · (0.02 · 1000) = 1020
Iteration 2:
P2 = 1020 + 1 · (0.02 · 1020) = 1040.4
Iteration 3:
Mi +1 = Mi − hkMi
x y f (x, y) yapprox
0.0 3.0 -1.2(3) + 7 3.0
0.5 4.7 -1.2(4.7) + 7e −0.3(0) 4.7
1.0 4.89245 -1.2(4.89245) + 7e −0.3(0.5) 4.89245
1.5 4.54985 -1.2(4.54985) + 7e −0.3(1.0) 4.54985
2.0 4.03649 -1.2(4.03649) + 7e −0.3(1.5) 4.03649
2.5 3.53539 -1.2(3.53539) + 7e −0.3(2.0) 3.53539
4.4 4
4
4.2
3.8
4
y
y
3.6
3.8
3.5
3.6 3.4
3.4
3.2
3.2
3 3 3
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
x x x
k1 = hf (tn , yn )
h k
k2 = hf (tn + , yn + 1 )
2 2
h k2
k3 = hf (tn + , yn + )
2 2
k4 = hf (tn + h , yn + k3 )
1
yn+1 = yn + (k1 + 2k2 + 2k3 + k4 )
6
where h is the step size, tn is the current time, yn is the current
approximate solution, and f (t, y) is the ODE.
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
53 / 153
Example
Consider the initial value problem:
dy
= y −t
dt
y(0) = 1
Using the 4th order Runge-Kutta method, let’s approximate y(0.1) with
a step size of h = 0.05.
k1 = 0.05 · (yn − tn )
k2 = 0.05 · (yn + 0.025k1 − (tn + 0.025))
k3 = 0.05 · (yn + 0.025k2 − (tn + 0.025))
k4 = 0.05 · (yn + k3 − (tn + 0.05))
1
yn+1 = yn + (k1 + 2k2 + 2k3 + k4 )
6
Solving these equations step by step, we get y(0.1) ≈ 1.0545.
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
54 / 153
Runge-Kutta Method Examples
Solution
Given ODE: dP dt = 0.1P
Initial condition: P (0) = 100
Using 4th order Runge-Kutta method to estimate the population
growth after 5 time units:
Calculate k 1, k 2, k 3, and k 4 at each step using the formula:
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
57 / 153
Solution
Solution
Given ODEs:
dv
= −9.81 − 0.1v
dt
dx
=v
dt
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
59 / 153
Solution
Initial conditions: x(0) = 0 and v(0) = 10
Using 4th order Runge-Kutta method to estimate the position and
velocity after 2 seconds:
Calculate k 1, k 2, k 3, and k 4 at each step using the given ODEs:
Justification
Given ODE: dh 2
dt = −k11 h + k12
Given parameters: k11 , k12 , h (0) = 20, h = 0.1, t = 10.
Define function f (h , t) = −k11 h 2 + k12 .
k 1 = h · f (hn , tn )
k1 h
k 2 = h · f (hn + , tn + )
4 4
3k 1 9k 2 3h
k 3 = h · f (hn + + , tn + )
32 32 8
1932k 1 7200k 2 7296k 3 12h
k 4 = h · f (hn + − + , tn + )
2197 2197 2197 13
439k 1 3680k 3 845k 4
k 5 = h · f (hn + − 8k 2 + − ,t + h)
216 513 4104 n
8k 1 3544k 3 1859k 4 11k 5 h
k 6 = h · f (hn − + 2k 2 − + − , tn + )
27 2565 4104 40 2
25(k 1 + 6k 3 + 8k 4 − 9k 5 + 2k 6)
hn+1 = hn +
216
• Perform calculations iteratively until t = 10.
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
63 / 153
Rock Fragmentation during Blasting
Problem Statement
• A mining company is conducting a blasting operation in a rock
quarry to fragment the rock.
• The rate of change of the size of rock fragments during blasting
is given by the differential equation:
dD
= −k1 D + k2
dt
• Where:
• D is the average diameter of rock fragments
• k1 = 0.02 (fracture constant)
• k2 = 0.5 (constant rate of fragmentation)
• Initial condition: D (0) = 50 cm
• Time step: h = 0.1 seconds
dD
= −k1 D + k2
dt
• Initial condition: D (0) = 50 cm
• Constants: k1 = 0.02, k2 = 0.5
• Time step: h = 0.1 seconds
• Using the Fourth Order Runge-Kutta method, the update formula
is:
1
Di +1 = Di + (k1 + 2k2 + 2k3 + k4 )
6
Where:
Problem Statement
• An underground mine requires adequate ventilation to maintain a
safe working environment for miners.
• The differential equation governing air flow in the shaft is given
by:
dQ
= −k3 Q + k4
dz
Where:
• Q is the air flow rate
• z is the depth of the mine shaft
• k3 = 0.01 (decrease rate of air flow)
• k4 = 2 (constant rate of air supply)
• Initial condition: Q (0) = 10 m3 /min
• Step size: h = 0.5 meters
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
67 / 153
Solution using Fourth Order Runge-Kutta Method
• Let’s apply the Fourth Order Runge-Kutta method to solve the
differential equation for mine shaft ventilation analysis.
• The update formula for the Fourth Order Runge-Kutta method is:
1
Qi +1 = Qi + (k1 + 2k2 + 2k3 + k4 )
6
Where:
k1 = h (−k3 Qi + k4 )
h
k2 = h −k3 Qi + k1 + k4
2
h
k3 = h −k3 Qi + k2 + k4
2
k4 = h (−k3 (Qi + hk3 ) + k4 )
u u u 2 u
F (x1 , x2 , . . . , xn , u, , ,..., , , . . .) = 0 (4)
x1 x2 xn x1 x2
2 u 2 u 2 u
a1 + a2 + . . . + an = f (x1 , x2 , . . . , xn ) (5)
x12 x22 xn2
Heat Equation
The heat equation is given by:
2 u 2 u 2 u
!
u
=k + + (6)
t x 2 y 2 z 2
Laplace’s Equation
Laplace’s equation is given by:
2 u 2 u 2 u
+ + =0 (7)
x 2 y 2 z 2
2 u 2 2 u 2 u
!
2 u
= c + + (8)
t 2 x 2 y 2 z 2
Schrödinger equation
The Schrödinger equation in one dimension is given by:
Ñ (x, t) ℏ2 2 Ñ (x, t)
iℏ =− + V (x)Ñ (x, t) (9)
t 2m x 2
where: Ñ (x, t) is the wave function of the particle at position x and
h
time t, i is the imaginary unit, ℏ is the reduced Planck constant ( 2á ), m
is the mass of the particle, - V (x) is the potential energy of the particle
at position x.
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
73 / 153
Introduction to Finite Differences
Definition
Finite differences is a numerical method for approximating the
solutions of differential equations by replacing derivatives with finite
differences.
Example
Consider the function f (x) = e x and its derivative f ′ (x) = e x . Using
forward difference approximation with h = 0.1 at x = 0, we have:
Example
Consider the function f (x) = sin(x) and its derivative f ′ (x) = cos(x).
Using central difference approximation with h = 0.01 at x = 0, we have:
u(0) = u0 ,
u ′ (0) = v0 .
u
= ∇ · (Ô∇u) + a · ∇u + f (u) (19)
t
where a is a vector, ∇ · (Ô∇u) is a diffusion term, a · ∇u is called an
advection term, and f (u) a reaction term.
6 Systems of PDE. The incompressible Navier–Stokes model is an
important nonlinear example:
!
u
â + (u · ∇)u = ∇p + ÞÉu + F ; (20)
t
∇ · u = 0; (21)
a(x, y)uxx +2b (x, y)uxy +c(x, y)uyy +d (x, y)ux +e(x, y)uy +g(x, y)u(x, y) = f (x, y
(22)
where the coefficients are independent of u(x, y) so the equation is
linear in u and its partial derivatives. The solution of the 2D linear PDE
is sought in some bounded domain Ò, and the classification of the
PDE form (22) is:
• Elliptic if b 2 − ac < 0 for all (x, y) ∈ Ò,
• Parabolic if b 2 − ac = 0 for all (x, y) ∈ Ò, and
• Hyperbolic if b 2 − ac > 0 for all (x, y) ∈ Ò.
The appropriate solution method typically depends on the equation
class. For the first-order system:
u u
= A (x) (23)
t x
the classification is determined from the eigenvalues of the coefficient
matrix A (x).
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
81 / 153
Numerical Solutions of Boundary Value Problems
Definition
A boundary value problem is a differential equation together with a
set of additional constraints, called boundary conditions, that the
solution must satisfy at the boundaries of the domain.
Example
Consider the boundary value problem:
ui +1 − 2ui + ui −1
u ′′ (x) ≈
h2
where h = N1 is the step size. Applying the central difference scheme
to the boundary value problem, we obtain the following system of
equations:
ui +1 − 2ui + ui −1
= −ui , 1 ≤ i ≤ N −1
h2
u0 = 1
uN = 2
U1 f (x1 ) − ua /h 2
−2/h 1/h 0 ... 0 0
1/h −2/h 1/h ... 0 0 U2 f (x2 )
0 1/h −2/h ... 0 0 U3 f (x3 )
. .. .. .. .. .. . = ..
. . .
. . . . . . .
0
0 0 ... 1/h −2/h Un−2 f (xn−2 )
0 0 0 ... 1/h −2/h Un−1 f (xn−1 ) − ub /h 2
h 2 ′′ h k (k )
u(x + h ) = u(x) + hu ′ (x) + u (x) + . . . + u (x) + . . . (2.2)
2 k!
if u(x) is "analytic" (differentiable to any order), or as a finite sum
h 2 ′′ h k (k )
u(x + h ) = u(x) + hu ′ (x) + u (x) + . . . + u (à); (2.3)
2 k!
where x < à < x + h (or x + h < à < x if h < 0), if u(x) is differentiable
up to k -th order.
u(x + h ) − u(x)
u ′ (x) ≈
h
• The backward difference formula is given by:
u(x) − u(x − h )
u ′ (x) ≈
h
• The central difference formula is given by:
u(x + h ) − u(x − h )
u ′ (x) ≈
2h
d 2y
= −2y, y(0) = 1, y(1) = 0
dx 2
Discretize the problem using the forward difference method:
d 2 y yi +1 − 2yi + yi −1
≈
dx 2 h2
Substitute this approximation into the original differential equation,
we get
Step 1:
y0 = 1
y1 = 2(1 − 0.52 ) · 1 − 0 = 1.75
Step 2:
y1 = 1.75
y = 2(1 − 0.52 ) · 1.75 − 1 = 1
Advanced Computational Methods, AKU Lecture
2 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
102 / 153
Example
Consider the ODE:
d 2y dy
2
−3 + 2y = 0
dx dx
with boundary conditions:
y(0) = 1, y ′ (1) = 0
d 2 y yi −1 − 2yi + yi +1
≈
dx 2 (Éx)2
yi −1 − 2yi + yi +1 y −y
2
− 3 i +1 i −1 + 2yi = 0
(Éx) 2Éx
• Rearranging terms gives:
yi −1 − (2 + 3Éx)yi + yi +1 = −2Éx 2 yi
d 2u
− = f (x) in (0, 1)
dx 2
with Dirichlet boundary conditions:
u(0) = 0, u(1) = 1
Example
Consider the 1D heat equation:
u 2 u
=k 2 (29)
t x
Discretizing this equation using finite difference methods, we get:
where uin is the value of u at grid point i and time step n. This
equation can be solved iteratively to approximate the solution of the
heat equation.
∇2 u = f (x, y) (31)
Steady-State Conduction
• We discuss how to solve linear and transient conduction
problems using mathematical techniques.
• We focus on one-dimensional heat conduction in a solid material,
where the temperature distribution varies with both time and
position.
• Let’s start by considering the steady-state conduction equation in
one dimension:
d 2T
=0 (33)
dx 2
where T (x) is the temperature distribution along the material and
x is the position coordinate.
• The solution to this equation can be found by integrating twice
and applying boundary conditions.
Example
Consider a rod of length L with a constant heat source at one end and
insulated at the other end. The boundary conditions are:
T (0) = T0 (34)
dT
| =q −k (35)
dx x=L
where T0 is the constant temperature at x = 0, k is the thermal
conductivity, and q is the heat flux at x = L .
By solving the steady-state conduction equation and applying the
boundary conditions, we can find the temperature distribution in the
rod.
T 2 T
=k 2 âc (36)
t x
where â is the density, c is the specific heat, and k is the thermal
conductivity.
This equation describes how the temperature changes over time due
to conduction in the material.
Example
Consider a hot plate initially at a temperature T0 and suddenly cooled
to a lower temperature at time t = 0. The initial condition is:
T (x, 0) = T0 (37)
By solving the transient conduction equation with the initial condition,
we can find the temperature distribution in the hot plate as it cools
over time.
Example
Consider the one-dimensional heat conduction equation:
T 2 T
=Ó 2 (38)
t x
with initial condition T (x, 0) = T0 and boundary conditions T (0, t) = T1
and T (L , t) = T2 .
Apply the finite element method using linear shape functions to
discretize the domain 0 ≤ x ≤ L into N elements.
N
¼
Th (x, t) = Ni (x)Ti (t) (39)
i =1
Example
Consider the one-dimensional advection-diffusion equation:
â (âu) 2 â
+ =È 2 (40)
t x x
where â is the scalar quantity, u is the velocity field, and È is the
diffusion coefficient.
Apply the finite volume method to discretize the domain 0 ≤ x ≤ L into
N control volumes.
d âi F −F
= − i +1/2 i −1/2 (41)
dt Éx
where Fi +1/2 is the flux at the interface between control volumes i and
i + 1.
Example
Consider the steady-state heat conduction equation in one dimension:
d 2T
−k = Q (x) (42)
dx 2
with boundary conditions T (0) = T1 and T (L ) = T2 .
Using the finite element method with linear shape functions, derive
the weak form of the equation and solve for the temperature
distribution.
Example
Consider the one-dimensional Burger’s equation:
u u 2 u
+u =ß 2 (43)
t x x
where u is the velocity field and ß is the kinematic viscosity.
Apply the finite volume method to discretize the domain 0 ≤ x ≤ L into
N control volumes and solve the Burger’s equation.
Example
Consider the wave equation in one dimension:
2 u 2
2 u
= c (44)
t 2 x 2
with initial conditions u(x, 0) = f (x) and u
t
(x, 0) = g(x).
Using the finite element method with linear shape functions, derive
the weak form of the equation and solve for the displacement function
u(x, t).
Diffusion Equation
: The general form of the diffusion equation in one dimension is given
by:
æ 2 æ
=D 2 (45)
t x
with initial condition æ(x, 0) = æ0 and boundary conditions
æ æ
x
x = 0 = 0 and x x = L = 0.
The solution to this equation can be found using techniques like finite
difference method or finite element method.
â
+ ∇ · (âu) = 0 (46)
t
where â is the density and u is the velocity field.
Example
Consider the one-dimensional diffusion equation:
æ 2 æ
=D 2 (47)
t x
with initial condition æ(x, 0) = 0 and boundary conditions æ(0, t) = A
and æ(L , t) = 0.
Apply the finite difference method to discretize the domain 0 ≤ x ≤ L
into N grid points and solve for the concentration profile æ(x, t).
2 â 2 â
!
â (âu) (âv)
+ + =D + (48)
t x y x 2 y 2
Example
Consider the one-dimensional diffusion equation:
æ 2 æ
=D 2 (49)
t x
with initial condition æ(x, 0) = æ0 and boundary conditions æ(0, t) = A
and æ(L , t) = 0.
Apply the finite element method using linear shape functions to solve
for the concentration profile æ(x, t).
Example
Consider the 2D convective diffusion equation:
2 â 2 â
!
â (âu) (âv)
+ + =D + (50)
t x y x 2 y 2
with initial condition â(x, y, 0) = â0 and boundary conditions
â(0, y, t) = 0, â(L , y, t) = 0, â(x, 0, t) = 0, and â(x, W , t) = 0.
Apply the finite volume method to discretize the domain 0 ≤ x ≤ L ,
0 ≤ y ≤ W into control volumes and solve for the density field â(x, y, t).
Example
Consider the one-dimensional diffusion equation:
æ 2 æ
=D 2 (51)
t x
with initial condition æ(x, 0) = 0 and boundary conditions æ(0, t) = A
and æ(L , t) = 0.
Apply the finite difference method to discretize the domain 0 ≤ x ≤ L
into N grid points and solve for the concentration profile æ(x, t).
Maximize Z = 3x + 4y
Subject to
2x + y ≤ 10
x + 2y ≤ 8
x ≥ 0, y ≥ 0
Maximize Z = x 2 + 2y 2
Subject to
x 2 + y 2 ≤ 12
x ≥ 0, y ≥ 0
Maximize f (x)
Subject to g(x) = 0
h (x) ≤ 0
d 2
f ′ (x) = (x − 2x + 1)
dx
= 2x − 2
d 2
f ′ (x) = (x − 2x + 1)
dx
= 2x − 2
2x − 2 = 0
2x = 2
x =1
d 2
f ′ (x) = (x − 2x + 1)
dx
= 2x − 2
2x − 2 = 0
2x = 2
x =1
minimize f (x1 , x2 , . . . , xn )
subject to gi (x1 , x2 , . . . , xn ) ≤ 0, for i = 1, 2, . . . , m
and hj (x1 , x2 , . . . , xn ) = 0, for j = 1, 2, . . . , p
Solution
The first step in solving this problem is to find the gradient of the
function: !
6x1 − 2x2 + 1
∇f =
8x2 − 2x1 − 2
Setting the gradient to zero, we get the system of equations:
6x1 − 2x2 + 1 = 0
8x2 − 2x1 − 2 = 0
The eigenvalues of the Hessian matrix are 4 and 10, both positive,
indicating that the critical point is a minimum.
3 1 9
Therefore, the minimum of the function is f (− 10 , 5 ) = − 10 .
Maximize P = 2L + 3E
Subject to 2L + 3E ≤ 500
G = 0.5L + 0.3E
S = 0.2L + 0.5E
The company wants to maximize the total value of extracted gold and
silver, given constraints on the labor and equipment costs. This leads
to the following optimization problem:
Maximize V = 10G + 5S
Subject to 0.5L + 0.3E ≤ 100
0.2L + 0.5E ≤ 80
Solving this optimization problem will help the company optimize the
dimensions of the pit to achieve the desired cost and volume targets.
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
144 / 153
Gradient-based Methods
Example
Consider a mining operation that is trying to maximize the extraction
of a mineral resource from a mine while minimizing operating costs.
Let x be the amount of the mineral extracted per day and y be the cost
of operating the mine per day. The objective is to maximize the profit,
given by the equation:
Example
In mining operations, it is essential to optimize the production
schedule to maximize output while minimizing costs. Let x represent
the production rate of a mine and y represent the total operating cost
of the mine. The objective is to maximize the revenue generated from
the mine’s production, given by the equation:
Example
In mine planning and design, engineers need to optimize the layout of
the mine to maximize resource extraction and minimize excavation
costs. Let x represent the layout design parameters and y represent
the total excavation costs. The objective is to minimize the total
excavation costs, given by the equation:
% Lower bounds
lb = [0; 0];
% Initial guess
x0 = [0,0];
% Nonlinear constraints
nonlcon = @(x)deal([], x(1)^2 + x(2)^2 - 1);
% Bounds
lb = [-1, -1];
ub = [1, 1];
disp(’Optimal x1:’);
disp(x(1));
Advanced Computational Methods, AKU Lecture 1 Solutions
Basics of
of Numerical
Nonlinear Equations
Methods and System of Linear Equations
153 / 153