0% found this document useful (0 votes)
387 views8 pages

Numerical Methods

This document summarizes various root finding and numerical methods for solving equations including: - Bracketing methods like the bisection method and regula falsi method - Iterative methods like Newton-Raphson, fixed point iteration, and secant methods - Jacobi and Gauss-Seidel methods for solving systems of linear equations - Lagrange interpolation for approximating functions based on existing data points

Uploaded by

A-Jay N. Galiza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
387 views8 pages

Numerical Methods

This document summarizes various root finding and numerical methods for solving equations including: - Bracketing methods like the bisection method and regula falsi method - Iterative methods like Newton-Raphson, fixed point iteration, and secant methods - Jacobi and Gauss-Seidel methods for solving systems of linear equations - Lagrange interpolation for approximating functions based on existing data points

Uploaded by

A-Jay N. Galiza
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015

ROOT FINDING METHOD


I. Direct Methods
- Substitution and Elimination
- Factoring
- Quadratic Equation
- Synthetic Division
II. Numerical Method
- Bracket Method
- Bisection Method
- Regula-Falsi
- Open Method
- Newton-Rhapson
- Fixed point iteration
- Secant Method

1.0000

1.5000

1.2500

1.0000

1.2500

1.1250

1.1250

1.2500

1.1875

1.1875

1.2500

1.2188

1.1875

1.2188

1.1875

1.2031

1.2032
1.195
3

0.3415
0.3415
0.3415
0.1366
0.0173
0.0173
0.0173

0.7525

0.1135

0.1135
0.1366
0.0173

0.1135

0.0467

0.0468

0.0144
0.0016

0.1135

0.0143

B. Regula Falsi Method/False Estimate


Set [a,b]
Test f(a) . f(b) < 0 (negative)
*Assume f(a) is negative and f(b) is
positive

A. Bracket Method/Binary Search


Algorithm

c=a

Set [a,b]

f ( a ) [ba ]
f ( b )f (a)

Test f(a) . f(b) < 0 (negative)


*Assume f(a) is negative and f(b) is
positive

CALCULATOR CODE

c= A
c=

a+b
2

X [ B A]
Y X

Solve for f(c)


if f(c) is negative, f(a) f(c) and a c
and b b
if f(c) is positive, f(b) f(c) and b c and
a a

Solve for f(c)


if f(c) is negative, f(a) f(c) and a c
and b b
if f(c) is positive, f(b) f(c) and b c and
a a

Stopping criteria:
- set number of iterations
- |f(c)|

Stopping criteria:
- set number of iterations
- |f(c)|
Example:

Example:

f ( x )=x 2sin ( x )0.5


i

1
2

0.0000
1.0000

2.0000
2.0000

1.0000
1.5000

f ( x )=x 2sin ( x )0.5


for [0 , 2] and i = 8
f(a)
0.5000
-

NUMERICAL METHODS | NECES ACADEMICS


COMMITTEE 2014-2015

f(b)
2.5907
2.5907

f(c)
0.3415
0.7525

for [1 , 1.5] and =

0.0001
i
1
2

a
1.000
0
1.156
1

b
1.5000
1.5000

c
1.156
1
1.188
6

f(a)
0.3415
0.0787

A-JAY GALIZA

f(b)
0.752
5
0.752
5

f(c)
0.0787
0.0150

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015


3
4
5

1.188
6
1.194
7
1.195
8

1.194
7
1.195
8
1.19
60

1.5000
1.5000
1.5000

0.0150
0.0027
0.0005

0.752
5
0.752
5
0.752
5

0.0027
0.0005
0.0001

x i+1=x i

C. Newton-Rhapson Method

CALCULATOR CODE

Set xi

x i+1=x i

f (x i)
f ( x i ) f ( x i1)

x ix i1

x i+1=B

f ( xi )
f '( xi )

D
DC

B A

Example:

f ( x )=cos ( x ) +2 sin ( x )+ x

CALCULATOR CODE

x i+1=X

for xi-1 = 0 and

xi = -0.1 and i = 5

f ( x i)
d
f ( x i) x= X
dx
i
1

xi-1

xi

xi+1

f(xi)

f(xi+1)

0.0000 -0.1000 -0.5137 1.0000 0.8053 0.1520

2 -0.1000 -0.5137 -0.6100

Stopping criteria:
- set number of iterations
- |f(xi+1)|
- |xi+1 xi |

f(xi-1)

3 -0.5137 -0.6100 -0.6518


4 -0.6100 -0.6518 -0.6588

0.805
0.1520 0.0461
3
0.152
0.0461 0.0066
0
0.046
0.0066 0.0004
1

5 -0.6518 -0.6588 -0.6593 0.0066 0.0004 4.19E-06

Example:

f ( x )=x2 sin ( x )

for xi = 1.5 and =

0.0001

D. Fixed Point Iteration/MOSS


Given f(x), make equations g1(x), g2(x),

xi

xi+1

f(xi+1)

1.5000

2.0766

0.3269

2.0766

1.9105

0.0248

Choose an initial value xi

1.9105

1.8956

