19
Trisection Algorithms Presented by Namir Shammas 1

Trisection Algorithms

  • Upload
    airlia

  • View
    47

  • Download
    6

Embed Size (px)

DESCRIPTION

Trisection Algorithms. Presented by Namir Shammas. To Joe Horn, the “pinball wizard” or number rounding!. Dedication. “The much better is also the enemy of the good” -- Namir. My better Creed. In your dreams!!. Trisection Method. - PowerPoint PPT Presentation

Citation preview

Page 1: Trisection Algorithms

1

Trisection Algorithms

Presented by

Namir Shammas

Page 2: Trisection Algorithms

2

To Joe Horn, the “pinball wizard” or number

rounding!

Dedication

Page 3: Trisection Algorithms

3

“The much better is also the enemy of the good”

-- Namir

My better Creed

Page 4: Trisection Algorithms

4

In your dreams!!

Page 5: Trisection Algorithms

5

Trisection Method• Each iteration divide the root-bracketing interval [A, B] into

three parts, instead of two as does the Bisection.• Chooses the first point X1 within the interval [A, B] closest to

the end point A, or B, that has the smallest absolute function value (call this point Z).

• If f(X1) and f(Z) have opposite signs, the iteration has finished its task.

• If f(X1) and f(Z) have the same signs, we calculate X2 which closer to the other interval end point (call it Y).

Page 6: Trisection Algorithms

6

Trisection Method (cont.)

• Determines whether the interval [X1, X2] or [X2, Y] is the new root-bracketing interval.

Page 7: Trisection Algorithms

7

Trisection Plus Method• Adds inverse linear interpolation to the Trisection method.• Set Fa=f(A) and Fb=f(B) and start iterations as shown next

until [A, B]<tolerance.• If |Fa| < |Fb| calculate X1 = A + (B - A) / 3 and evaluate

Fx1=f(X1). This is case 1 where [A, X1] has the root.

Page 8: Trisection Algorithms

8

Trisection Plus Method• If Fx1 * Fa < 0• Calculate X3 as the inverse linear interpolation using [A, Fa] and

[X1, Fx1]. Also calculate Fx3=f(X3).• If Fa * Fx3 < 0 then set point B = point X3, else set point A = point X3

and point B = point X1.

Page 9: Trisection Algorithms

9

Trisection Plus Method (cont.)

Page 10: Trisection Algorithms

10

Trisection Plus Method (cont.)

Page 11: Trisection Algorithms

11

Trisection Plus Method (cont.)

• If Fx1 * Fa > 0• Calculate X2 = A + 2 * (B - A) / 3. Also calculate Fx2=f(X2). This is

case 2 where [X1, X2] has the root.• If Fx1 * Fx2 < 0 • Calculate X3 as the inverse linear interpolation using [X1, Fx1]

and [X2, Fx2]. Also calculate Fx3=f(X3).• If Fx1 * Fx3 < 0 then set point A=point X1 and point B=point X3,

else set A=point X3 and point B=point X2.

Page 12: Trisection Algorithms

12

Trisection Plus Method (cont.)

Page 13: Trisection Algorithms

13

Trisection Plus Method (cont.)

• If Fx1 * Fx2 > 0 • Calculate X3 as the inverse linear interpolation using [X2, Fx2]

and [B, Fb]. Also calculate Fx3=f(X3).• If Fx2 * Fx3 < 0 then set point A = point X2 and point B = point

X3, else set point A = point 3.

• If |Fa| > |Fb| we deal with symmetrical 3 cases as above.

Page 14: Trisection Algorithms

14

Trisection Plus Method (cont.)

Page 15: Trisection Algorithms

15

Trisection Plus Method (cont.)

Page 16: Trisection Algorithms

16

Trisection Plus Method (cont.)

• Included in HHC material are HP Prime listings for the Bisection Plus, Trisection, and Trisection Plus algorithms.

• Also included are version 2 of the above listings. Version 2 of the listings store, in matrix M0, the values for [A, B] along with X1, X2, and X3 (in case of the Trisection Plus) for each iterations.

• Viewing matrix M0 allows you to inspect the programs of each iteration.

Page 17: Trisection Algorithms

17

Trisection Plus Method (cont.)

Page 18: Trisection Algorithms

18

Trisection Plus Method (cont.)

Function [A, B] Toler /FxToler

Root Iterations Num Fx Calls

Exp(X) – X^3 [1, 2] 1E–101E–7

1.857183 Bisec= 24Trisec= 16Trisec+ = 4Newton= 7

Bisec= 26Trisec = 24Trisec+= 10Newton= 14

Exp(X) –3*X^2 [3, 4] 1E–101E–7

3.73307 Bisec= 26 Trisec= 17Trisec+ = 5Newton= 7

Bisec= 28Trisec= 24Trisec+ = 12Newton= 14

Cos(X) – X [0, 1] 1E–101E–7

0.73908 Bisec= 23 Trisec= 14Trisec+ = 4Newton= 5

Bisec= 25Trisec= 21Trisec+ = 10Newton= 10

(X–1.234) * (X–5.678) * (X+12.345) [5, 6] 1E–101E–7

5.678 Bisec= 28Trisec= 18Trisec+ = 4Newton=6

Bisec= 30Trisec= 23Trisec+ = 10Newton=12

(X–1.234) * (X–5.678) * (X+12.345) [1, 2] 1E–101E–7

1.234 Bisec= 28Trisec= 17Trisec+ = 4Newton= 5

Bisec= 30Trisec= 23Trisec+ = 10Newton= 10

(X–1.234) * (X–5.678) * (X+12.345) [5,11] 1E–101E–7

5.678 Bisec= 29Trisec= 19Trisec+ = 6Newton= 7

Bisec= 31Trisec= 32Trisec+ = 14Newton= 14

(X–1.234) * (X–5.678) * (X+12.345) [–8, –15] 1E–101E–7

–12.345 Bisec= 33Trisec= 20Trisec+ = 5Newton= 6

Bisec= 35Trisec= 30Trisec+ = 13Newton= 12

Page 19: Trisection Algorithms

19

Thank You!!