Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Eniripsa96 on February 02, 2010, 04:50:43 pm
-
I have been working on a program, well it works but im making it better, that requests you to input the length of a leg of a triangle and it will give you all of the right triangles it can be in with all sides integers while it is still a leg. I don't have my cord right now but here's an example of what it would show/do.
Note: the etc at the end isnt in the end of the program, i just didnt want to type out all the outputs it gives
the * means its an action
the input 120 is just an example number you would type in, the following numbers all actual results it gives for 120 (go ahead, check them)
-Input ? 120-
*clears screen*
Possible Triplets (with the leg you entered being "A")
B=3599
C=3601
Area=215940
B=1798
C=1802
Area=107880
*pauses screen*
*clears screen*
B=1197
C=1203
Area=71820
B=896
C=904
Area=53760
*pauses screen*
*clears screen*
B=715
C=725
Area=42900
B=594
C=606
Area=35640
*pauses screen
*clears screen*
[etc]
EDIT: Alright, the program is uploaded, feedback is welcome and appreciated :P
EDIT: OOPS! I just noticed an extra character in the program that will make it error. If it tells you there's an error, delete the list symbol infront of the List1. (There will be 2 small Ls, delete the first one). Sorry about that, it was just a mistake from my optimizations.
-
Wow, sounds nice. I can't wait to see it. :)
-
Nice (http://209.85.48.10/6636/113/emo/happy0075.gif)
It won't be much useful to me, though, since I finished school almost 7 years ago :P
-
Interesting, I'm curious as to how this was done, cant wait to see the final program :)
-
I think i have an idea where my cord is, so ill upload it soon.
Also, i worked on optimizing the code and reduced its size by about 15%. (I must be bad at making optimized codes without editing >_>)
EDIT: got another 2.5% less bytes taken up >_< went from nearly 1k to a little over 800
-
So, yeah, the download is up for anyone who wants it, just be sure to delete the L i accidently left in the code, it will point right to it if you hit GoTo after an error shows up. I apologize again for leaving that in there, I just didn't notice it when trying to optimize the code.
-
Wow, that's really awesome! I put in 96 and sat back, watching the program work. It's a really neat, nice program. Great job!
I noticed the last line leaves a zero on the screen. Why don't you replace it with:
:Clrlist L1
:Output(1,1," //No spaces after the quote
Great job! What math class are you taking? (What class would this help in?)
-
Im doing Trigonometry right now, but i developed the way (formula) to do it last year in Geometry
Also, thanks for the advice and thanks!
-
Thanks, you are going to help a lot of people.
-
I'm not sure if you can use this, but the most efficient way (that at least I could think of) to find a third base given two bases (and the third value set to 0) is:
:Prompt A,B,C
:C²-B²-A²
:√(Ans-2Ansnot(C
I also made some minor optimizations to your code:
::"PYTHAGOREAN FINDER
:
:0→dim(L1
:100→dim(L1
:ClrHome
:Disp "ENTER LEG LENGTH"," ","DECIMALS ARE","ROUNDED
:Input A
:iPart(abs(A→A
:If A>10^4
:Then
:ClrHome
:Pause "THAT'S TOO LARGE
:prgmPYTHAGRN
:Return
:End
:1→C
:1→B
:If A=2iPart(A/2
:2→C
:ClrHome
:Output(1,1,"FINDING FACTORS
:Output(7,1,"AMOUNT FOUND
:Output(5,1,"CHECKING NUMBER
:While C≤A/2
:Output(6,3,C
:Output(7,14,B-1
:Output(8,1,200C/A
:Output(8,5,"PERCENT DONE
:If A=CiPart(A/C
:Then
:C→L1(B
:B+1→B
:Output(3,1,"FOUND FACTOR
:Output(4,3,C
:End
:C+2→C
:End
:ClrHome
:1→B
:1→J
:While J
:L1(B→J
:B+1→B
:End
:ClrHome
:B→L
:3-L1(1→K
:K+1→M
:Output(2,1,"FINDING EXTRA
:Output(3,1,"NUMBERS...
:While K<B-1
:If M≥B
:Then
:K+1→K
:K→M
:End
:If B=1
:Then
:ClrHome
:Pause "NO TRIPLETS!
:ClrHome
:Return
:End
:DelVar I
:If M<B
:∟L1(K)L1(M)→I
:If I>L1(B-1) and I<A
:Then
:Output(4,1,"FOUND EXTRA
:I→L1(L
:L+1→L
:End
:If I≥A
:Then
:K+1→K
:K→M
:End
:M+1→M
:End
:1→B
:2→D
:ClrHome
:Output(1,1,"POSSIBLE TRIPLET"
:L1(B)→C
:While C
:If D=10 or D=9
:Then
:Pause
:ClrHome
:1→D
:End
:Output(D,1,"B=
:Output(D,3,(A2-C2)/(2C
:Output(D+1,1,"C=
:Output(D+1,3,(A2+C2)/(2C
:Output(D+2,1,"AREA=
:Output(D+2,6,(A((A2-C2)/(2C)))/2
:D+4→D
:B+1→B
:L1(B→C
:End
:Pause
:ClrHome