# Simplifying Radicals on the TI-84 CE

Unfortunately, there doesn’t seem to be a pre-existing function on the TI-84 CE to present a simplified radical. You can write a program, which I provide here, but this takes a lot of work to simply enter into the calculator that I don’t advise it. However, I’m presenting it here to give you an idea of how to program the calculator, in case you’re interested.

To create a program of your own, including entering this one, press the prgm button, then select NEW and 1:Create New. Give it a name (I called this SIMPRAD for “Simplify Radical”).

Then enter the code below, not including the line-initial colons. These colons represent the start of a new line.

:1→C
:"+"→Str3
:If D<0
:Then
:-D→D
:"i"→Str3
:End
:If D>0 and fPart(D)=0
:Then
:While fPart(D/4)=0
:C*2→C
:D/4→D
:End
:For(E,3,√(D),2)
:While fPart(D/E^2)=0
:C*E→C
:D/E^2→D
:End
:End
:"?
:For(A,1,1+log(C))
:sub("0123456789",ipart(10*fPart(C*10^(-A)))+1,1)+Ans
:End
:sub(Ans,1,length(Ans)-1→Str1
:"?
:For(A,1,1+log(D))
:sub("0123456789",ipart(10*fPart(D*10^(-A)))+1,1)+Ans
:End
:sub(Ans,1,length(Ans)-1→Str2
:If Str3="i"
:Str1+Str3→Str1
:If D>1
:Str1+"√("+Str2+")"→Str1
:Disp Str1
:Else
:If D=0
:Then
:Disp "0"
:Else
:Disp "INVALID"
:End
:End

I won’t go through all the entry details; some of the characters can be entered from keys on the calculator, while others require going to specific menus. If you really do want to enter this into your calculator, search around or ask me for specific items.

Let’s look at how each section of this code works.

:1→C
:"+"→Str3

The lines above ask the user for the number to be simplified. For instance, if you want to simplify $$\sqrt{412}$$, you would enter 412. When the program is done, D will hold the radicand and C will hold the coefficient. Str3 will let us know if the initial radicand is negative.

:If D<0
:Then
:-D→D
:"i"→Str3
:End

The lines above allow for imaginary roots.

:If D>0 and fPart(D)=0
:Then

We will only process positive integers this way; 0 and non-integers will be handled separately.

:While fPart(D/4)=0
:C*2→C
:D/4→D
:End

There are two approaches we could use: Have a list of primes that we walk through, or test 2 and then all odd integers greater than 1. For ease of programming, I’ll do the latter. So these lines divide the radicand by $$2^2 = 4$$ until doing so results in a non-integer.

:For(E,3,√(D),2)
:While fPart(D/E^2)=0
:C*E→C
:D/E^2→D
:End
:End

These lines divide the radicand by $$3^2 = 9$$, $$5^2 = 25$$, and so on up to the square root of the radicand, moving on to each new odd number when dividing results in a non-integer.

At this point, we have what we need. If we were willing to have ugly output, we could pretty much stop here. Most of the rest of the code is to make the output attractive. Because the TI-84 CE couldn’t easily convert a number into a string (characters on a screen that aren’t numbers), and couldn’t connect a number to a string, we have to do this. A recent OS update changed this, but I’m providing code that works for all the calculators we have in the room.

:"?
:For(A,1,1+log(C))
:sub("0123456789",ipart(10*fPart(C*10^(-A)))+1,1)+Ans
:End
:sub(Ans,1,length(Ans)-1→Str1

The lines above convert the coeefficient from the number C into the string Str1.

:"?
:For(A,1,1+log(D))
:sub("0123456789",ipart(10*fPart(D*10^(-A)))+1,1)+Ans
:End
:sub(Ans,1,length(Ans)-1→Str2

The lines avove convert the radicand into Str2.

:If Str3="i"
:Str1+Str3→Str1
:If D>1
:Str1+"√("+Str2+")"→Str1
:Disp Str1

The lines above create a string like 4i√3. The rest of the code handles 0 (in which case, just display 0) and non-integers (in which case, display “INVALID”).

:Else
:If D=0
:Then
:Disp "0"
:Else
:Disp "INVALID"
:End
:End

I think this gives an interesting overview to programming the TI 84. If you have a personal calculator and want to store this, feel free.