http://calcg.org/newlogo2.png Not Logged in.
Login | Register

General Discussion Board \ Calculator Programming \ Need help programming Radical Reducer

Click here to log in (you must be logged in to post comments).

AuthorComment
Plane_freak
Probe
Posted: 20 Sep 2007
20:38 GMT
Total Posts: 2
Hello, I am relatively new to programming, but I have done a few simple ones. I could download one to reduce radicals but, I want to integrate it into another program and there is a block on the ones I have found. I use a TI-83+.

Here's what I am thinking:

:ClrHome
:Output(1,1,"Radical Reducer")
:Input "√=",A
:If √(A)=?
: (Here I want it say that if A=(a whole number) then display it)
:
:
: (Here's where I have no idea. I have thought of using something
: like a greatest common denominator, but I doubt that would work)
:
:
:Output(3,1,C) (C is the number outside the radical)
:Output(3,3,"√") (B is the number left inside the radical)
:Output(3,5,B)

Any ideas???
Xphoenix
Ultralisk
avatar
Posted: 21 Sep 2007
22:18 GMT
Total Posts: 210
For checking if a number is whole:

:If fpart(A)
:Then
:<Number is not integer>
:Else
:<Number is integer>
:Output(Row,Column,A)
:End

Also, I think there might have been a faster way, or maybe that was with int( and ipart(.

---
~Xphoenix
CoffmanRunner
Ultralisk
avatar
Posted: 22 Sep 2007
05:48 GMT
Total Posts: 235
while i like what your trying to do and would love a copy if you finish it (because i was never able to get mine to work) OmniCalc (spelling?) has a radical reducer built into it. Now the downside is that when you enable omnicalc it disables xlib so you have to keep "installing" them from the app menu when you want to use one or the other. But again I really hope you succeed in this! I can't even remember what huge road block I ran into with this program :)

---
Never gonna let you down...
haveacalc
Guardian
avatar
Posted: 23 Sep 2007
14:45 GMT
Total Posts: 1111
Why did you bother posting that, Xpheonix? Only offer seemingly useful code.

This program simplifies numbers that can be simplified down to integer*√(single-digit integer), even if the single-digit integer is 1. The answer is returned in Str2:
Prompt A
1→B
8→C
"CAN'T→Str2
A
While B<C and fPart(Ans
B+1→B
A/√(Ans
End
ClrHome
If fPart(Ans
Goto L
Ans→C
"0123456789→Str1
If B≠1
"√("+sub(Str1,1+B,1)+")→Str2
C
While Ans
.1Ans→C
sub(Str1,1+10fPart(Ans),1)+Str2→Str2
iPart(C
End
If B=1
sub(Str2,1,length(Str2)-5→Str2
Disp Str2
Stop
Lbl L
Disp Str2


---
-quoted directly from most movies that don't exist (and some that do).
Plane_freak
Probe
Posted: 30 Sep 2007
20:19 GMT
Total Posts: 2
I finished it. It was a little longer than I thought it would be.
I could have made it shorter by cutting out all the output lines and leaving disp. I don't like how it looks though. It will only do squares. If you have any questions or comments let me know.

:ClrHome
:Disp "RADICAL REDUCER"
:Disp "ENTER NUMBER"
:Input "√(",A
:iPart(√(A)+1)→F
:1→G
:A→C
:While F>1
:F-1→F
:(F²)→F
:If (fPart(A/F)=0)
:Then
:(√(F))G→G
:A/F→A
:End
:(√(F))→F
:End
:Output(5,1,G)
:C/(G²)→X
:int(log(G)+2→P
:Output(5,P,"√(")
:Output(5,P+1,X)
:Pause
:ClrHome
im_an_alien
Marine
Posted: 4 Oct 2007
18:38 GMT
Total Posts: 29
Nice. I made one for the 86 that was smaller, but took a long time, since it used a for loop to look through all numbers <input and >0 for perfect square factors...





Portal | My Account | Register | Lost Password or Username | TOS | Disclaimer | Help | Site Search | File Archives Copyright © 2002-2019 CalcG.org