0% found this document useful (0 votes)
23 views

Lesson 1 Math 311

This document discusses numerical analysis techniques for solving engineering and scientific problems on a computer. It describes three bracketing methods - bisection, secant, and regula falsi - that can find the root of an equation within a specified tolerance by successively narrowing the range that brackets the root. These methods approximate the solution numerically and can solve problems without analytical solutions. They involve repeatedly updating the bracketing interval based on the function values and derivatives at the interval endpoints.

Uploaded by

mc604011
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Lesson 1 Math 311

This document discusses numerical analysis techniques for solving engineering and scientific problems on a computer. It describes three bracketing methods - bisection, secant, and regula falsi - that can find the root of an equation within a specified tolerance by successively narrowing the range that brackets the root. These methods approximate the solution numerically and can solve problems without analytical solutions. They involve repeatedly updating the bracketing interval based on the function values and derivatives at the interval endpoints.

Uploaded by

mc604011
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Math 311: Numerical Solutions to CE Problems

Numerical Analysis (NA) REPEAT

 A way to do higher mathematics problems on a computer xL -xR


SET xn+1 =
 Numerical answers can be obtained even when a problem 2
has no analytical solution
 Say: IF f(xn+1)* f(xL)<0
π SET xR= xn+1
∫ √1+ cos2 x dx
ENDIF
0

xL -xn+1
o Solution is always numerical UNTIL (|
𝑥𝑛+1
|) <tolerance value or f(xn+1) = e
o An approximation, but results can be made as
accurate as desired  The final value of x3 approximates the root, it is in error by
1
◥ Operations that NA can do: not more than |x -x |.
2 1 2
 Solve for the roots of a non-linear equation
NOTE: If f(x)=0⇨ discontinuous on [x1, x2] the method may give
 Solve large systems of linear equation
a false root.
 Get the solutions of a set of non-linear equation
 Interpolations (b-a)
 Find derivatives of any order Error after nth iterations < | |
2n
 Integrate any functions ☑ Sample Problem
 Solve ODE
 Solve boundary-value problems Bisection
 Obtain numerical solutions of partial Differential Equations
 Fit curves f(x)=x3+x2-3x-3=0, with of tolerance of 1E-2
 Approximations of functions

◥ 4 General steps in solving engineering or scientific problem:


II. Bracketing Method: Linear Interpolation method: The Secant
 State problem clearly Method

 Develop a mathematical statement of the problem Secant Line: a line that passes through 2 pts of a curve.

 Solve the equation f(xR)

 Interpret the numerical result to arrive at a decision

I. Bracketing Method: Interval Halving (Bisection)

 Its strategy is to begin with 2 values of x: a & b, that bracket


a root of f(x)=0. f(xR)
 Successively divides the interval in half and replaces one-
endpoint with the midpoint.

f(xL)
f(XR)
X2 X1 XR

f(X4)
◥ Similar Triangles
f(X5)
xR -xn+1 xR -xL
XL X3
=
X5
X4 f(𝐗 𝟎 ) f(xR )-f(xL )
XR

𝑿𝑹 − 𝑿𝑳 Solve for x2:


f(X3) 𝑿𝟑 =
𝟐
(xR -xL )
Xn+1= xR − f(xR ) ∗ f(x
f(XL) 𝑿𝑹 − 𝑿𝟑 R )-f(xL1 )
𝑿𝟒 =
𝟐
◥ Algorithm
◥ Algorithm
To determine a root f(x)=0, given two values, x R & xL, that are near
 To determine a root of f(x)=0 that is accurate within a the root.
specified tolerance value. Given value x L & xR such that
f(xL)*f(xR)<0 IF |f(xR )| < |f(xL )|

FRANCH MAVERICK LORILLA 1


Math 311: Numerical Solutions to CE Problems

Swap xR with xL

REPEAT
f(x0)
(xR -xL )
SET xn+1= xR − f(xR ) ∗ f(xR )-f(xL )

SET x0= x1 f(x0)

SET x1= x0 x1
x0
UNTIL |f(x1 )|<tolerance value
Note: If f(x) is not continuous the method may fail.
x1 x0- x1

☑ Sample Problem f(x1)


x0

Secant Method
f(x0 )
f(x)=x3+x2-3x-3=0, use same initial estimate of previous tan θ = f’(x0) =x
example and tolerance of 1E-3 0 -x1

f(x )
x1= x0-f'(x0 )
III. Bracketing Method: Linear Interpolation method: False 0
Position
f(xn )
 Regula falsi (Latin)
𝑥𝑛+1 = 𝑥𝑛 − ,
f'(xn)
 Similar to bisection except the next iterate is taken at the
