Image Map Image Map
Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: TI-74 Basic programs?

  1. #21

    Default

    Speaking of spaghetti code... "

    Just kidding - BASIC limits choice in this regard.

    Although it can be done...

  2. #22

    Default

    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

  3. #23

    Default

    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

  4. #24

    Default

    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.

  5. #25

    Default

    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)

  6. #26
    Join Date
    Apr 2003
    Location
    Amarillo, TX
    Posts
    1,168

    Default

    Of course that's assuming it's not the New England Patriots footballs!


    Quote Originally Posted by thumbs View Post
    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/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •