Speaking of spaghetti code... "
Just kidding - BASIC limits choice in this regard.
Although it can be done...
![]() |
![]() |
Speaking of spaghetti code... "
Just kidding - BASIC limits choice in this regard.
Although it can be done...
Conversions, 1-4-19
I thought it would be nice to have a package of my own frequently used conversions. The layout 'mi>km', miles to kilometers, made sense to me. The number 1.6093 multiplied by miles should yield kilometers. Enter your own conversions and multiplier beginning at 7000 in the DATA statements. I included some conversions I frequently use. Use multipliers with more digits for more accurate results.
For conversions using a formula like 'f>c', fahrenheit to celsius, enter the conversion then a -1 for the number multiplier. This will send the program to the 7900s where you can work the equation. Follow the programming example that's there. Keep all conversions with a number multiplier between 7000 and 7399 (above the -1s).
The 'ans' variable on the display will contain the answer. You can use it to seed another input. If you type the program in, make sure it's all working properly. On line 7490 make sure you type 'end..,..' (end, two periods, comma, two periods).
Entering 'conv' for a conversion will list the conversions. Entering 'conv#' will list the conversions plus the conversion multiplier. Compare all conversions to known results before using.
(I'm no programmer but if you have the red sauce I have the code
Code:7000 DATA mi>km,1.6093,km>mi,0.6214 7010 DATA yd>m,0.9144,m>yd,1.0936 7020 DATA ft>m,0.3048,m>ft,3.2808 7030 DATA in>mm,25.4,mm>in,0.03937 7040 DATA in>cm,2.54,cm>in,0.3937 7050 DATA in>m,0.0254,m>in,39.37 7060 DATA in2>mm2,645.16,mm2>in2,0.00155 7070 DATA in2>cm2,6.4516,cm2>in2,0.155 7080 DATA ft2>m2,0.0929,m2>ft2,10.764 7090 DATA in3>cm3,16.387,cm3>in3,0.06102 7100 DATA gal>ltr,3.7854,ltr>gal,0.26417 7110 DATA in3>gal,0.004329,gal>in3,231 7120 DATA in3>ltr,0.01639,ltr>in3,61.023 7130 DATA gal>cm3,3785.4,cm3>gal,0.000264 7140 DATA lbs>kgs,0.4536,kgs>lbs,2.2046 7150 DATA mph>ft/s,1.46667,ft/s>mph,0.6818166322 7400 REM only -1s below 7405 DATA f>c,-1,c>f,-1 7490 DATA end..,.. 7500 PRINT "Conversion":PAUSE .8:A9$="":B9=0:RESTORE 7000 7510 PRINT Z9$;" conv ";:ACCEPT NULL(Z9$),Z9$ 7512 IF Z9$="conv"OR Z9$="conv#"THEN C9=0:GOTO 7800 7518 PRINT C9;"num ";:ACCEPT NULL(C9),C9 7520 READ A9$,B9 7525 IF B9=-1THEN 7900 7530 IF A9$=Z9$THEN 7570 7540 IF A9$="end.."THEN PRINT Z9$;" not found":Z9$="":PAUSE:GOTO 7500 7550 GOTO 7520 7570 ANS=C9*B9 7580 PRINT "ans";C9;A9$;" =";ANS:PAUSE:GOTO 7500 7800 RESTORE 7000 7810 READ A9$,B9$:IF Z9$="conv"THEN PRINT A9$:PAUSE 7815 IF Z9$="conv#"THEN PRINT A9$;" ";B9$:PAUSE 7820 IF A9$="end.."THEN 7500 ELSE 7810 7830 GOTO 7500 7900 IF Z9$="c>f"THEN ANS=(C9*(9/5))+32:A9$=Z9$:GOTO 7580 7910 IF Z9$="f>c"THEN ANS=(C9-32)*(5/9):A9$=Z9$:GOTO 7580 7990 A9$="end..":GOTO 7540
Example:
conv lbs>kgs [enter]
0 num 210 [enter]
ans 210 lbs>kgs = 95.256
[enter]
lbs>kgs conv [enter]
210 num 300 [enter]
ans 300 lbs>kgs = 136.08
[enter]
lbs>kgs conv kgs>lbs [enter]
300 num 136.08 [enter]
ans 136.08 kgs>lbs = 300.001968
Wind Chill, 1-25-19
Sometimes the weather report doesn't give the wind chill. Sometimes my local weather conditions differ from the weather report. When it's really cold outside I like to know the wind chill. I went online and found math for wind chill and made this for the TI-74. It seems to yield similar results as weather forecasts. Check it out.
Code:600 PRINT "Wind Chill":PAUSE .6 610 PRINT TEMP;"temp,deg f ";:ACCEPT NULL(TEMP),TEMP 620 PRINT WSPED;"wind speed,mph ";:ACCEPT NULL(WSPED),WSPED 630 WCHIL=35.74+(.6215*TEMP)-(35.75*WSPED^.16)+(.4275*TEMP*WSPED^.16) 640 ANS=WCHIL:PRINT USING"ans wind chill,deg f=###.#";WCHIL:PAUSE:GOTO 600
Example:
0 temp,deg f -5 [enter]
0 wind speed,mph 13 [enter]
ans wind chill,deg f=-24.5
-5 temp,deg f 13 [enter]
13 wind speed,mph 5 [enter]
ans wind chill,degf= 4.8
A few years ago, I wrote a crappy program to calculate prime numbers. Every once in a while, at social gatherings, I'd pull out the TI-74 and announce that whatever number on the screen is a prime number.
Simpson's Rule, 3-2-19
I found this website that calculated the volume of an American football with a definite integral.
https://www.math.ucdavis.edu/~morris/16B/sec5.7.pdf
As I've said before, I'm no programmer and I'm poor at math. But I wanted to see if I could work a definite integral on my TI-74. I found Simpson's Rule which is supposed to work a definite integral. I programmed Simpson's Rule on my 74. I put the definite integral on line 8100. It seems to work okay....at least it gave the results of their football example.
Code:8000 PRINT "Simpson's Rule":PAUSE 1:Z=0:V=1:Y=0 8005 PRINT "Def.Integral..line 8100":PAUSE 1 8010 PRINT A;"start ";:ACCEPT NULL(A),A 8020 PRINT B;"end ";:ACCEPT NULL(B),B 8030 PRINT C;"step ";:ACCEPT NULL(C),C 8040 D=(B-A)/C:X=A-D 8045 IF (C/2)-INT(C/2)>0 THEN PRINT "..step even #s only":PAUSE :GOTO 8030 8050 X=X+D:IF X>B THEN 8130 8060 IF X=B THEN V=1 8070 IF V=1 THEN 8100 8080 IF V=2 THEN V=4:GOTO 8100 8090 IF V=4 THEN V=2 8100 Y=((-.0944*X^2)+3.4)^2*PI 8105 PRINT "x=";X;" y=";Y 8110 Y=Y*V:IF V=1 THEN V=2 8120 Z=Z+Y:GOTO 8050 8130 F=(Z*D)/3 8140 ANS=F:PRINT "ans=";F:PAUSE:GOTO 8000
Football example:
0 start -5.5 [enter]
0 end 5.5 [enter]
0 step 20 [enter]
ans= 232.1679769 in3 - football volume (cubic inches)
(delete line 8105 if you don't want to see X and Y on the display)
Outside a dog, a book is a man's best friend. Inside a dog it's too dark to read! Groucho Marx
Curtis McCain
http://pages.suddenlink.net/curtismc/
Calories Burned Cycling, 4-3-19
Now that the weather's warmer, I'm back on my bicycle. If I didn't ride my bicycle I'd probably not excercise at all. I vary my ride frequently and often wonder how many calories a given ride burns. I found this Calories Burned Cycling calculator online:
https://captaincalculator.com/health...ng-calculator/
It seems to work good. I decided to write a program for my Ti-74 using their math and info. The Ti-74 yields results pretty close to the example given. Checkout the website for more detailed information with an explanation and examples of MET. I did include some of their MET values I thought were pertinent.
Code:1400 DATA met number is the.. 1402 DATA metabolic equivalent of task 1405 DATA leisure 5.5 mph = 3.5 met 1410 DATA leisure 9.4 mph = 5.8 met 1420 DATA bicycling general = 7.5 met 1430 DATA mountain general = 8.5 met 1440 DATA fast 14-15.9 mph = 10 met 1450 DATA racing 16-19 mph = 12 met 1490 DATA end 1500 PRINT "Calories Burned Cycling":PAUSE .8:A7$="":RESTORE 1400 1510 PRINT W;"your weight ";:ACCEPT NULL(W),W 1520 PRINT CW$;" (l)bs or (k)gs ";:ACCEPT NULL(CW$),CW$ 1530 IF CW$="l"THEN WT=W*0.45359237:GOTO 1560 1540 IF CW$="k"THEN 1560 1550 GOTO 1520 1560 PRINT MT$;" (m)et or (v)iew ";:ACCEPT NULL(MT$),MT$ 1570 IF MT$="v"THEN 1600 ELSE 1590 1580 GOTO 1560 1590 PRINT MET;"met ";:ACCEPT NULL(MET),MET:GOTO 1630 1600 READ A7$ 1610 IF A7$="end"THEN RESTORE 1400:GOTO 1560 1615 PRINT A7$:PAUSE 1620 GOTO 1600 1630 PRINT MIN;"ride mins ";:ACCEPT NULL(MIN),MIN 1640 ANS=((MET*WT*3.5)/200)*MIN 1650 PRINT USING"ans calories burned ####.#";ANS:PAUSE:GOTO 1500
Example:
0 your weight 160 [enter]
(l)bs or (k)gs l [enter] -- pounds or kilograms
(m)et or (v)iew m [enter] -- to enter or view met value
0 met 5.8 [enter] -- met number from list
0 ride mins 80 [enter] -- total minutes of bike ride
ans calories burned 589.3
160 your weight 72.72 [enter]
l (l)bs or (k)gs k [enter]
m (m)et or (v)iew [enter]
5.8 met [enter]
80 ride mins [enter]
ans calories burned 589.3
Calories Burned Cycling, corrections, 4-4-19
I found some errors. Change:
1540 IF CW$="k"THEN WT=W:GOTO 1560
1570 IF MT$="v"THEN 1600
1575 IF MT$="m"THEN 1590
The Kgs example result: 590.5
If I find anymore, I'll let you know. Like I've said, I'm no programmer.
Right Triangle, 5-17-19
I like playing with old cars. I needed something more flexible than P>R and R>P for suspension geometry and body angles. I made this program for my ti74 that works a right triangle. I tried to describe the labeling I used for the right triangle in the program with text. On input type h for help. All angles are in degrees decimal (deg dec).
I used this prompt for input, " _ _>_ _;_ _ " for "sa>sb;aa" meaning I want Side A using Side B and Angle A. The underscore characters "_ _" in the prompt are [ctl] [5] keyboard characters without any space between.
Before using Right Triangle, run through every input to be sure it's yielding accurate known results. (see IF/THENs below) I gave a right triangle sides and angles example. Expect some rounding error in example results.
After viewing answer with following input values use [space] to repeat the answer. And like usual, I'm no programmer or math expert but the program seems to work good for me.
Code:14000 PRINT "Right Triangle":PAUSE .6:RESTORE 14400:ON ERROR 14490 14005 Z$=D$:PRINT D$;:INPUT " _ _>_ _;_ _ ";D$:IF D$=""THEN D$=Z$ 14008 IF D$="h"THEN 14300 14010 IF D$="sa>sb;aa"THEN INPUT "sb ";B,"aa ";C:F=B*TAN(C):GOTO 14210 14020 IF D$="sa>sc;aa"THEN INPUT "sc ";B,"aa ";C:F=B*SIN(C):GOTO 14210 14030 IF D$="sa>sc;ab"THEN INPUT "sc ";B,"ab ";C:F=B*COS(C):GOTO 14210 14040 IF D$="sb>sc;aa"THEN INPUT "sc ";B,"aa ";C:F=B*COS(C):GOTO 14210 14050 IF D$="sb>sa;ab"THEN INPUT "sa ";B,"ab ";C:F=B*TAN(C):GOTO 14210 14060 IF D$="sb>sa;aa"THEN INPUT "sa ";B,"aa ";C:F=B/TAN(C):GOTO 14210 14070 IF D$="sc>sa;aa"THEN INPUT "sa ";B,"aa ";C:F=B/SIN(C):GOTO 14210 14080 IF D$="sc>sb;aa"THEN INPUT "sb ";B,"aa ";C:F=B/COS(C):GOTO 14210 14090 IF D$="sc>sa;ab"THEN INPUT "sa ";B,"ab ";C:F=B/COS(C):GOTO 14210 14100 IF D$="aa>sa;sc"THEN INPUT "sa ";B,"sc ";C:F=ASIN(B/C):GOTO 14210 14110 IF D$="aa>sb;sc"THEN INPUT "sb ";B,"sc ";C:F=ACOS(B/C):GOTO 14210 14120 IF D$="aa>sa;sb"THEN INPUT "sa ";B,"sb ";C:F=ATN(B/C):GOTO 14210 14130 IF D$="ab>sb;sc"THEN INPUT "sb ";B,"sc ";C:F=ASIN(B/C):GOTO 14210 14140 IF D$="ab>sa;sc"THEN INPUT "sa ";B,"sc ";C:F=ACOS(B/C):GOTO 14210 14150 IF D$="ab>sa;sb"THEN INPUT "sa ";C,"sb ";B:F=ATN(B/C):GOTO 14210 14160 IF D$="sa>sb;sc"THEN INPUT "sb ";C,"sc ";B:F=SQR(B^2-C^2):GOTO 14200 14170 IF D$="sb>sa;sc"THEN INPUT "sa ";C,"sc ";B:F=SQR(B^2-C^2):GOTO 14200 14180 IF D$="sc>sa;sb"THEN INPUT "sa ";C,"sb ";B:F=SQR(C^2+B^2):GOTO 14200 14190 PRINT "not found..":PAUSE:GOTO 14005 14200 E=B:B=C:C=E 14210 ANS=F:PRINT "ans";F;SEG$(D$,1,2):PAUSE:PRINT SEG$(D$,4,6);" =";B;";";C 14220 A$=KEY$:IF A$=" "THEN 14210 ELSE 14000 14300 READ H$ 14310 IF H$="end"THEN PRINT "end..":PAUSE 1:D$="":GOTO 14000 14320 PRINT H$:PAUSE 14330 GOTO 14300 14400 DATA Right Triangle Sides Angles (deg dec) 14402 DATA make an x y number line 14405 DATA where x y cross the angle is 90 deg 14410 DATA the y axis is Side A (sa) 14415 DATA the x axis is Side B (sb) 14420 DATA the hypotenuse from y to x is Side C (sc) 14425 DATA where y and hypotenuse meet is Angle B (ab) 14430 DATA where x and hypotenuse meet is Angle A (aa) 14435 DATA end 14490 PRINT "error..":PAUSE:GOTO 14000
Example: sa=25.5:sb=120:sc=122.68:aa=12:ab=78 (expect some rounding error)
Right Triangle edit: 5-17-19
To be sure you're in degree mode put DEG at the beginning of 14000:
14000 DEG:PRINT "Right Triangle":PAUSE .6:RESTORE 14400:ON ERROR 14490
For labeling, x y sides are positive:
14405 DATA where +x +y cross the angle is 90 deg
Bookmarks