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