10-02-2019, 10:23 AM

For case study purpose here is the very interesting algorithm to compute the square root of a number

by using this equation.

B = [A+(n÷A)] ÷ 2

This equation used Successive Approximation Algorithms that continue to better approximate some desired result by providing the initial guess then this program will converge on to the correct answer if your initial guess is bad then more iteration will be required to achieve a giving accuracy.

With this program it doesn't matter where you start your initial guess because this algorithm also used the

Change in the Approximation: ABS [(B-A) ÷ A] and Tolerance of 0.00000001 to guarantee that the result will be possible.

This equation solves for B, which is the new improved approximation for the square root of n until we are happy with this approximation, we continue repeating the process by coping the new B value into A and then re-executing the same equation to get a new B value.

-----------------------------------

Procedure: FIX 8

n [ENTER] A [R/S] display Answer [X<>Y] number of iterations

-----------------------------------

Example: √10 used 3 as a guess

10 [ENTER] 3 [R/S] 3.16227766 [X<>Y] 3.00000000

Answer: √10 = 3.16227766 and program took 3 iterations to get this answer.

------------------------------------

Program:

Gamo

by using this equation.

B = [A+(n÷A)] ÷ 2

This equation used Successive Approximation Algorithms that continue to better approximate some desired result by providing the initial guess then this program will converge on to the correct answer if your initial guess is bad then more iteration will be required to achieve a giving accuracy.

With this program it doesn't matter where you start your initial guess because this algorithm also used the

Change in the Approximation: ABS [(B-A) ÷ A] and Tolerance of 0.00000001 to guarantee that the result will be possible.

This equation solves for B, which is the new improved approximation for the square root of n until we are happy with this approximation, we continue repeating the process by coping the new B value into A and then re-executing the same equation to get a new B value.

-----------------------------------

Procedure: FIX 8

n [ENTER] A [R/S] display Answer [X<>Y] number of iterations

-----------------------------------

Example: √10 used 3 as a guess

10 [ENTER] 3 [R/S] 3.16227766 [X<>Y] 3.00000000

Answer: √10 = 3.16227766 and program took 3 iterations to get this answer.

------------------------------------

Program:

Code:

01 STO 2 // A

02 R↓

03 STO 1 // n

04 0

05 STO 0 // Counter

06 RCL 1

07 RCL 2

08 ÷

09 LSTx

10 +

11 2

12 ÷

13 STO 3 // Store B

14 RCL 2

15 -

16 LSTx

17 ÷

18 0

19 X<>Y

20 X≤Y

21 CHS

22 EEX

23 CHS

24 8

25 X<>Y

26 X≤Y

27 GTO 33

28 RCL 3 // B

29 STO 2 // Store A

30 1

31 STO+0

32 GTO 06

33 RCL 0

34 RCL 3

35 GTO 00

Gamo