Sunday, February 7, 2021

TI-86 and DM42/HP42S: Square Root Simplification

TI-86 and DM42/HP42S:  Square Root Simplification


Introduction


The program SQROOT attempts to factor √N into the form A√B (N, A, and B are positive integers).  The program tests whether X^2 evenly divides into N from X = 1 to int(√N).  If successful, let A = X and B = N/X^2.


Example:  


√88   (N = 88)

int(√88) = 9


Test:

88/9^2 ≈ 1.0864

88/8^2 = 1.375

88/7^2 ≈ 1.7959

88/6^2 ≈ 2.4444

88/5^2 = 3.52

88/4^4 = 5.5

88/3^2 ≈ 9.7778

88/2^2 = 22    


2^2 (4) divides into 88 evenly.  


Then A = 2, B = 22.  Therefore √88 = 2√22


TI-86 Program:  SQROOT


*  This code should work on the TI-83/TI-84 Plus family with no or very minor adjustments.


*  The arrow -> is made of two characters:  the minus sign (-) and the greater than sign (>).  


"2021-01-06 EWS"

Disp "√N -> A√B"

Prompt N

iPart(√N)→X

While X≠0

If fPart(N/X^2)==0

Then

X→A 

N/X^2→B

Goto A

Else

X-1→X 

End

End

Lbl A

Disp "√N = A√B : A=", A, "B=" , B



HP 42S/DM42/Free42 Program: SQROOT


*  The character ├ appends (attaches) alpha strings together.  To designate strings to be attached, press ENTER while in ALPHA entry mode.


*  Similarly, pressing RCL while ALPHA mode will allow you to recall the value of a register and attach it to current alpha string.


* The ALL mode is similar to the standard and float mode.


* Registers:  R00 = N, R01 = A, R02 = B


00 {52-Byte Prgm}

01 LBL "SQROOT"

02 "N?"

03 PROMPT

04 STO 00

05 SQRT

06 IP

07 STO 01

08 LBL 00

09 RCL 00

10 RCL 01

11 X↑2

12 ÷

13 STO 02

14 FP

15 X=0?

16 GTO 01

17 1

18 STO- 01

19 GTO 00

20 LBL 01

21 ALL

22 CLA

23 "√"

24 ARCL 00

25 ├"="

26 ARCL 01

27 ├"√"

28 ARCL 02

29 END


Examples


√88 = 2√22


√46 = 1√46


√178 = 1√178


√200 = 10√2


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


TI 84 Plus CE: Consolidated Debts

TI 84 Plus CE: Consolidated Debts   Disclaimer: This blog is for informational and academic purposes only. Financial decisions are your ...