0.0002

Solve for xi+1 using g1(x), g2(x),

1.8956

1.8955

1.5461E-08

*note:

f ' ( x )=12cos ( x )

This is more of a trial and error process


because some g(x) do not converge.
Example:

D. Secant Method

f ( x )=x 4 x10

Set xi (present) and xi-1 (previous)

NUMERICAL METHODS | NECES ACADEMICS


COMMITTEE 2014-2015

A-JAY GALIZA

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015

g1 ( x ) =

10
3
x 1

II. Numerical Method


- Jacobi Method
- Gauss- Seidel Method

g2 ( x )= 4 x +10
A. Jacobi Method

x+ 10
g3 ( x ) =

Given

For

g1 ( x ) =

a11 x 1+ a12 x 2 +a13 x3 =b1


10
3
x 1

i
1

xi
1.5000

xi+1
4.2105

4.2105

0.1358

0.1358
10.0251

10.0251

-0.0099

-0.0099

10.0000

10.0000

-0.0100

-0.0100

10.0000

10.0000

-0.0100

-0.0100

10.0000

For

a21 x 1 +a 22 x2 + a23 x 3=b 2

choose xi = 1.5

g2 ( x )= 4 x +10

a31 x 1 +a32 x2 +a 33 x 3=b 3


The iterative
process
with g1 has gone
into an infinite
loop without
converging.

Check if diagonally dominant.


Solve for

choose xi = 1

xi

xi+1

1.0000

1.8212

1.8212

1.8542

1.8542

1.8555

1.8555

1.8556

1.8556

1.8556

The iterative process with g2 converged. Try if g3


converges.

SYSTEM OF LINEAR
EQUATION
I. Direct Methods
- Substitution and Elimination
- Matrix
NUMERICAL METHODS | NECES ACADEMICS
COMMITTEE 2014-2015

x 1=

1
b a x a x
a11 1 12 2 13 3

x 2=

1
b a x a x
a22 2 21 1 23 3

x 3=

1
b a x a x
a33 3 31 1 32 2

The iteration stops if ALL 1 , 2 , and 3


becomes

Example:

4 wx y=3
; 6+7 y + x=w ; y+ 6 x2 w=9
Arrange so that it is diagonally dominant.

4 wx y=3
2 w +6 x+ y=9
w+ x +7 y=6
A-JAY GALIZA

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015

Solve for wk+1, xk+1, yk+1

k+1

1
= 3+ x+ y
4

1
x k+1= 9+ 2 w y
6
1
y k+1 = 6+ wx
7

wk+
1

x k+1

y k+1

---

---

---

0.75

1.5

0.75

1.5

-0.857

0.91
1

1.89
3

0.16
1

0.39
3

-0.107

0.98
2

1.96
4

0.07
1

0.07
1

-0.033

0.99
2

1.99
4

0
0.85
7
0.96
4
0.99
7
0.99
7

0.01

0.03

0.99
9
0.99
9

1.99
7

-1

0.00
7

-1

0.00
3
0.00
3

-1

0.00
1

5
6
7

-0.003
0
0

* = 0.001
B. Gauss-Seidel Method
If x1(k+1) is a better approximation to the true
value of x1 than x1(k) is, then it would make
sense that once we have found the new
value x1(k+1) , use it (rather than the old
value x1(k)) in finding x2(k+1), , xn(k+1). In other
words, instead of using the old value
of x1(k) and the old values x3(k),
, xn(k), we now use
the new value x1(k+1) and the old
values x3(k), , xn(k), and similarly for
findingx3(k+1), , xn(k+1).

NUMERICAL METHODS | NECES ACADEMICS


COMMITTEE 2014-2015

A-JAY GALIZA

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015


Example:

( x )=

4 wx y=3

xx1 x x2

x ix 1 x ix 2

2 w +6 x+ y=9
w+ x +7 y=6

For n=3

( x )=
wk+
1

x k+1

y k+1

---

---

---

0.75
0

1.75
0

0.75
0

1.75
0

1.000

0.93
8

1.97
9

0.18
8

0.22
9

0.006

0.99
3

1.99
9

0.05
5

0.02
0

0.005

0.99
9

2.00
0

0
1.00
0
1.00
6
1.00
1
1.00
0

0.00
6

0.00
1

0.001

1.00
0

2.00
0

0.00
1

0.00
0

0.000

1.00
0

xx1 x x2 x x3

x ix 1 x ix 2 x ix 3

Example:
Compute for f(0.3) for the given data set,
use n= 2 and f(3.1), use n = 3
x

f(x)

49

129

813

*Find the range where 0.3 lies for n=2 (blue line);
3.1 for n= 3 (green line).

* = 0.001
For f(0.3), n = 2:

INTERPOLATION,
EXTRAPOLATION, CURVE FIT
A. Lagrange Interpolation

y ( x )= y 1

xx 2
xx 1
+ y2
x1x 2
x 2x1

y ( x )= y 1 ( x ) + y 2 ( x ) + y 3 ( x )

P1 = (0,1) and P2 = (1, 3)

( x )=

x0 x1