intersection of a line between the pair of x-values and the x- n=0,1,2…
axis rather than the midpoint.
◥ Algorithm
◥ Algorithm
To determine a root f(x)=0, given a value x0 reasonably close to the
To determine a root of f(x)=0, given values of x 0 and x1 that bracket a root.
root, that is, f(x0) & f(x1) are opposite sign.
COMPUTE f(x0), f’(x0)
REPEAT
SET x1= x0
(x0 -x1 )
SET x2= x0 − f(x0 ) ∗
f(x0 )-f(x1 ) IF [f(x0) ≠0] and [f’(x0) ≠0]
IF f(x2)is opposite sign to f(x0)
SET x0= x1
SET x1= x2 f(x )
SET x1= x0-f'(x0 )
ELSE 0

SET x0= x2 UNTIL

ENDIF |x0= x1| <tolerance value or f(x1 )<tolerance value


UNTIL |f(x2)|< tolerance vale
☑ Sample Problem
Note: If f(x) is not continuous on the interval, the method may fail
Newton’s Method
☑ Sample Problem
f(x)=x3+x2-3x-3=0, start with a=1, b=2 and tolerance of 1E-2
Regula Falsi

f(x) = x3+x2-3x-3=0, start with a=1, b=2 and tolerance of 1E-2


Example: Locate 1st positive root of 𝑓(𝑥) = 𝑠𝑖𝑛𝑥 + 𝑐𝑜𝑠(1 + 𝑥 2 ) − 1
where x is in radian and tolerance of 1E-3

IV. Open Method: Newton’s Method

 Based on a linear approximation of the function, but does so


using a tangent to the curve.

FRANCH MAVERICK LORILLA 2


Math 311: Numerical Solutions to CE Problems

V. Open Method: Fixed Point Iteration


Y1=x

y0=g(x) System of Linear Equations


I. Determinants and Cramer’s Rule

◥ Determinants of order 2 & 3

(a) Order of 2

a b1
D= | 1 | = a1 b2 − a2 b1
X2 X1 X0 a2 b2
(b) Order of 3

a1 b1 c1 a1 b1
D= |a2 b2 c2| a2 b2
a3 b3 c3 a3 b3

D= +(a1b2c3+b1c2c3+c1a2b3) - (a3b2c1+b3c2a1+c3a2b1)
 X=g(x)
 Rearrange f(x) into an equivalent form x=g(x) ◥ Cramer’s Rule

◥ Iterative  Cramer’s rule is another solution technique that is best


suited to small numbers of equations.
Xn+1=g(xn), n=0,1,2,3…
Cramers rule states that if

Algorithm
a11x+a12y+a13z=b1

 To determine a root of f(x)=0 given a value x1 reasonably a21x+a22y+a23z=b2


close to the root
 Rearrange the equation to an equivalent form x=g(x) a31x+a32y+a33z=b3

SET x2=x1 then


Dx Dy Dz
x= D
, y= D
and z= D
REPEAT

SET x1= x2 where

SET x2= g(x1) a11 a12 a13


D= |a21 a22 a23|
UNTIL | x1- x2 |<tolerance value a31 a32 a33
Note: Converges if the magnitude of slope of g(x) is less than the b1 a12 a13
slope of the line x = f(x)
Dx = |b2 a22 a23 |
b3 a32 a33
☑ Sample Problem
i.e. the column has been replaced by R.H.S. b column,
Fixed-Point Iteration
a11 b1 a13
f(x)=x3+x2-3x-3=0, start with a=1, b=2 and tolerance of 1E-2 Dy = |a21 b2 a23 |
a31 b3 a33
i.e. the y-column has been replaced by the R.H.S. b column,
☑ Assignment
Given: a11 a13 b1
Dz = |a21 a23 b2 |
f(x)=3x+sin(x)-ex=0, for x0=1 & x1=0
a31 a33 b3
Requirement:
i.e. the z-column has been replaced by the R.H.S. b column.
☑ Compare the results using BISECTION, FALSE POSITION,
☑ Sample Problem
NEWTON’S & FIXED POINT ITERATION.
Solve the following simultaneous equations using Cramers rule

x+y+z=4
2x−3y+4z=33FRANCH MAVERICK LORILLA 3
3x−2y−2z=2
Math 311: Numerical Solutions to CE Problems

I. Gauss-Jordan Elimination Method


☑ Supplementary Problem
◥ Elementary row operations
Solve the following system by using the Gauss-Jordan
elimination method.
1. interchanging two rows 7x + 2y - 3z = -12
2. add one row to another row, or multiply one row first, then 2x + 5y - 3z = -20
adding it to another x – y - 6z = -26
3. Multiplying a row by any constant greater than zero

Form should be in row enchelon form: I. Iterative Method: Jacobi Method


