Like many others around my age, my first exposure to programming came from my TI graphing calculator and its built in TI-BASIC programming language. I recently pulled out my old TI-83+ for a bit of nostalgic fun, and I copied out a few of the programs I remember writing. It’s interesting revisiting these almost a decade later and trying to figure out just what exactly I was thinking when I wrote them.

## The Pythagorean Theorem

One of my earliest programs (at least among the ones that survived) was a little thing that basically ran the Pythagorean Theorem. Given the length of two sides of a right triangle, it would deduce the length of the third.

I think that by the time I was writing these programs I was well past the point of ever being quizzed on the Pythagorean Theorem, so I’m guessing that this was some early proof-of-concept experimentation with the idea of writing programs for the TI-83+. I used a relatively simple formula that I could easily test to make sure the program behaved as I expected it to.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Input "LEG 1:",A Input "LEG 2:",B Input "HYPOTENUSE:",H If H=0 Then A^(2) + B^(2) -> C √(C) -> D Disp "HYPOT IS ",D End If B=0 Then H^(2) - A^(2) = C √(C) -> D Disp "LEG IS ",D End |

#### Notes

The style of user input is very primitive, the program prompts for the length of all three sides of the triangle and the user is expected to enter a “0” for the unknown side. I apparently didn’t add in a contingency in case the user entered a “0” for the first leg. These are the corners you can cut when you’re 100% sure that no one besides yourself will ever use the program you’re writing.

## Trigonometry

This program probably dates to around the mid-point of my career as a TI-BASIC developer. It’s a little more complex than the program above, and the method for handling user input is slightly improved. The function of this program is to take as input the angle (in degrees) of one angle of a right triangle, the length of one side, and the relationship of the know side to the known angle (e.g. opposite, adjacent, or hypotenuse).

I would have been in the middle of *Algebra II* or *Analysis and Trigonometry* when I wrote this, so it’s likely that I actually used this program in my math classes. The math isn’t particularly complicated, so it likely just saved me a few extra computations on the calculator here and there.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
Input "ANGLE θ:",θ Input "WHICH SIDE:",S Input "LENGTH:",L If S=A Then cos(θ) -> X L/X -> H tan(θ) -> B B * L -> O 90 - θ -> V Disp "OPP IS",O,"HYP IS",H,"ANGLE IS",V End If S=O Then sin(θ) -> X L/X -> H tan(θ) -> Y L/Y -> A 90 - θ -> V Disp "HYP IS",H,"ADJ IS",A,"ANGLE IS",V End If S=H Then sin(θ) -> X X * L -> O cos(θ) -> Y Y * L -> A 90 - θ -> V Disp "OPP IS",O,"ADJ IS",A,"ANGLE IS",V End |

#### Notes

I hate to say it, but I hardly remember what any of that math means. I’m sure it has something to do with SohCahToa. Anyway, the user input is improved here, instead of just having the user put in a “0” for any unknown value, I actually specified the relationship between the angle and side by using letters for input. This is still less than perfect, as anyone who sees this program for the first time will have no idea what to input for “WHICH SIDE:”, but it’s a step in the right direction.

## Interest

This program represents my pinnacle as a 17-year-old TI-BASIC programmer. Written specifically for one chapter of our textbook that dealt with interest formulas, this program was devised to solve any of those formulas for any possible variable. Its user input system is substantially improved over my previous works, and it demonstrates a multi-level complexity instead of the simple strung-together if/then statements we’ve seen up to this point.

