Lesson 1 Math 311
Lesson 1 Math 311
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
Develop a mathematical statement of the problem Secant Line: a line that passes through 2 pts of a curve.
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
Swap xR with xL
REPEAT
f(x0)
(xR -xL )
SET xn+1= xR − f(xR ) ∗ f(xR )-f(xL )
SET x1= x0 x1
x0
UNTIL |f(x1 )|<tolerance value
Note: If f(x) is not continuous the method may fail.
x1 x0- x1
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
(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
Algorithm
a11x+a12y+a13z=b1
x+y+z=4
2x−3y+4z=33FRANCH MAVERICK LORILLA 3
3x−2y−2z=2
Math 311: Numerical Solutions to CE Problems
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
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.
[𝐴] = [𝐿][𝑈]
Substitute:
[𝐿][𝑈][𝑋 ] = [𝐶 ]
[𝐿]−1 [𝐿][𝑈][𝑋 ] = [𝐿]−1 [𝐶 ]
[𝐼][𝑈][𝑋 ] = [𝐿]−1 [𝐶 ]
[𝑈][𝑋 ] = [𝑌]—
[𝐿]−1 [𝐶 ] = [𝑌]
FRANCH MAVERICK LORILLA 5