# Trisection Algorithms Presented by Namir Shammas 1.

## Presentation on theme: "Trisection Algorithms Presented by Namir Shammas 1."— Presentation transcript:

Trisection Algorithms Presented by Namir Shammas 1

To Joe Horn, the “pinball wizard” or number rounding! Dedication 2

“The much better is also the enemy of the good” -- Namir My better Creed 3

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 X 1 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(X 1 ) and f(Z) have opposite signs, the iteration has finished its task. If f(X 1 ) and f(Z) have the same signs, we calculate X 2 which closer to the other interval end point (call it Y). 5

Trisection Method (cont.) Determines whether the interval [X 1, X 2 ] or [X 2, Y] is the new root-bracketing interval. 6

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 X 1 = A + (B - A) / 3 and evaluate Fx1=f(X 1 ). This is case 1 where [A, X 1 ] has the root. 7

Trisection Plus Method If Fx1 * Fa < 0 Calculate X3 as the inverse linear interpolation using [A, Fa] and [X 1, Fx1]. Also calculate Fx3=f(X 3 ). If Fa * Fx3 < 0 then set point B = point X 3, else set point A = point X 3 and point B = point X 1. 8

Trisection Plus Method (cont.) 9

10

Trisection Plus Method (cont.) If Fx1 * Fa > 0 Calculate X 2 = A + 2 * (B - A) / 3. Also calculate Fx2=f(X 2 ). This is case 2 where [X 1, X 2 ] has the root. If Fx1 * Fx2 < 0 Calculate X 3 as the inverse linear interpolation using [X 1, Fx1] and [X 2, Fx2]. Also calculate Fx3=f(X 3 ). If Fx1 * Fx3 < 0 then set point A=point X 1 and point B=point X 3, else set A=point X 3 and point B=point X 2. 11

Trisection Plus Method (cont.) 12

Trisection Plus Method (cont.) If Fx1 * Fx2 > 0 Calculate X 3 as the inverse linear interpolation using [X 2, Fx2] and [B, Fb]. Also calculate Fx3=f(X 3 ). If Fx2 * Fx3 < 0 then set point A = point X 2 and point B = point X 3, else set point A = point 3. If |Fa| > |Fb| we deal with symmetrical 3 cases as above. 13

Trisection Plus Method (cont.) 14

Trisection Plus Method (cont.) 15

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 X 1, X 2, and X 3 (in case of the Trisection Plus) for each iterations. Viewing matrix M0 allows you to inspect the programs of each iteration. 16

Trisection Plus Method (cont.) 17

Trisection Plus Method (cont.) Function[A, B] Toler / FxToler RootIterationsNum Fx Calls Exp(X) – X^3[1, 2] 1E–10 1E–7 1.857183 Bisec= 24 Trisec= 16 Trisec+ = 4 Newton= 7 Bisec= 26 Trisec = 24 Trisec+= 10 Newton= 14 Exp(X) –3*X^2[3, 4] 1E–10 1E–7 3.73307 Bisec= 26 Trisec= 17 Trisec+ = 5 Newton= 7 Bisec= 28 Trisec= 24 Trisec+ = 12 Newton= 14 Cos(X) – X[0, 1] 1E–10 1E–7 0.73908 Bisec= 23 Trisec= 14 Trisec+ = 4 Newton= 5 Bisec= 25 Trisec= 21 Trisec+ = 10 Newton= 10 (X–1.234) * (X–5.678) * (X+12.345)[5, 6] 1E–10 1E–7 5.678 Bisec= 28 Trisec= 18 Trisec+ = 4 Newton=6 Bisec= 30 Trisec= 23 Trisec+ = 10 Newton=12 (X–1.234) * (X–5.678) * (X+12.345)[1, 2] 1E–10 1E–7 1.234 Bisec= 28 Trisec= 17 Trisec+ = 4 Newton= 5 Bisec= 30 Trisec= 23 Trisec+ = 10 Newton= 10 (X–1.234) * (X–5.678) * (X+12.345)[5,11] 1E–10 1E–7 5.678 Bisec= 29 Trisec= 19 Trisec+ = 6 Newton= 7 Bisec= 31 Trisec= 32 Trisec+ = 14 Newton= 14 (X–1.234) * (X–5.678) * (X+12.345)[–8, –15]1E–10 1E–7 –12.345Bisec= 33 Trisec= 20 Trisec+ = 5 Newton= 6 Bisec= 35 Trisec= 30 Trisec+ = 13 Newton= 12 18

Thank You!! 19