1 0 0 x x  The Jacobi method is a method of solving a matrix equation
[0 1 0] [y] = [y] on a matrix that has no zeros along its main diagonal
0 0 1 z z (Bronshtein and Semendyayev 1997, p. 892). Each diagonal
element is solved for, and an approximate value plugged in.
The process is then iterated until it converges. This algorithm
☑ Sample Problem
is a stripped-down version of the Jacobi transformation
Solve the following system by using the Gauss-Jordan method of matrix diagonalization.
elimination method.
x+y+z=5 ☑ Sample
2x+3y+5z=8 Problem
Solve the following system by Jacobi Method
4x+5z=2 6x1-2x2+x3=11
-2x1+7x2+2x3=5
x1+2x2-5x3=-1
Solution: The augmented matrix of the system is the following.

1 1 1 5
[2 3 5 |8] 1st 2nd 3rd 4th 5th 6th .. 9th
4 0 5 2 x1 0 1.833 2.038 2.085 2.004 1.944 .. 2.000
We will now perform row operations until we obtain a matrix in x2 0 0.7143 1.181 1.053 1.001 0.990 .. 1.000
reduced row echelon form. x3 0 0.200 0.852 1.080 1.038 1.0001 .. 1.000

For x1:
11+2X2 -X3
X1=
6

For x2:
5+2X1 -2X3
X2=
7

For x3:
-1-X1 -2X2
X3=
-5

1st Iteration:
11+2(0)-(0)
X1= = 1.8333
6

5+2(0)-2(0)
X2= = 0.7143
7

-1-(0)-2(0)
X3= = 0.2
-5

2nd Iteration:
11+2(0.7143)-(0.2)
X1= = 2.0381
6

5+2(1.8333)-2(0.2)
X2= = 1.181
7

-1-1.8333 -2(0.7143 )
X3= = 0.852
-5
From this final matrix, we can read the solution of the system. It is

FRANCH MAVERICK LORILLA 4


Math 311: Numerical Solutions to CE Problems

3RD Iteration [𝐿][𝐿]−1 [𝐶 ] = [𝐿][𝑌]


11+2(1.181)-(0.852)
= 2.085
X1=
6 [𝐼 ][𝐶 ] = [𝐿][𝑌] — 
5+2(2.0381)-2(0.852)
X2= = 1.053 By Forward Substitution:
7

X3=
-1-2.0381 -2(0.852 )
-5
= 1.080 𝑥 0 0 𝑌1 𝐶1 ↔ 𝑌1
4th Iteration
[𝑥 0 0] [𝑌2 ]=[𝐶2 ] ↔ 𝑌2
𝑥 𝑥 𝑥 𝑌3 𝐶3 ↔ 𝑌3
11+2(1.053)-(1.080)
X1= = 2.085
6 By Back Substitution:
5+2(2.085)-2(1.080)
X2= = 1.053 Unknowns
7

X3=
-1-2.085-2(1.080 )
= 1.080 𝑥 𝑥 𝑥 𝑋1 𝑌1 ↔ 𝑋1
-5
[0 𝑥 𝑥 ] [𝑋2 ]=[𝑌2 ] ↔ 𝑋2
.
. 0 0 𝑥 𝑋3 𝑌3 ↔ 𝑋3
.
.
9th Iteration ☑ Sample Problem
X1=2.000 Solve the following simultaneous equations using LU
Decomposition.
X2=1.000
𝑥1 + 𝑥2 − 𝑥3 = 4
X3=1.000
𝑥1 − 2𝑥2 + 3𝑥3 = −6
III. Direct Methods: LU Decomposition
2𝑥1 + 3𝑥2 + 𝑥3 = 7
 In many applications where linear systems appear, one needs
to solve Ax = b for many different vectors b. Gaussian
elimination with pivoting is the most efficient and accurate way
to solve a linear system. Most of the work in this method is
spent on the matrix A itself. If we need to solve several
different systems with the same A, and A is big, then we would
like to avoid repeating the steps of Gaussian elimination on A
for every different b. This can be accomplished by the LU
decomposition, which in effect records the steps of Gaussian
elimination.

[𝐴]𝑛𝑥𝑚 [𝑋 ]𝑛𝑥1 = [𝐶 ]𝑛𝑥1


Since,

[𝐴] = [𝐿][𝑈]

Lower Triangular Upper Triangular


Matrix Matrix

Substitute:

[𝐿][𝑈][𝑋 ] = [𝐶 ]
[𝐿]−1 [𝐿][𝑈][𝑋 ] = [𝐿]−1 [𝐶 ]
[𝐼][𝑈][𝑋 ] = [𝐿]−1 [𝐶 ]
[𝑈][𝑋 ] = [𝑌]— 

[𝐿]−1 [𝐶 ] = [𝑌]
FRANCH MAVERICK LORILLA 5

You might also like