Compucolor.org – Virtual Media

Listing of file='SIN1.BAS;01' on disk='vmedia/chip_36-sector.ccvf'

1 REM       INTRODUCTION TO SINE WAVES            JULY 1981
2 REM
3 REM       TUTORIAL ON AMPLITUDE AND PERIOD OF THE SINE WAVE
5 REM    16K COMPUCOLOR
6 REM
10 REM      PROGRAM WRITTEN BY JEAN BOHRER
11 REM      UNDER THE DIRECTION OF MARJORIE A. FITTING
12 REM      DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE
13 REM      SAN JOSE STATE UNIVERSITY, SAN JOSE, CA 95192
20 REM
21 REM "______________________________"
22 REM "!       SAN MATEO COUNTY      !"
23 REM "!     OFFICE OF EDUCATION     !"
24 REM "!             &               !"
25 REM "!  COMPUTER-USING EDUCATORS   !"
26 REM "!                             !"
27 REM "!          SOFTSWAP           !"
28 REM "!                             !"
29 REM "!333 MAIN STREET, REDWOOD CITY!"
30 REM "!CA 94063 (415)364-5600 EX4401!"
31 REM "_______________________________"
40 REM "_______________________________"
41 REM "! PROGRAMS MAY BE COPIED FOR  !"
42 REM "! EDUCATIONAL USE ONLY AND    !"
43 REM "! ARE NOT TO BE SOLD.         !"
44 REM "!!"
50 REM
60 REM
100 PLOT 12,23
110 PLOT 14
120 PRINT "SINCE SINE IS A FUNCTION, IT CAN BE GRAPHED"
130 PRINT "ON A SET OF COORDINATE AXES."
140 PRINT :PRINT
150 PRINT "THE X AXIS WILL BE MARKED IN UNITS OF PI,"
160 PRINT "AND THE Y AXIS IN ONE UNIT INCREMENTS."
170 PRINT :PRINT :PRINT
180 PRINT "THE FIRST SINE FUNCTION THAT WILL BE GRAPHED"
190 PRINT "IS Y=SIN(X) WHERE X IS IN RADIANS."
200 PRINT :PRINT
210 INPUT "PRESS RETURN TO SEE Y=SIN(X) GRAPHED.";A
220 PLOT 15
230 PLOT 12,20
240 GOSUB 2180
250 PLOT 3,4,0
260 INPUT "WHAT IS THE MAXIMUM OF THIS FUNCTION?";A
270 IF A= 1THEN 310
280 PLOT 3,4,1
290 PRINT "SORRY, THE MAXIMUM IS 1."
300 GOTO 330
310 PLOT 3,4,1
320 PRINT "RIGHT!"
330 PLOT 3,4,2
340 INPUT "WHAT IS THE MINIMUM OF THIS FUNCTION?";B
350 IF B= - 1THEN 390
360 PLOT 3,4,3
370 PRINT "SORRY, THE MINIMUM IS -1."
380 GOTO 410
390 PLOT 3,4,3
400 PRINT "GOOD JOB!"
410 PLOT 3,4,4
420 INPUT "PRESS RETURN TO CONTINUE.";A
430 REM  ERASE TEXT ON TOP OF PAGE
440 FOR X= 0TO 5
450 PLOT 3,4,X
460 PRINT "                                         "
470 NEXT X
480 PLOT 23
490 PLOT 3,4,0
500 PRINT "NOW LET'S SEE THE EFFECT ON THE GRAPH    "
510 PLOT 3,4,1
520 PRINT "WHEN WE LET A BE A NUMBER OTHER THAN 1"
530 PLOT 3,4,2
540 PRINT "IN THE EQUATION Y=A*SIN(X)."
550 PLOT 3,0,26
560 PRINT "CHOOSE A VALUE FOR A SUCH THAT -3<=A<=3 AND YOU"
570 PRINT "WILL SEE THE NEW GRAPH."
580 PLOT 22
590 INPUT "A= ";A
600 IF A> 3OR A< - 3THEN 630
610 GOSUB 2090
620 GOTO 650
630 PLOT 3,6,28
640 PRINT "SORRY,";A;" IS OUT OF RANGE"
650 PLOT 19
660 PLOT 3,0,29
670 INPUT "TRY ANOTHER VALUE FOR A. A= ";A
680 IF A> 3OR A< - 3THEN 710
690 GOSUB 2090
700 GOTO 730
710 PLOT 3,31,29
720 PRINT "OUT OF RANGE"
730 PLOT 21
740 PLOT 3,0,30
750 INPUT "TRY ONE MORE VALUE FOR A. A= ";A
760 IF A> 3OR A< - 3THEN 790
770 GOSUB 2090
780 GOTO 810
790 PLOT 3,32,30
800 PRINT "OUT OF RANGE"
810 GOSUB 2690
820 PLOT 12
830 PRINT "FOR ALL THE GRAPHS YOU MADE, DID THE X "
840 INPUT "INTERCEPTS REMAIN THE SAME?(Y/N)";A$
850 PLOT 19
860 IF A$= "Y"THEN 900
870 PRINT TAB( 4);"WRONG. ALL GRAPHS CROSSED THE X AXIS"
880 PRINT TAB( 4);"AT INTERVALS OF PI."
890 GOTO 920
900 PRINT TAB( 4);"RIGHT! ALL GRAPHS CROSSED THE X AXIS"
910 PRINT TAB( 4);"AT INTERVALS OF PI."
920 PRINT :PRINT
930 PLOT 23
940 PRINT "BY CHOOSING DIFFERENT VALUES FOR A DID THE"
950 INPUT "MAXIMUM AND MINIMUM OF THE CURVES CHANGE?(Y/N)";B$
960 PLOT 19
970 IF B$= "Y"THEN 1010
980 PRINT TAB( 4);"SORRY, CHANGING Y VALUES MADE TALLER OR"
990 PRINT TAB( 4);"SHORTER GRAPHS, AFFECTING THE MAX AND MIN."
1000 GOTO 1030
1010 PRINT TAB( 4);"RIGHT! CHANGING Y VALUES MADE TALLER OR"
1020 PRINT TAB( 4);"SHORTER GRAPHS."
1030 PRINT :PRINT :PRINT
1040 FOR K= 1TO 2000:NEXT K
1050 PRINT "THIS VERTICAL CHANGE AFFECTS WHAT IS CALLED THE"
1060 PRINT "AMPLITUDE OF THE CURVE."
1070 PRINT
1080 PRINT TAB( 10);"THE AMPLITUDE OF THE CURVE IS DEFINED"
1090 PRINT TAB( 10);"AS HALF THE VERTICAL DISTANCE FROM THE"
1100 PRINT TAB( 10);"MAXIMUM TO THE MINIMUM POINT."
1110 PLOT 2,18,66,242,97,66,97,48,18,48,18,66,255
1120 FOR K= 1TO 4000:NEXT K
1130 FOR X= 0TO 63STEP 2
1140 PLOT 3,X,21
1150 PRINT "c"
1160 NEXT X
1170 PLOT 3,0,24
1180 PRINT "ANOTHER WAY WE CAN VARY THE GRAPH OF Y=SIN(X)"
1190 PRINT "IS BY MULTIPLYING X BY A NUMBER."
1200 PRINT :PRINT
1210 PRINT "WE WILL AGAIN GRAPH Y=SIN(X) AND SEE THE EFFECT OF"
1220 PRINT "INSERTING A VALUE FOR B IN THE EQUATION Y=SIN(B*X)."
1230 INPUT "PRESS RETURN TO CONTINUE";A
1240 PLOT 12,20
1250 GOSUB 2180
1260 PLOT 23
1270 PLOT 3,4,0
1280 PRINT "HOW MANY INTERVALS OF PI DOES IT TAKE"
1290 PLOT 3,4,1
1300 INPUT "FOR THE CURVE TO REPEAT ITSELF?";A
1310 IF A= 2THEN 1350
1320 PLOT 3,4,2
1330 PRINT "SORRY, THE INTERVAL IS 2*PI."
1340 GOTO 1370
1350 PLOT 3,4,2
1360 PRINT "CORRECT!"
1370 PLOT 3,0,26
1380 PRINT "CHOOSE A VALUE FOR B SUCH THAT 0<B<=3 AND"
1390 PRINT "Y=SIN(B*X) WILL BE GRAPHED FOR YOU."
1400 PLOT 22
1410 PLOT 3,0,28
1420 INPUT "B= ";B
1430 IF B< = 0OR B> 3THEN 1460
1440 GOSUB 2600
1450 GOTO 1480
1460 PLOT 3,7,28
1470 PRINT "SORRY,";B;" IS OUT OF RANGE"
1480 PLOT 19
1490 PLOT 3,0,29
1500 INPUT "TRY ANOTHER VALUE FOR B. B= ";B
1510 IF B< = 0OR B> 3THEN 1540
1520 GOSUB 2600
1530 GOTO 1560
1540 PLOT 3,32,29
1550 PRINT "OUT OF RANGE"
1560 PLOT 21
1570 PLOT 3,0,30
1580 INPUT "CHOOSE 1 LAST VALUE FOR B. B= ";B
1590 IF B< = 0OR B> 3THEN 1620
1600 GOSUB 2600
1610 GOTO 1640
1620 PLOT 3,34,30
1630 PRINT "OUT OF RANGE"
1640 GOSUB 2690
1650 PLOT 12
1660 PRINT "FOR ALL THE GRAPHS YOU JUST MADE, WERE THE MAXIMUMS"
1670 INPUT "AND MINIMUMS THE SAME?(Y/N)";A$
1680 IF A$= "Y"THEN 1720
1690 PRINT TAB( 4);"SORRY, THEY ALL HAD A MAXIMUM OF 1 AND A"
1700 PRINT TAB( 4);"MINIMUM OF -1."
1710 GOTO 1740
1720 PRINT TAB( 4);"CORRECT! THEY ALL HAD A MAXIMUM OF 1"
1730 PRINT TAB( 4);"AND A MINIMUM OF -1."
1740 PRINT
1750 PRINT "HENCE, THEIR AMPLITUDES WERE THE SAME."
1760 PRINT :PRINT
1770 FOR K= 1TO 2000:NEXT K
1780 PRINT "AS YOU CHANGED THE VALUE OF B IN THE EQUATION"
1790 PRINT "Y=SIN(B*X), DID THE INTERVAL WITH WHICH THE CURVE"
1800 PRINT "REPEATED ITSELF REMAIN THE SAME FOR ALL GRAPHS?"
1810 INPUT "(Y/N)";B$
1820 IF B$= "N"THEN 1880
1830 PRINT TAB( 4);"SORRY,AS B CHANGED, THE GRAPH WAS EITHER"
1840 PRINT TAB( 4);"HORIZONTALLY COMPRESSED OR STRETCHED, WHICH"
1850 PRINT TAB( 4);"CHANGED THE INTERVAL OF REPETITION."
1860 PRINT :PRINT
1870 GOTO 1910
1880 PRINT TAB( 4);"RIGHT! AS B CHANGED, THE GRAPH WAS EITHER"
1890 PRINT TAB( 4);"HORIZONTALLY COMPRESSED OR STRETCHED OUT."
1900 PRINT :PRINT :PRINT
1910 FOR K= 1TO 3000:NEXT K
1920 PRINT :PRINT
1930 PRINT "WHEREAS AMPLITUDE DESCRIBES VERTICAL COMPRESSION"
1940 PRINT "AND EXPANSION, THE TERM PERIOD IS USED TO DESCRIBE"
1950 PRINT "HORIZONTAL COMPRESSION AND EXPANSION."
1960 PRINT
1970 PRINT TAB( 10);"IF P IS A NUMBER ON THE X AXIS SUCH THAT"
1980 PRINT TAB( 10);"THE CURVE BETWEEN THE INTERVAL FROM P TO"
1990 PRINT TAB( 10);"2P IS A REPETITION OF THE CURVE BETWEEN"
2000 PRINT TAB( 10);"THE INTERVAL FROM 0 TO P, THEN P IS THE"
2010 PRINT TAB( 10);"PERIOD OF THE CURVE."
2020 PLOT 2,18,37,242,102,37,102,14,18,14,18,37,255
2030 PRINT
2040 PRINT "WOULD YOU LIKE TO RUN THIS PROGRAM AGAIN?"
2050 INPUT "(Y/N)";A$
2060 IF A$= "Y"THEN 100
2065 LOAD "MENU":RUN
2070 END
2080 REM  SUB 3000 PLOTS A*SIN(X)
2090 FOR X= 0TO 100STEP 2
2100 PLOT 2,X+ 7,15* A* SIN (X/ 8)+ 70,255
2110 NEXT X
2120 PLOT 3,48,2
2130 PLOT 14
2140 PRINT "Y=";A;"*SIN(X)  "
2150 PLOT 15
2160 RETURN
2170 REM  SUB 4000 PLOTS AXES
2180 FOR X= 3TO 54
2190 PLOT 3,X,14
2200 PRINT "f"
2210 NEXT X
2220 PLOT 3,16,13
2230 PRINT "m"
2240 PLOT 3,28,13
2250 PRINT "o"
2260 PLOT 3,41,13
2270 PRINT "m"
2280 PLOT 3,53,13
2290 PRINT "o"
2300 FOR X= 2TO 25
2310 PLOT 3,3,X
2320 PRINT "o"
2330 NEXT X
2340 PLOT 3,1,3
2350 PRINT "3e"
2360 PLOT 3,1,6
2370 PRINT "2_"
2380 PLOT 3,1,10
2390 PRINT "1i"
2400 PLOT 3,1,14
2410 PRINT "0f"
2420 PLOT 3,0,18
2430 PRINT "-1e"
2440 PLOT 3,0,21
2450 PRINT "-2_"
2460 PLOT 3,0,25
2470 PRINT "-3i"
2480 PLOT 3,55,14
2490 PRINT "(UNITS OF"
2500 PLOT 3,55,15
2510 PRINT "    PI)"
2520 PLOT 17
2530 FOR X= 0TO 100STEP 2
2540 PLOT 2,X+ 7,15* SIN (X/ 8)+ 70,255
2550 NEXT X
2560 PLOT 3,48,0
2570 PRINT "Y=SIN(X)"
2580 RETURN
2590 REM  SUB 5000 PLOTS SIN(B*X)
2600 FOR X= 0TO 100STEP 2
2610 PLOT 2,X+ 7,15* SIN (X/ 8* B)+ 70,255
2620 NEXT X
2630 PLOT 3,48,2
2640 PLOT 14
2650 PRINT "Y=SIN(";B;"*X)  "
2660 PLOT 15
2670 RETURN
2680 REM  SUB 6000 SIGNALS TO CONTINUE
2690 PLOT 3,50,26
2700 PLOT 23
2710 PRINT "EXAMINE THESE"
2720 PLOT 3,50,27
2730 PRINT "GRAPHS, THEN"
2740 PLOT 3,50,28
2750 PRINT "PRESS RETURN"
2760 PLOT 3,50,29
2770 PRINT "TO CONTINUE"
2780 PLOT 31
2790 PLOT 2,98,27,242,127,27,127,4,98,4,98,27,255
2800 PLOT 15
2810 INPUT A
2820 RETURN