home *** CD-ROM | disk | FTP | other *** search
- 3000 ' tutor 9
- 3010 GOSUB 37100
- 3020 T5$ = SPACE$(5) : T10$ = SPACE$(10) : T15$ = SPACE$(15) :VT$ = CHR$(11)
- 3040 PRINT FNCENTER$("Welcome to Lesson 9.");CRLF$
- 3050 PRINT T10$;" This lesson will cover 'functions.' -- What are functions?"
- 3060 PRINT T10$;"Well we have used one in a previous lesson ...";CRLF$
- 3070 PRINT T10$;" As an example: 'SQR' always means 'find the square root'. We"
- 3080 PRINT T10$;"refer to such an operation as a 'function'."
- 3090 PRINT
- 3100 PRINT T10$;" There are many 'standard' or predefined functions, which have a"
- 3110 PRINT T10$;"set meaning. 'SQR' is one; 'LOG' is another. This one refers to"
- 3120 PRINT T10$;"numbers found in a table of logarithms."
- 3130 PRINT T10$;"Here are some examples of functions:";CRLF$
- 3140 PRINT T10$;" (1) TAN (2) TRA (3) ADV (4) ABS"
- 3150 PRINT T10$;" (5) COS (6) PAC (7) MON (8) SIN"
- 3160 PRINT
- 3170 PRINT T10$;" Four of them are standard functions; four are not. Please"
- 3180 PRINT T10$;"select one that is a function: ";
- 3190 GOSUB 40900 : A$ = CVTSTR$
- 3200 PRINT
- 3210 IF A$ = "1" OR (LEN(A$) > 1 AND LEFT$(A$,2) = "TA") THEN 3270
- 3220 IF A$ = "4" OR (LEN(A$) > 1 AND LEFT$(A$,2) = "AB") THEN 3270
- 3230 IF A$ = "5" OR (LEN(A$) > 1 AND LEFT$(A$,2) = "CO") THEN 3270
- 3240 IF A$ = "8" OR (LEN(A$) > 1 AND LEFT$(A$,2) = "SI")THEN 3270
- 3250 PRINT T10$;"You didn't pick one of them that time. Try once more.";
- vt$;VT$;CR$;
- 3260 GOTO 3180
- 3270 GOSUB 37100
- 3280 PRINT T10$;" (1) TAN (2) TRA (3) ADV (4) ABS"
- 3290 PRINT T10$;" (5) COS (6) PAC (7) MON (8) SIN"
- 3300 PRINT
- 3310 PRINT T10$;" That is one of them. Three are trigonometric functions: 'TAN'"
- 3320 PRINT T10$;"means 'tangent', 'SIN' means 'sine', and 'COS' means 'cosine'."
- 3330 PRINT T10$;"one ('ABS') means to use the positive value for whatever is"
- 3340 PRINT T10$;"being considered. This is the 'absolute value' - often required."
- 3350 PRINT
- 3360 PRINT T10$;" Each function is followed by an expression in parentheses, known"
- 3370 PRINT T10$;"as the 'argument'; it is what the function operates on. Example:"
- 3380 PRINT T10$;"'ABS(Y)' means 'Y' is to be made positive regardless of sign, or"
- 3390 PRINT T10$;"its 'absolute value' is to be used. Here 'Y' is the argument."
- 3400 GOSUB 37000 : GOSUB 37100
- 3410 PRINT T10$;" We have mentioned 4 standard functions; basic has others"
- 3420 PRINT T10$;"available to the user, among which are:"
- 3430 PRINT
- 3440 PRINT T10$;" (1) ATN(U) (2) EXP(U) (3) INT(U) (4) RND(U)"
- 3450 PRINT T10$;" (5) FIX(U) (6) FRE(U) (7) SGN(U) (8) RND"
- 3460 PRINT
- 3470 PRINT T10$;" Here the 'U' simply represents the argument. One of the above is"
- 3480 PRINT T10$;"for taking only the whole number part of a decimal number. Which"
- 3490 PRINT T10$;"do you think this one might be? ";
- 3500 GOSUB 40900 : W$ = CVTSTR$
- 3510 PRINT
- 3520 IF W$ = "3" OR (LEN(W$) > 1 AND LEFT$(W$,2)= "IN") OR
- W$ = "5" OR (LEN(W$) > 1 AND LEFT$(W$,2) = "FI") THEN 3550
- 3530 PRINT T10$;" No, it could be 'INT' or 'FIX'. 'INT' stands for 'integer'"
- 3540 GOTO 3560
- 3550 PRINT T10$;"That's right! It could be 'INT' or 'FIX'. 'INT' stands for 'integer'"
- 3560 PRINT T10$;"which returns the largest integer in U. 'FIX' returns the integer"
- 3570 PRINT T10$;"part of U only. For example:"
- 3580 PRINT T10$;" INT(-2.7) = -3"
- 3590 PRINT T10$;" FIX(-2.7) = -2"
- 3600 PRINT T10$;" INT(34.8) = 34"
- 3610 GOSUB 37000
- 3620 PRINT FNPOSCUR$(12,1);EES$;
- 3630 PRINT vt$;ELR$;T10$;" Which do you suppose is used to generate random numbers? ";
- 3640 GOSUB 40900 : R$ = CVTSTR$
- 3650 PRINT
- 3660 IF R$ = "4" OR R$ = "8" OR (LEN(R$) > 1 AND LEFT$(R$,2) = "RN") THEN 3690
- 3670 PRINT T10$;" You need another guess. LOOK at the letter combinations.";
- VT$;CR$;
- 3680 GOTO 3630
- 3690 PRINT T10$;" Good! Also, 'ATN' means 'arctangent', a trigonometric function,"
- 3700 PRINT T10$;"and 'EXP' means 'exponential', which is the antilog function."
- 3710 PRINT T10$;"If you use a trigonometric function, please note: they involve"
- 3720 PRINT T10$;"RADIANS, not degrees. Also, the 'LOG' function is based on"
- 3730 PRINT T10$;"natural logarithms. The 'SGN' function returns the integer 1"
- 3740 PRINT T10$;"preceeded by the sign of the argument. For example:"
- 3750 PRINT : PRINT T15$;" SGN(-4.2) = -1" : PRINT T15$;" SGN(273.51) = 1" : PRINT
- 3760 GOSUB 37000 : PRINT FNPOSCUR$(10,1);EES$;
- 3770 PRINT T10$;" Note that 'RND' is equivalent to 'RND(U)' -- U > 0; each"
- 3780 PRINT T10$;"returns a new random number. 'RND(U)' -- U < 0 seeds a new sequence."
- 3790 PRINT T10$;"'RND(U)' -- U = 0 returns the previously generated number."
- 3800 GOSUB 37000 : GOSUB 37100
- 3810 PRINT T10$;" TUTR.11 provides more discussion about standard and"
- 3820 PRINT T10$;"'trig' functions. TUTR.12 concerns non-standard functions."
- 3830 PRINT : PRINT FNCENTER$("press any key for menu");
- 3840 FOR CT = 1 TO 22 : PRINT CHR$(8); : NEXT CT : GOSUB 40800
- 3850 GOTO 39999
-
- 37000 'press any key pause
- 37010 PRINT T10$;CRLF$;CRLF$;FNCENTER$("press any key to continue");
- 37020 FOR CT= 1 TO 25 : PRINT CHR$(8); : NEXT CT
- 37030 GOSUB 40800
- 37099 RETURN
-
- 37100 ' heading
- 37110 PRINT CLS$;FNPOSCUR$(4,1);FNCENTER$("Tutor -- Lesson 9");CRLF$
- 37199 RETURN
-
- 38000 ' converted for Non-linear Systems, Kaypro Educational Division
- 38010 ' by t.crew , Simple Software, San Diego CA
- 38020 ' has to be run with mentutr to get all variables
- 38030 ' tutor lesson 9 version 2.0 released to nls 1 aug 83
-
- 39999 RUN "MENU" 'end of overlay
-