x i0 x i1

( 0.3 )=

y ( 0.3 )= y 1

0.3 0.7
0.3 0.7

+ y2

x 10 x 11
x 20 x 21

y ( 0.3 )=1

0.3 0.7
0.3 0.7

+3

00 01
10 11

Where the weighing factor is:


n

( x )=
j=1
i=n
j i

xx j
xi x j

0.30 0.31 0.3 0.7

x i0 x i1 x i0 x i1

y ( 0.3 )=

0.7
0.3
+3
01
10

y ( 0.3 )=1.6, 0 x 1

For n=2

NUMERICAL METHODS | NECES ACADEMICS


COMMITTEE 2014-2015

A-JAY GALIZA

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015


For f(3.1), n = 3:

P1 = (1,3) and P2 = (3, 49) and P3 = (4,129)


*note: 3.1 is between 3 and 4 (P2 and P3) and
since 3.1 is closer to (1,3) than (7,813), then P 1 =
(1,3).

( x )=

x1 x3 x 4

x i1 x i3 x i4

(3.1 ) =

Where n = number of ordered pairs

STAT MODE (MODE + 3) A+Bx (2) Input


Data
(AC) (SHIFT + 1) SUM (4) Choose
Mode

3.11 3.13 3.14


3.11

+ 49
11 13 14
31

3.13 3.14
3.11 3.13 3.14

+129

33 34
41 43 44

3.13 3.14
3.11
y (3.1 ) =3

+49
13 14
31

f ( x )=a x 2 +bx +c

FOR CASIO CALCULATOR

3.11 3.13 3.14

x i1 x i3 x i4

y (3.1 ) =3

Eq . 3

y=a x +bx+ cn

3.14
3.11 3.13
+129

34
41 43

x x x x xy x y y

Modes:

Example:
Compute for f(4.3) and f(15.7) using Linear
and Quadratic fit.
x
f(x
)

8
3

2
1
0

1
1

4
1
2

1
2

1
1
4

y (3.1 ) =55.29,1 x 4
Linear Fit:
B. Method of Least Square (MLS)

xy =317

x =528

x=64

For Linear Fit:

xy =a x2 +bx
2

xy =a x +bx Eq .1
y=ax+bn Eq . 2

317=a ( 528 )+ b ( 64 )

f ( x )=ax +b
y=ax+bn
70=a ( 64 ) +b (10)

For Quadratic Fit:


2

x y=a x + b x +c x Eq. 1
3

a = -1.1064, b = 14.0811

f ( x )=1.1064 x+ 14.0811

xy=a x +b x + cx Eq . 2
NUMERICAL METHODS | NECES ACADEMICS
COMMITTEE 2014-2015

A-JAY GALIZA

y =70

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015

f ( 4.3 )=9.3236

Quadratic Fit

f ( 15.7 ) =3.2894
16
14

x 2 y=2009

f(x) = 0.02x^2 - 1.39x + 14.75

12

Quadratic Fit:

x 4 =

49524 x =

xy =317

x =528

10

4930

8
6

x=64

4
2

y =70

x 2 y=a x 4 + b x 3 +c x 2

10

12

14

2009=a ( 49524 ) +b ( 4930 ) +c (528 )


xy=a x 3 +b x 2+ cx

PRACTICE PROBLEMS

3 17=a ( 4930 ) +b ( 528 ) +c ( 64 )


Bisection Method and Regula Falsi
Method

y=a x +bx+ cn

Given the equation

70=a (528 )+ b ( 64 ) +c (10)

f ( x )=e ( 3.2 sin ( x ) 0.5 cos ( x ) ) , find c 8 8 .

a = 0.0216, b = -1.3897, c = 14.7521

C onsider the interval [ 3,4 ]


f ( x )=0.0216 x 21.3897 x +14.7521
f ( 4.3 )=9.1758

Newton Rhapson and Secant Method

Find the root of f ( x )=x 3cos ( x )

f ( 15.7 ) =1.7420

consider x i=1x i1=1.5 . Let i=5 .

Linear Fit

MOSS

16
14

Find the root of f ( x )=x 37 x 2+ 14 x6.

12

f(x) = - 1.11x + 14.08

10

Let i=7.

8
6
4

Jacobi and Gauss-Seidel Method

2
0

10

12

14

x+ 2 y +3 z=5
2 x 5 y +2 z=1
3 x+ y 2 z =1

NUMERICAL METHODS | NECES ACADEMICS


COMMITTEE 2014-2015

A-JAY GALIZA

NUMERICAL METHODS | NECES ACADEMICS COMMITTEE 2014-2015

Use =0.001

x
f(x)

-0.33
-0.15

1.35
0.88

2.32
1.31

3.17
1.87

4.22
2.11

5.11
2.42

Solve for f(2.5) using Lagrange (n=3) and

Lagrange and MLS

MLS. Solve for f(6.4) and f(-1.2) using MLS


(Quadratic Fit).

Consider the data points:

NUMERICAL METHODS | NECES ACADEMICS


COMMITTEE 2014-2015

A-JAY GALIZA

You might also like