I remember very clearly writing this program in specific response to class materials, and I even remember the test on this subject, which I finished significantly faster than everyone else in the class. I don’t think it can really be considered cheating, since the level of understanding of the material required to write this program was probably substantially higher than that required to ace the test.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
Menu("INTREST","CONTINUOUS",A,"COMPOUND",B,"PAYMENT",C,"INVESTMENT",D) Lbl A Menu("FIND","AMOUNT",E,"PRINCIPLE",F,"RATE",G,"TIME",H,"APY",Z) Lbl E Input "PRINCIPLE:",Y Input "RATE:",X Input "TIME:",W Y*(e^((X/100)*W))->Z Disp "AMOUNT IS",Z Stop Lbl F Input "AMOUNT:",Y Input "RATE:",X Input "TIME:",W Y/(e^((X/100)*W))->Z Disp "PRINCIPLE IS",Z Stop Lbl G Input "AMOUNT:",Y Input "PRINCIPLE:",X Input "TIME:",W ((ln(Y/X))/W)*100->Z Disp "RATE IS",Z Stop Lbl H Input "AMOUNT:",Y Input "PRINCIPLE:",X Input "RATE:",W (ln(Y/X))/(W/100)->Z Disp "TIME IS",Z Stop Lbl Z Input "RATE:",Y ((e^(Y/100))-1)*100->Z Disp "APY IS",Z Stop Lbl B Menu("FIND","AMOUNT",I,"PRINCIPLE",J,"RATE",K,"TIME",L,"APY",Y) Lbl I Input "PRINCIPLE:",Y Input "RATE:",X Input "TIME:",W Input "COMPOUNDED:",V Y*((1+((X/100)/V))^(V*W))->Z Disp "AMOUNT IS",Z Stop Lbl J Input "AMOUNT:",Y Input "RATE:",X Input "TIME:",W Input "COMPOUNDED:",V Y/((1+((X/100)/V))^(V*W))->Z Disp "PRINCIPLE IS",Z Stop Lbl K Input "AMOUNT:",Y Input "PRINCIPLE:",X Input "TIME:",W Input "COMPOUNDED:",V 100*(V*(((Y/X)^(1/(W*V))-1))->Z Disp "RATE IS",Z Stop Lbl L Input "AMOUNT:",Y Input "PRINCIPLE:",X Input "RATE:",W Input "COMPOUNDED:",V (((log(Y/X))/(log(1+((W/100)/V))))/V->Z Disp "TIME IS",Z Stop Lbl Y Input "RATE:",Y Input "COMPOUNDED:",X (((1+((Y/100)/X))^X)-1)*100->Z Disp "APY IS",Z Stop Lbl C Menu("FIND","VALUE",M,"PAYMENT",N,"RATE",O,"TIME",P) Lbl M Input "PAYMENTS:",Y Input "RATE:",X Input "TIME:",W Input "COMPOUNDED:",V Y*((1-(1+((X/100)/V))^-(W*V))/((X/100)/V))->Z Disp "VALUE IS",Z Stop Lbl N Input "VALUE:",Y Input "RATE:",X Input "TIME:",W Input "COMPOUNDED:",V Y/((1-((1+X/100)/V))^-(W*V)))/((X/100)/V))->Z Disp "PAYMENTS ARE",Z Stop Lbl O Input "VALUE:",Y Input "PAYMENT:",X Input "TIME:",W Input "COMPOUNDED:",V Input "GUESS:",T Input "Xmin:",S Input "Xmax:",R solve((X*((1-(1+(U/V))^-(W*V))/(U/V)))-Y,U,T, {S,R})->Z Disp "RATE IS",Z Stop Lbl P Input "VALUE:",Y Input "PAYMENT:",X Input "RATE:",W Input "COMPOUNDED:",V ((log(((Y*(W/100))/(X*V))+1))/(log(1+((W/100)/V)))/V->Z Disp "TIME IS",Z Stop Lbl D Menu("FIND","VALUE",Q,"PAYMENT",R,"RATE",S,"TIME",T) Lbl Q Input "PAYMENT:",Y Input "RATE:",X Input "TIME:",W Input "COMPOUNDED:",V Y*((((1+((X/100)/V))^(V*W))-1)/((X/100)/V))->Z Disp "VALUE IS",Z Stop Lbl R Input "VALUE:",Y Input "RATE:",X Input "TIME:",W Input "COMPOUNDED:",V Y/((((1+((x/100)/V))^(W*V))-1)/((X/100)/V))->Z Disp "PAYMENTS ARE",Z Stop Lbl S Input "VALUE:",Y Input "PAYMENT:",X Input "TIME:",W Input "COMPOUNDED:",V Input "GUESS:",T Input "Xmin:",S Input "Xmax:",R solve((X*((1-(1+((U/100)/V))^(W*V))/((U/100)/V)))-Y,U,T,{S,R})->Z Disp "RATE IS",Z |

#### Notes

It appears this program was left unfinished. It feels like a waste to leave it that way, but I don’t know if I’m willing to rededicate myself to this project enough to figure out how to solve for Time in an Investment formula. The program still runs and solves fine, so apparently leaving out that section and a couple of trailing Stop lines isn’t really a problem.

Potentially a problem, I have no idea what the solve() function that I made use of several times does or why it was necessary. And I seem to be all over the place when assigning variable names. I exclusively used single letters for variables, I wonder if it’s possible to create longer variable names in TI-BASIC and I just didn’t know about it.

One thing I do know for sure, the use of menu() is a much better way to navigate through user input options than either of the methods in the other programs above. And the fact that I realized I could use menus within menus instead of trying to use “0” values to deduce which variable to solve for once inside the top level menu is satisfying. Overall, this is a pretty neat and really quite useful program. It would probably be even better if it was finished.

## Leave a Reply