10 IFPAGE<&E00THEN50 20 *K.0P.'"ƒMoving down....."|L|M*T.|MF.A%=0TO(TOP-PA.)S.4:A%!&E00=A%!PA.:N.|MPA.=&E00|MO.|MDEL.10,40|MRUN|M 30 *FX138,0,128 40 END 50 *FX200,3 60 CLEAR 70 MODE7 80 RESTORE430 90 PROCSETUP 100 PROCWORK 110 IFANARD%=1THEN120:ELSE140 120 MODE1 130 PROCANARD 140 GOTO60 150 DEFPROCSETUP 160 OL%=0 170 UP%=3 180 VDU23;11;0;0;0;0; 190 VDU129,157,135,141 200 PRINTTAB(12,0)"Complex Numbers." 210 VDU129,157,135,141 220 PRINTTAB(12,1)"Complex Numbers." 230 VDU129,157,135 240 PRINTTAB(8,2)"(c) 1989 Stephen Bodman." 250 VDU28,0,23,39,3 260 VDU133,141 270 PRINTTAB(14,0)"Menu" 280 VDU133,141 290 PRINTTAB(14,1)"Menu" 300 FORA=5TO14STEP1 310 READOPT$ 320 PRINTTAB(3,A);OPT$ 330 NEXT 340 PRINTTAB(1,17)"‚Use the space to toggle the bar to " 350 PRINTTAB(4,18)"‚the option you want then hit " 360 PRINTTAB(14,19)"‚" 370 PROCDOWN(13) 380 REPEAT 390 X=INKEY(0) 400 UNTILX<>-1 410 IFX=32THENPROCDOWN(UP%) 420 IFX=13THENENDPROC:ELSE380 430 DATAFind root of a number,Add two complex numbers,Subtract two complex numbers,Multiply two complex numbers,Divide two complex numbers,Complex numbers to the power n 440 DATA Find modulus of a complex number,Find aurgument of a complex number,Draw an Anard diagram,Express in the form r(cosQ+isinQ) 450 DEFPROCDOWN(U%) 460 RESTORE430 470 IFU%=14THENU%=4 480 U%=U%+1 490 FORA=1TOU%-4 500 READOPT$ 510 NEXT 520 PRINTTAB(0,U%-1) 530 VDU129,157,135 540 PRINTTAB(3,U%);OPT$ 550 RESTORE430 560 IFOL%=14THENOL%=4 570 OL%=OL%+1 580 FORA=1TOOL%-4 590 READOPT$ 600 NEXT 610 PRINTTAB(0,OL%)" " 620 PRINTTAB(3,OL%);OPT$ 630 UP%=U% 640 OL%=U%-1 650 PRINTTAB(0,4)" " 660 PRINTTAB(12,1)CHR$(141);"…Menu " 670 ENDPROC 680 DEFPROCWORK 690 IFUP%=5THENPROCSQR 700 IFUP%=6THENPROCADD 710 IFUP%=7THENPROCTAKE 720 IFUP%=8THENPROCTIMES 730 IFUP%=9THENPROCDIVIDE 740 IFUP%=10THENPROCPOWER 750 IFUP%=11THENPROCMOD 760 IFUP%=12THENPROCARG 770 IFUP%=13ANARD%=1:ELSEANARD%=0 780 IFUP%=14THENPROCEXPRESS 790 ENDPROC 800 DEFPROCSQR 810 CLS 820 PRINTTAB(3,2)"To find the root of a number." 830 INPUTTAB(0,7)"‚Please type in a number ",N$ 840 IFRIGHT$(N$,1)="i"THEN910 850 N=VAL(N$) 860 IFN<0THEN870:ELSE940 870 N=SQR(N^2) 880 PRINT:PRINT"Root =‚";SQR(N);"i" 890 X=INKEY(1000) 900 ENDPROC 910 PRINT:PRINT"Root =ƒSorry I don't know." 920 X=INKEY(1000) 930 ENDPROC 940 PRINT:PRINT"Root =‚";SQR(N) 950 X=INKEY(1000) 960 ENDPROC 970 DEFPROCADD 980 CLS 990 PRINTTAB(3,2)"To find the sum of two complex" 1000 PRINTTAB(5,3)"numbers of the form 'a+bi'" 1010 PRINT:PRINT" (a+bi) + (c+di)" 1020 PRINT:INPUT"Value for a ",AA 1030 INPUT"Value for b ",BA 1040 PRINT:INPUT"Value for c ",AB 1050 INPUT"Value for d ",BB 1060 IFBA<0ORBB<0THEN1120 1070 IFBA<0ANDBB<0THEN1120 1080 PRINT:PRINT:PRINT"(";AA;"+";BA;"i) + (";AB;"+";BB;"i)"; 1090 PRINT;" = ";AA+AB;"+";BA+BB;"i " 1100 X=INKEY(1000) 1110 ENDPROC 1120 IFBA<0THEN1180 1130 IFBA<0ANDBB<0THEN1160 1140 PRINT:PRINT:PRINT"(";AA;"+";BA;"i) + (";AB;BB;"i)"; 1150 GOTO1190 1160 PRINT:PRINT:PRINT"(";AA;BA;"i) + (";AB;BB;"i)"; 1170 GOTO1190 1180 PRINT:PRINT:PRINT"(";AA;BA;"i) + (";AB;"+";BB;"i)"; 1190 PRINT;" = ";AA+AB; 1200 IFBA+BB<0THEN1230:ELSE1210 1210 PRINT;"+";BA+BB;"i " 1220 GOTO1100 1230 PRINT;BA+BB;"i " 1240 GOTO1100 1250 DEFPROCTAKE 1260 CLS 1270 PRINTTAB(3,2)"To find the difference of two " 1280 PRINTTAB(2,3)"complex numbers of the form 'a+bi'" 1290 PRINT:PRINT" (a+bi) - (c+di)" 1300 PRINT:INPUT"Value for a ",AA 1310 INPUT"Value for b ",BA 1320 PRINT:INPUT"Value for c ",AB 1330 INPUT"Value for d ",BB 1340 IFBA<0ORBB<0THEN1440 1350 IFBA<0ANDBB<0THEN1440 1360 IFBA-BB<0THEN1400 1370 PRINT:PRINT:PRINT"(";AA;"+";BA;"i) - (";AB;"+";BB;"i)"; 1380 PRINT;" = ";AA-AB;"+";BA-BB;"i " 1390 GOTO1420 1400 PRINT:PRINT:PRINT"(";AA;"+";BA;"i) - (";AB;"+";BB;"i)"; 1410 PRINT;" = ";AA-AB;BA-BB;"i " 1420 X=INKEY(1000) 1430 ENDPROC 1440 PRINT:PRINT:PRINT"(";AA;BA;"i) - (";AB;"+";BB;"i)"; 1450 PRINT;" = ";AA-AB; 1460 IFBA-BB<0THEN1490:ELSE1470 1470 PRINT;"+";BA-BB;"i " 1480 GOTO1420 1490 PRINT;BA-BB;"i " 1500 GOTO1420 1510 DEFPROCTIMES 1520 CLS 1530 PRINTTAB(3,2)"To find the multiple of two complex" 1540 PRINTTAB(5,3)"numbers of the form 'a+bi'" 1550 PRINT:PRINT"(a+bi) * (a+bi)" 1560 PRINT:INPUT"Value of a",A 1570 INPUT"Value of b",B 1580 PRINT:INPUT"Value of c",C 1590 INPUT"Value of d",D 1600 IFB>0ANDD>0THEN1690:ELSE1610 1610 IFB<0ANDD<0THEN1670:ELSE1620 1620 IFB<0THEN1630:ELSE1650 1630 PRINT:PRINT"(";A;B;"i) * (";C;"+";D;"i)"; 1640 GOTO1700 1650 PRINT:PRINT"(";A;"+";B;"i) * (";C;D;"i)"; 1660 GOTO1700 1670 PRINT:PRINT"(";A;B;"i) * (";C;D;"i)"; 1680 GOTO1700 1690 PRINT:PRINT"(";A;"+";B;"i) * (";C;"+";D;"i)"; 1700 PROCMULTIPLY(2,A,B,C,D) 1710 X=INKEY(1000) 1720 ENDPROC 1730 DEFPROCMULTIPLY(Q,A,B,C,D) 1740 W=A*C:X=A*D:Y=B*C:Z=B*D 1750 E=X+Y:F=W-Z 1760 IFQ=1THENENDPROC:ELSE1770 1770 IFE>0THEN1790:ELSEIFE=0THEN1810:ELSE1830 1780 IFE>0THEN1790:ELSEIFE=0THEN1810:ELSE1830 1790 PRINT;" = ";F;"+";E;"i " 1800 ENDPROC 1810 PRINT;" = ";F 1820 ENDPROC 1830 PRINT;" = ";F;E;"i " 1840 ENDPROC 1850 DEFPROCPOWER 1860 CLS 1870 PRINTTAB(3,2)"To raise a complex number to the power 'n'" 1880 PRINTTAB(6,6)"n" 1890 PRINTTAB(5,7)"i" 1900 INPUTTAB(3,9)"Value of n ",N 1910 PRINTTAB(6,12);N 1920 PRINTTAB(5,13)"i = "; 1930 IFNMOD2=0THENPRINT;"1":ELSE1950 1940 GOTO1960 1950 PRINT;"-i" 1960 X=INKEY(1000) 1970 ENDPROC 2040 DEFPROCDIVIDE 2050 CLS 2060 PRINTTAB(3,2)"To divide two complex numbers of the form 'a+bi'" 2070 PRINT" (a+bi)" 2080 PRINT" ______" 2090 PRINT" (c+di)" 2100 PRINT:INPUT"Value of a",A 2110 INPUT"Value of b",B 2120 PRINT:INPUT"Value of c",C 2130 INPUT"Value of d",D 2140 IFB<0THEN2150:ELSE2160 2150 PRINT:PRINT" ";A;B;"i":GOTO2170 2160 PRINT:PRINT" ";A;"+";B;"i" 2170 PRINT" ______ =" 2180 IFD<0THEN2190:ELSE2200 2190 PRINT" ";C;D;"i":GOTO2210 2200 PRINT" ";C;"+";D;"i" 2210 G=SQR(D^2) 2220 PROCMULTIPLY(1,A,B,C,G) 2230 H=E:I=F 2240 PROCMULTIPLY(1,C,D,C,G) 2250 J=E:K=F 2260 IFH<0THEN2310 2270 PRINTTAB(13,14);I;" ";H 2280 PRINTTAB(12,15)"____ + ____i" 2290 PRINTTAB(13,16);K;" ";K 2300 GOTO2330 2310 PRINTTAB(13,14);I;" ";H 2320 GOTO2280 2330 X=INKEY(1000) 2340 ENDPROC 2350 DEFPROCMOD 2360 CLS 2370 PRINT:PRINT"To find the moduls of a complex number of the form 'a+bi'" 2380 PRINT:INPUT"Value for a ",A 2390 INPUT"Value for b ",B 2400 IFB<0THEN2410:ELSE2420 2410 PRINT:PRINT"Moduls of ";A;B;"i = "; 2420 PRINT:PRINT" Moduls of ";A;"+";B;"i ="; 2430 MD=SQR((A^2)+(B^2)) 2440 PRINT;" ";MD 2450 X=INKEY(1000) 2460 ENDPROC 2470 DEFPROCARG 2480 CLS 2490 PRINT" To find the argument of a complex number of the form 'a+bi'" 2500 PRINT:INPUT"Value for a ",A 2510 INPUT"Value for b ",B 2520 IFA>0THENPROCPOSITIVE:ELSEPROCNEGATIVE 2530 IFB>0THEN2540:ELSE2560 2540 PRINT:PRINT" arg(";A;"+";B;"i) = ";ARG;" rads" 2550 GOTO2570 2560 PRINT:PRINT" arg(";A;B;"i) = ";ARG;" rads" 2570 X=INKEY(1000) 2580 ENDPROC 2590 DEFPROCPOSITIVE 2600 ARG=ATN(B/A) 2610 IFB<0THEN2620:ELSEENDPROC 2620 ARG=-ARG 2630 ENDPROC 2640 DEFPROCNEGATIVE 2650 IFB>0THENR=-B:ELSER=B 2660 ARG=PI-(ATN(R/A)) 2670 IFB<0THEN2680:ELSEENDPROC 2680 ARG=-ARG 2690 ENDPROC 2700 MODE1 2710 DEFPROCANARD 2720 CLS 2730 COLOUR1 2740 PRINTTAB(0,0)"Complex Numbers (c) 1989 Stephen Bodman" 2750 COLOUR2 2760 PRINTTAB(2,2)"To draw an anard diagram for a complex number of the form 'a+bi'." 2770 INPUTTAB(2,6)"Value of a",A 2780 INPUTTAB(2,7)"Value of b",B 2790 IFB>0THEN2800ELSE2820 2800 PRINT:PRINT"(";A;"+";B;"i)" 2810 GOTO2830 2820 PRINT:PRINT"(";A;B;"i)" 2830 PROCSCALE 2840 VDU29,800;500; 2850 MOVE0,250 2860 DRAW0,-250 2870 MOVE250,0 2880 DRAW-250,0 2890 MOVE0,0 2900 DRAWX%,Y% 2910 PRINTTAB(0,28)"Hit a key to return to menu." 2920 A$=GET$ 2930 ENDPROC 2940 DEFPROCSCALE 2950 C=SQR(A^2):D=SQR(B^2) 2960 IFC>DTHENPROCC:ELSEPROCD 2970 ENDPROC 2980 DEFPROCC 2990 IFA<0THENX%=-200:ELSEX%=200 3000 Y%=B*(200/C) 3010 ENDPROC 3020 DEFPROCD 3030 IFB<0THENY%=-200:ELSEY%=200 3040 X%=A*(200/D) 3050 ENDPROC 3060 DEFPROCEXPRESS 3070 CLS 3080 PRINT" Express a+bi in the form r(cosQ+isinQ)" 3090 PRINT:INPUT"Value for a ",A 3100 INPUT"Value for b ",B 3110 S=SQR((A^2)+(B^2)) 3120 IFA>0THENPROCPOSITIVE:ELSEPROCNEGATIVE 3130 IFB<0THEN3170 3140 PRINTA;"+";B;"i =":PRINT:PRINT" ";S;"(cos";ARG;"+isin";ARG;") " 3150 X=INKEY(5000) 3160 ENDPROC 3170 PRINTA;B;"i =":PRINT:PRINT" ";S;"(cos";ARG;"+isin";ARG;") " 3180 GOTO 3150