Is it possible to write a program to simplify square roots? It would make my high school math career much easier. If so, I have no way to come up with it myself, so I want to see the code. My creation would be full of unnecessary logic and miserable attempts at optimization.

It might be possible. I would use the commandfor divisibility (can't remember it off the top of my head) to check for divisibility with common squares. Then once one is found you could run the division and display the result. Quite simple, really.

http://tibasicdev.wikidot.com/routines

Check under Math Routines.

eichermacher has the right idea, but let me explain further – simplifying a square root means pulling out factors that appear twice in the radicand. On the flipside, you can divide the larger square root by several smaller square roots in the hopes of getting a whole number. For example, if you start dividing √(216) by other square roots, you'll eventually discover that a divisor of √(6) leaves an exact answer of 6. Hence, you know that √(216) equals 6√(6). This makes sense for the following reason: if you are trying to reduce a "√(X)" to a "Y√(Z)", the sides must be equal to each other, so divide √(X) by every √(Z) until you come across a Y that's an integer.

Simplifying radicals, you mean? That's what this is about.

With the original being A√C

```
:For(B,2,1E30 // 1E30 means a very high number
:While not(fPart(C/(B² and this will work for any power root, just change that sign
:AB→A
:C/(B²→C
:End
:B+(1E31)(B²>C→B // just a simple way to end it, you could probably do it faster
:End
:ClrDraw
:Text(0,0,A,"√(",C,")
```

I just scrapped this together in 10 minutes. Correct me if it doesn't work.

You could look at a program I seemed to have made back in 2009 which does the job quite well.

PROGRAM:RADICAL

ClrHome

Input "^{x}√",X

Input "X=",C

Output(4,1,"=

1→J

If X<0:Then

If fPart(C/2

Then

‾1→J

Else

*i*→J

End

abs(X→X

End

int(abs(C→C

1→A:2→I:X→B

While I^C≤B

While not(fPart(B/I^C

B/I^C→B

AI→A

End

I+1+(I>2→I

End

C

Repeat Ans=1

C/Ans+1

While fPart(C/Ans

Ans+1

End

C/Ans→L

If Ans=1

Goto 0

If not(fPart(round(Ans^{x}√B

Then

C/Ans→C

L^{x}√B→B:C

End

Lbl 0

End

Output(5,1,AJ

1+(‾imag(J)+real(J)≠1)+int(log(A

Output(5,1+Ans,"^{x}√

Output(5,3+Ans,B

Output(6,1,"X=

Output(6,3,C

This one is particularly useful since it handles index reduction. That is, sometimes a fourth root does not simplify into a fourth root. An example would be $\sqrt[4]{196} = \sqrt{14}$.

Timothy Foster - @tfAuroratide

Auroratide.com - Go here if you're nerdy like me

Wow I just wanted one for Geometry, but this is no longer freshman math material. Thank you for the responses, I'll comprehend the math later and give these forums credit if anyone in my class is jealous. (I know how to do it outside of a program, don't worry)