Curve Sketching (continued)

See all articles from ZX-Appeal Mar 90
Author(s): Alvin Albrecht
Publication: ZX-Appeal
Pub Details: ZX-Appeal Mar 90
Date: March 1990
Pages: 16-18
 700 PRINT #0;AT 0,0,,,,: INPUT "Enter New Domain: +/-";d
710 LET xscale=d/127: GO TO 415
727 REM
728 REM Enter New Lstart
729 REM
730 PRINT #0;AT 0,0,,,,: INPUT AT 0,0;"Enter New Lstart (-127 to 127): ";lstart
735 IF ABS lstart>127 THEN GO TO 730
740 GO TO 415
747 REM
748 REM Enter New Range
749 REM
750 PRINT #0;AT 0,0,,,,: INPUT "Enter New Range: +/-";d
755 LET yscale=d/87: GO TO 415
797 REM
798 REM Enter New Step
799 REM
800 PRINT #0;AT 0,0,,,,: INPUT "Enter New Step: ";z: GO TO 415
847 REM
848 REM Enter New Function
849 REM
850 PRINT #0;AT 0,0,,,,: INPUT AT 0,0;"f(x)="; LINE a$: GO TO 415
867 REM
868 REM Values
869 REM
870 PRINT #0;AT 0,0,,"COORDS OF POINT. Use 56780 CAPS"
872 LET x=0: LET y=0
875 PLOT OVER 1;x+127,y+87: PAUSE 2: PRINT #0;AT 0,0;"(x,y)=(";FN r(x*xscale);",";FN r(y*yscale);") ",: PLOT OVER 1;x+127,y+87
880 LET g$=INKEY$: GO TO 875-450*(g$="0")+10*(g$>="5" AND g$<="8")+25*(g$>=CHR$ 8 AND g$<=CHR$ 11)
885 LET x=x-(g$="5")+(g$="8"): LET y=y-(g$="6")+(g$="7")
890 IF ABS x>127 THEN LET x=-SGN x*127
892 IF ABS y>87 THEN LET y=-SGN y*87
895 GO TO 875
900 LET x=x-8*(g$=CHR$ 8)+8*(g$=CHR$ 9): LET y=y-8*(g$=CHR$ 10)+8*(g$=CHR$ 11): GO TO 890
947 REM
948 REM Clear Graph
949 REM
950 GO SUB 500: GO TO 425
967 REM
968 REM Graph Function
969 REM
970 GO SUB 100: GO TO 425
997 REM
998 REM Instructions
999 REM
1000 CLS : PRINT TAB 8;"CURVE SKETCHING"''TAB 4;"December 1989 Albrecht"''
1005 PRINT "  This program sketches any     function entered by the user    on a scaled cartesian coordinateplane."'
1010 PRINT '" To sketch a curve, first choose the option for changing the function from the menu. Thenenter the function as a functionof x. EG to enter the function f(x)=x^2-50, enter x*x-50."
1015 PRINT '"NOTE: enter all powers of x as x's multiplied by them- elves as in x^3=x*x*x. The TS2068 will not other- wise raise negative num- bers to any power."
1017 GO SUB 460
1020 CLS : PRINT " You can enter any function using the math operations,avail-able from TS2068 basic."''
1025 PRINT " Next set up your coordinate scale. This is done by choosing the change domain and range options from the menu. The com- puter will ask for a domain (range) for the values of x (y) to float over. EG-choosing a domain of +/-50 wil l set the left extreme of the x-axis,as -50 and the right at 50."''
1030 PRINT " The final parameter that can be manipulated is the step. The step is how many pixels skipped horizontally before a pixel is plotted on the graph, EG- If thestep is 1, then a point on the graph is calculated and plotted "
1035 GO SUB 460
1040 CLS : PRINT "at every pixel on the screen. Ifthe step is 10 then a point is plotted every ten pixels on the screen. The TS2068 will fill inany gaps in the graph."''
1045 PRINT " The smaller the step the more accurate the graph is. The lar- ger the step the less accurate the graph is. What is the pur- pose of the step? For complic- ated functions the graphing may take a long time, so by choosinga large step, the g rphing will be done quicker (at the expense of accuracy as noted above)."''
1047 PRINT " Lstart determines where the computer will begin calculating the graph. It ranges in value from -127 (left edge of screen) to 127 (right edge of screen). This may be useful in speeding up the graphing of functions restricted to posit ive numbers. (EG- f(x)=LN x) To graph only +ve numbers, set lstart-0."
1050 GO SUB 460
1055 CLS : PRINT " A neat feature of this func- tion grapher is that after everygraphing, the program does not clear the screen. This makes it possible to superimpose several graphs of different functions bychanging the function via the menu. You can also superimpose graphs of functions on differentscales - although there,may not be any point in that."''
1060 PRINT " OPTIONS FROM THE MENU:"''"See Parameters: See current Domain, Range, Step, Function Clear Screen: Clears the Graph Graph Function Coords: Move a point around on the graph and the computer will give the coordin ates": GO SUB 460
1065 CLS : PRINT " *** AUGMENTED NOTE:"''" If the program encounters any errors in calculation-eg x/0 then the program will beep and continue plotting."''" You may press break at any time followed by the press of a key to abort graphing."
1067 PRINT ''" PRESS A KEY FOR PROGRAM"
1070 GO SUB 460: RETURN
1     : 95   : 7014
2     : 21   : 1380
3     : 39   : 3691
5     : 19   : 2582
10    : 70   : 7225
15    : 22   : 2571
20    : 17   : 1810
98    : 2    : 481
99    : 12   : 1914
100   : 2    : 481
101   : 12   : 1258
102   : 86   : 6931
105   : 32   : 4588
106   : 22   : 2886
107   : 12   : 1882
110   : 47   : 3411
112   : 7    : 1157
115   : 33   : 3813
119   : 2    : 481
120   : 16   : 2300
121   : 2    : 481
125   : 53   : 8752
130   : 11   : 915
149   : 2    : 481
150   : 12   : 1820
151   : 2    : 481
155   : 41   : 6419
157   : 65   : 8802
160   : 100  : 13997
179   : 2    : 481
180   : 10   : 1756
181   : 2    : 481
185   : 21   : 3732
190   : 5    : 769
249   : 2    : 481
250   : 113  : 13390
251   : 2    : 481
255   : 108  : 9965
257   : 34   : 3122
260   : 58   : 5440
265   : 43   : 3598
270   : 23   : 2780
399   : 2    : 481
400   : 6    : 1104
401   : 2    : 481
405   : 74   : 5653
410   : 64   : 4311
415   : 70   : 7750
417   : 140  : 8756
425   : 70   : 7170
427   : 103  : 6561
449   : 2    : 481
450   : 14   : 2263
451   : 2    : 481
455   : 30   : 1579
460   : 17   : 2313
465   : 24   : 3298
470   : 2    : 521
499   : 2    : 481
500   : 39   : 4282
501   : 2    : 481
505   : 77   : 4997
510   : 126  : 12154
515   : 2    : 521
598   : 2    : 481
599   : 17   : 2738
600   : 2    : 481
605   : 136  : 11540
610   : 36   : 3418
612   : 177  : 15839
615   : 36   : 3438
620   : 46   : 3236
625   : 36   : 3459
630   : 11   : 868
697   : 2    : 481
698   : 18   : 2647
699   : 2    : 481
700   : 58   : 4774
710   : 31   : 3217
727   : 2    : 481
728   : 18   : 2691
729   : 2    : 481
730   : 95   : 7457
735   : 30   : 3540
740   : 11   : 890
747   : 2    : 481
748   : 17   : 2435
749   : 2    : 481
750   : 57   : 4554
755   : 30   : 2983
797   : 2    : 481
798   : 16   : 2369
799   : 2    : 481
800   : 64   : 5205
847   : 2    : 481
848   : 20   : 2998
849   : 2    : 481
850   : 72   : 4820
867   : 2    : 481
868   : 8    : 1434
869   : 2    : 481
870   : 66   : 4717
872   : 22   : 1583
875   : 151  : 11789
880   : 97   : 8055
885   : 46   : 4443
890   : 31   : 3454
892   : 29   : 3095
895   : 11   : 858
900   : 111  : 7051
947   : 2    : 481
948   : 13   : 1974
949   : 2    : 481
950   : 22   : 1923
967   : 2    : 481
968   : 16   : 2538
969   : 2    : 481
970   : 22   : 1773
997   : 2    : 481
998   : 14   : 2467
999   : 2    : 481
1000  : 72   : 6798
1005  : 107  : 14460
1010  : 191  : 24668
1015  : 189  : 21282
1017  : 11   : 942
1020  : 95   : 12998
1025  : 318  : 40213
1030  : 228  : 31126
1035  : 11   : 942
1040  : 158  : 21459
1045  : 322  : 43627
1047  : 318  : 41556
1050  : 11   : 942
1055  : 349  : 48985
1060  : 262  : 31625
1065  : 237  : 30790
1067  : 31   : 3318
1070  : 13   : 1312

The printed line-length table gives more bytes than show in print for lines 1, 405, 605, 730, 870 and 1000, probably invisible colour or control codes.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.