forked from id2359/classlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclasslib0.htm
1057 lines (1056 loc) · 102 KB
/
classlib0.htm
1
2
3
4
5
6
7
8
<html><head><title>CLASSLIB > classlib0.atf</title></head>
<body>
<h3><a href="">CLASSLIB</a> > classlib0.atf</h3>
<pre>0001 [XNPP 0 10 ]0002 [XNIO 0 1 ]0003 [XNCT 0 1E∊13 ]0004 [XCFC 1 6 .,*0_∊ ]0005 [XNRL 0 16807 ]0006 [XCPR 1 1 ]0007 [XCLX 1 0 ]0008 [<b style="color:green">∇ </b>ZXDIFF FX 'C←A ZXDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS OF ]0009 [XINTEGER' '⍝ POLYNOMIALS.' 'C←A ZXSUM-B' ]0010 [<b style="color:green">∇ </b>ZXEVAL FX 'Y←A ZXEVAL B;IO' '⍝ EVALUATES THE INTEGER POLYNOMIALS IN ]0011 [ A AT B.' 'IO←0' 'DERR∧/(,A=≤A),,B=≤B' 'B←((∆B),1)∆B' 'EXPANDV' 'B←(]0012 [X∊1Ç∆B)∆B' 'Y←+/AõBø.*⌈∊1×∆A' ]0013 [<b style="color:green">∇ </b>ZXFCLEAR FX 'ZXFCLEAR;I' '⍝ EXPUNGES THE VARIABLE ZXRT DESCRIBING THE]0014 [X CURRENT' '⍝ QUOTIENT ALGEBRA OF Z[X].' 'I←EX ''ZXRT''' ]0015 [<b style="color:green">∇ </b>ZXFDIFF FX 'C←A ZXFDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS I]0016 [XN THE' '⍝ CURRENT QUOTIENT ALGEBRA OF Z[X].' 'C←A ZXFSUM-B' ]0017 [<b style="color:green">∇ </b>ZXFSUM FX 'C←A ZXFSUM B;D;E' '⍝ COMPUTES THE SUM OF TWO ARRAYS OVER T]0018 [ HE CURRENT' '⍝ QUOTIENT ALGEBRA OF Z[X].' 'D←∊1×∆C←A ZXSUM B' 'DERR Dó+]0019 [ /∆ZXRT' '¸(DóE←∊1×∆ZXRT)/0' 'C←(((∊1Ç∆C),E)×C)+(((-∆∆C)×E)ÇC)+.õ((D-E),]0020 [XE)×ZXRT' 'D←1©+/∧\∨∧ð((õ/∊1Ç∆C),E)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0021 [<b style="color:green">∇ </b>ZXFINIT FX 'ZXFINIT F;IO;D;I' '⍝ INITIALIZES THE CURRENT QUOTIENT AL]0022 [ GEBRA OF Z[X].' 'IO←0' 'DERR∧/(1=∆∆F),,F=≤F' 'DERR 1óD←∊1++/∧\∨0≠F' 'D]0023 [ ERR 1=|F[D]' 'ZXRT←((D-1),D)∆-F←F[D]õD×F' 'I←0' 'LOOP:¸((D-1)óI←I+1)/0']0024 [X 'ZXRT[I;]←(0,∊1ÇZXRT[I-1;])-FõZXRT[I-1;D-1]' '¸LOOP' ]0025 [<b style="color:green">∇ </b>ZXFPOWER FX 'C←A ZXFPOWER B;R;RHO;I;J;M;N;D' '⍝ COMPUTES THE B-TH POW]0026 [ ER OF A IN THE CURRENT' '⍝ QUOTIENT OF R[X].' 'B←((∆B),1)∆B' 'EXPAND]0027 [ V' 'N←∊1×∆ZXRT' 'R←õ/RHO←∊1Ç∆A' 'A←(R,M←∊1×∆A)∆A' 'C←(R,N)∆N×1' 'I←(B>0]0028 [ )/⌈∆B←,B' 'LOOP:C[J;]←((∆J),N)×C[J;]ZXFPROD A[J←(2|B[I])/I;]' '¸(0=∆I←(]0029 [ B[I]⎕2)/I)/END' 'A[I;]←A[I;]ZXFPROD A[I;]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:]0030 [XD←1©©/,+/∧\∨0≠C' 'C←(RHO,D)∆(R,D)×C' ]0031 [<b style="color:green">∇ </b>ZXFPROD FX 'C←A ZXFPROD B;D;E' '⍝ COMPUTE THE PRODUCT OF TWO ARRAYS O]0032 [ VER THE' '⍝ CURRENT QUOTIENT ALGEBRA OF Z[X].' 'C←A ZXPROD B' 'DERR(D←∊]0033 [ 1×∆C)ó+/∆ZXRT' '¸(DóE←∊1×∆ZXRT)/0' 'C←(((∊1Ç∆C),E)×C)+(((-∆∆C)×E)ÇC)+.õ]0034 [X((D-E),E)×ZXRT' 'D←1©+/∧\∨∧ð((õ/∊1Ç∆C),E)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0035 [<b style="color:green">∇ </b>ZXINTERP FX 'C←A ZXINTERP B;IO;L;RHO;RC;G;I;M;N;NOTEST;D' '⍝ INTERPO]0036 [ LATES INTEGER POLYNOMIALS. THE VECTOR A' '⍝ GIVES THE INTEGER VALUES ]0037 [ OF THE ARGUMENT AND THE' '⍝ VECTORS ALONG THE LAST AXIS OF B GIVE THE]0038 [ INTEGER' '⍝ VALUES WHICH THE POLYNOMIALS ARE TO HAVE.' 'IO←1' 'DERR∧/]0039 [ (1=∆∆A),(0<∆A),(A=≤A),(,B=≤B),(0<∆∆B),(1×∆A)=∊1×∆B' 'RC←õ/RHO←∊1Ç∆B' 'B]0040 [ ←(RC,L←∆A)∆B' 'C←(RC,1)∆B[;1]' 'G←(-A[1]),1' 'NOTEST←I←1' 'LOOP:¸(L<I←I]0041 [ +1)/END' 'M←(RC,1)∆B[;I]-C ZXEVAL RC∆A[I]' 'N←G ZXEVAL A[I]' 'DERR∧/,0=]0042 [ N|M' 'C←C ZXSUM((RC,∆G)∆G)ZXPROD≤MöN' 'G←G ZXPROD(-A[I]),1' '¸LOOP' 'EN]0043 [XD:C←(RHO,∊1×∆C)∆C' 'D←1©©/,+/∧\∨C≠0' 'C←(RHO,D)×C' ]0044 [<b style="color:green">∇ </b>ZXLEAD FX 'C←ZXLEAD A;EPSILON' '⍝ COMPUTES THE LEADING COEFFICIENTS O]0045 [XF AN ARRAY OF' '⍝ INTEGER POLYNOMIALS.' 'EPSILON←0' 'C←RXLEAD A' ]0046 [<b style="color:green">∇ </b>ZXMATPROD FX 'C←A ZXMATPROD B;IO;X;AX;BX;RR;RA;RB;NOTEST' '⍝ COMPUTE]0047 [ S THE MATRIX PRODUCT OF TWO NONSCALAR ARRAYS' '⍝ OF INTEGER POLYNOMIALS]0048 [ .' 'IO←1' 'DERR∧/(1ó(∆∆A),∆∆B),(∆A)[∊1+∆∆A]=1×∆B' 'C←((RA←∊2Ç∆A),(RB←∊]0049 [ 1Ç1Ç∆B),1)∆0' 'X←1=⌈1×∆B' 'RR←((∆RA)+⌈∆RB),(⌈∆RA),∆∆C' 'NOTEST←1' 'LOOP]0050 [ :AX←RRí(RB,RA,∊1×∆A)∆X/[∊1+∆∆A]A' 'BX←((∊1Ç∆C),∊1×∆B)∆XðB' 'C←C ZXSUM A]0051 [XX ZXPROD BX' '¸(~1×X←∊1∨X)/LOOP' ]0052 [ NBIGINV 1 50 1 416347 564385 754637 356251 555937 372722 692421 694764 ]0053 [ 358869 388076 902744 505494 949639 545488 755533 561217 833761 904084 2]0054 [ 81090 340130 572038 313620 160778 656143 776323 771968 467359 775981 11]0055 [ 363 825431 856786 127780 714724 454910 63491 235199 920209 538488 95310]0056 [X4 920088 275987 518335 283952 925450 345471 132911 687127 124557 441543]0057 [ NBIGPRIMES 1 50 999221 999233 999239 999269 999287 999307 999329 999331]0058 [ 999359 999371 999377 999389 999431 999433 999437 999451 999491 999499 ]0059 [ 999521 999529 999541 999553 999563 999599 999611 999613 999623 999631 9]0060 [ 99653 999667 999671 999683 999721 999727 999749 999763 999769 999773 99]0061 [ 9809 999853 999863 999883 999907 999917 999931 999953 999959 999961 999]0062 [X979 999983 ]0063 [<b style="color:green">∇ </b>CCONJ FX 'B←CCONJ A' '⍝ COMPUTES THE CONJUGATE OF A COMPLEX ARRAY.' ']0064 [X¸NOTEST/BEGIN' 'A←CNRMLZ A' 'BEGIN:B←Aõ(∆A)∆1 ∊1' ]0065 [<b style="color:green">∇ </b>CNRMLZ FX 'B←CNRMLZ A' '⍝ COMPUTES THE STANDARD FORM FOR AN ARRAY OF']0066 [ '⍝ COMPLEX NUMBERS.' '¸NOTEST/BEGIN' 'DERR(0=∆∆A)∧(∊1×∆A)î1 2' 'BEGIN:]0067 [XB←((∊1Ç∆A),2)×A' ]0068 [<b style="color:green">∇ </b>CDIFF FX 'C←A CDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO COMPLEX ARRA]0069 [XYS.' 'C←A CSUM-B' ]0070 [<b style="color:green">∇ </b>CSUM FX 'C←A CSUM B' '⍝ COMPUTES THE SUM OF TWO COMPLEX ARRAYS.' '¸NO]0071 [ TEST/BEGIN' 'A←CNRMLZ A' 'B←CNRMLZ B' 'EXPANDV' 'BEGIN:C←Cõ(|C)⎕EPSILON]0072 [Xõ©/,|C←A+B' ]0073 [<b style="color:green">∇ </b>CINV FX 'B←CINV A' '⍝ COMPUTES THE RECIPROCAL OF A COMPLEX ARRAY.' 'B]0074 [X←1 0 CQUOT A' ]0075 [<b style="color:green">∇ </b>CQUOT FX 'C←A CQUOT B;N;R' '⍝ COMPUTES THE QUOTIENT OF TWO COMPLEX AR]0076 [ RAYS.' '¸NOTEST/BEGIN' 'A←CNRMLZ A' 'B←CNRMLZ B' 'EXPANDV' 'BEGIN:DERR∧]0077 [ /,0≠N←(R←(∊1Ç∆B),1)∆+/BõB' 'C←((R∆+/AõB)öN),(R∆-/Bõ∨A)öN' 'C←Cõ(|C)⎕EPS]0078 [XILONõ©/,|C' ]0079 [<b style="color:green">∇ </b>CMAG FX 'B←CMAG A' '⍝ COMPUTES THE MAGNITUDE OF A COMPLEX ARRAY.' 'B←]0080 [X(CNORM A)*0.5' ]0081 [<b style="color:green">∇ </b>CNORM FX 'B←CNORM A' '⍝ COMPUTES THE COMPLEX NORM OF A.' '¸NOTEST/BE]0082 [XGIN' 'A←CNRMLZ A' 'BEGIN:B←+/AõA' ]0083 [<b style="color:green">∇ </b>CMATPROD FX 'C←A CMATPROD B;IO;X;AX;BX;RR;NOTEST;RA;RB' '⍝ COMPUTES ]0084 [ THE MATRIX PRODUCT OF TWO NONSCALAR ARRAYS' '⍝ OF COMPLEX NUMBERS.' 'NO]0085 [ TEST←0' 'IO←1' 'A←CNRMLZ A' 'B←CNRMLZ B' 'DERR(∧/1<(∆∆A),∆∆B)∧(∆A)[∊1+]0086 [ ∆∆A]=1×∆B' 'C←((RA←∊2Ç∆A),(RB←∊1Ç1Ç∆B),2)∆0' 'NOTEST←1' 'X←1=⌈1×∆B' 'RR]0087 [ ←((∆RA)+⌈∆RB),(⌈∆RA),∆∆C' 'LOOP:AX←RRí(RB,RA,2)∆X/[∊1+∆∆A]A' 'C←C CSUM ]0088 [XAX CPROD(∆C)∆XðB' '¸(~1×X←∊1∨X)/LOOP' ]0089 [<b style="color:green">∇ </b>CPROD FX 'C←A CPROD B;R' '⍝ COMPUTES THE PRODUCT OF TWO COMPLEX ARRAY]0090 [ S.' '¸NOTEST/BEGIN' 'A←CNRMLZ A' 'B←CNRMLZ B' 'EXPANDV' 'BEGIN:C←(R∆-/A]0091 [XõB),(R←(∊1Ç∆A),1)∆+/Aõ∨B' 'C←Cõ(|C)⎕EPSILONõ©/,|C' ]0092 [<b style="color:green">∇ </b>CPOWER FX 'C←A CPOWER B;RHO;RC;I;J;NOTEST' '⍝ COMPUTES THE B-TH POWER]0093 [ OF THE COMPLEX' '⍝ ARRAY A USING THE BINARY POWER ALGORITHM.' 'NOTES]0094 [ T←0' 'A←CNRMLZ A' 'DERR∧/(,B=≤B),,B⎕0' 'B←((∆B),1)∆B' 'EXPANDV' 'NOTEST]0095 [ ←1' 'RC←(õ/∊1ÇRHO←∆A),2' 'A←RC∆A' 'C←RC∆1 0' 'I←(B>0)/⌈∆B←,B' 'LOOP:C[J]0096 [ ;]←C[J;]CPROD A[J←(2|B[I])/I;]' '¸(0=∆I←(B[I]⎕2)/I)/END' 'A[I;]←A[I;]CP]0097 [XROD A[I;]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:C←RHO∆C' ]0098 [<b style="color:green">∇ </b>CPRODRED FX 'C←CPRODRED A;IO;RHO;D;E;CC;L;NOTEST' '⍝ COMPUTES THE PR]0099 [ ODUCT REDUCTION ALONG THE LAST' '⍝ AXIS OF AN ARRAY OF COMPLEX NUMBERS.]0100 [ ' 'NOTEST←0' 'A←CNRMLZ A' '¸(1=∆∆C←A)/0' 'IO←1' 'L←õ/RHO←∊2Ç∆C' 'C←(L,]0101 [ ∊2×∆C)∆C' '¸(0=(∆C)[2])/ZERO' 'NOTEST←1' 'LOOP:¸(1=D←(∆C)[2])/ONE' 'CC←]0102 [ ((L,E,2)×C)CPROD(L,(-E←≤Dö2),2)×C' 'C←CC,[2]C[;(E+1)õ⌈D≠2õE;]' '¸LOOP' ]0103 [X'ZERO:C←(RHO,2)∆1 0' '¸0' 'ONE:C←(RHO,2)∆C' ]0104 [<b style="color:green">∇ </b>DERR FX 'DERR T' '⍝ IF T IS FALSE, A MESSAGE IS PRINTED AND ALL ACT]0105 [ IVE' '⍝ PROCEDURES ARE TERMINATED.' '¸T/0' '''PROCEDURE DOMAIN ERROR''']0106 [X '¸' ]0107 [<b style="color:green">∇ </b>DAQ FX 'X←DAQ A;NA;RA;M;K;R' '⍝ PRODUCES THE CHARACTER ARRAY FOR DISP]0108 [ LAYING AN' '⍝ ARRAY OF RATIONAL NUMBERS.' 'X←''''' '¸(0=NA←õ/∆A)/0' 'RA]0109 [ ←∆A←QNRMLZ A' 'M←1©∊1Ç∊2×RA' 'K←∊1×∆X←®(NA,1)∆A' 'R←(∊1++/X='' '')õNA∆0]0110 [ 1' 'X←R∨X' 'X←((õ/∊1ÇRA),2õK)∆X' 'X[;K+IO]←''/''' 'X←X,'' ''' 'X←((∊2]0111 [XÇRA),Mõ∊1×∆X)∆X' ]0112 [<b style="color:green">∇ </b>DARV FX 'X←P DARV A;NA;RA;M;K' '⍝ PRODUCES THE CHARACTER ARRAY DISPLA]0113 [ YING AN ARRAY' '⍝ OF REAL VECTORS WITH P DECIMAL PLACES.' 'X←''''' '¸(0]0114 [ =NA←õ/RA←∆A)/0' 'M←1©∊1Ç∊2×RA' 'K←∊1×∆X←P®(NA,1)∆A' 'X←((õ/∊1ÇRA),Kõ∊1×]0115 [XRA)∆X' 'X←(0 2+∆X)×X' 'X←((∊2ÇRA),Mõ∊1×∆X)∆X' ]0116 [<b style="color:green">∇ </b>DAZV FX 'X←DAZV A' '⍝ PRODUCES THE CHARACTER ARRAY DISPLAYING AN ARRA]0117 [ Y' '⍝ OF INTEGER VECTORS OR REAL VECTORS ROUNDED TO THE' '⍝ NEAREST INT]0118 [XEGER.' 'X←''''' '¸(0=õ/∆A)/0' 'X←0 DARV A' ]0119 [XNEPSILON 0 1E∊13 ]0120 [<b style="color:green">∇ </b>EXPANDV FX 'EXPANDV;RA;NA;RB;NB' '⍝ TESTS IF TWO ARRAYS OF VECTORS AR]0121 [ E CONFORMABLE FOR' '⍝ SCALAR OPERATIONS AND IF SO, EXPANDS ONE, IF' '⍝ ]0122 [ NECESSARY, SO THAT THEY HAVE THE SAME SHAPE ALONG ALL' '⍝ BUT THE LAST ]0123 [ AXIS. IF THEY ARE NOT CONFORMABLE, ALL' '⍝ PROCESSING IS STOPPED.' '⍝ ]0124 [ SCALARS ARE REPLACED BY VECTORS OF LENGTH 1.' '¸(1ó∆∆A)/CHECKB' 'A←,A' ]0125 [ 'CHECKB:¸(1ó∆∆B)/NEXT' 'B←,B' '⍝ IF A OR B HAS ONE ENTRY, THE ARE C]0126 [ ONFORMABLE.' 'NEXT:¸(∧/1=(NA←õ/RA←∊1Ç∆A),NB←õ/RB←∊1Ç∆B)/EXP' '¸((∆RA)≠∆]0127 [ RB)/RNKERR' '¸(∧/RA≠RB)/LENERR' '¸0' 'RNKERR:''VECTOR RANK ERROR''' '¸']0128 [ 'LENERR:''VECTOR LENGTH ERROR''' '¸' 'EXP:¸((NA≠1)∧(NA=1)∧(NB=1)∧(∆RA)]0129 [X>∆RB)/EXPB' 'A←(RB,∊1×∆A)∆A' '¸0' 'EXPB:B←(RA,∊1×∆B)∆B' ]0130 [<b style="color:green">∇ </b>EXPAND FX 'EXPAND;RA;NA;RB;NB' '⍝ PROCEDURE TO TEST IF THE GLOBAL VAR]0131 [ IABLES A AND B ARE' '⍝ CONFORMABLE FOR SCALAR OPERATIONS AND IF SO,]0132 [ TO EXPAND' '⍝ ONE OF THEM, IF NECESSARY, SO THAT THEY HAVE THE SAME' ']0133 [ ⍝ SHAPE. IF THEY ARE NOT CONFORMABLE, ALL PROCESSING IS' '⍝ STOPPED. ]0134 [ IF EITHER A OR B HAS ONE ENTRY, THEY ARE' '⍝ CONFOMRABLE.' '¸(∧/1=(]0135 [ NA←õ/RA←∆A),NB←õ/RB←∆B)/EXP' '⍝ OTHERWISE, THEY MUST HAVE THE SAME RANK]0136 [ .' '¸((∆RA)≠∆RB)/RNKERR' '⍝ AND THE SAME SHAPE.' '¸(∧/RA≠RB)/LENERR' '¸]0137 [ 0' 'RNKERR:''PROCEDURE RANK ERROR''' '¸' 'LENERR:''PROCEDURE LENGTH ERR]0138 [ OR''' '¸' '⍝ SEE WHICH ARRAY MUST BE EXPANDED.' 'EXP:¸((NA≠1)∧(NA=1)∧(N]0139 [ B=1)∧(∆RA)>∆RB)/EXB' '⍝ EXPAND A' '¸0,∆A←RB∆A' '⍝ EXPAND B' 'EXB:B←RA∆B]0140 [X' ]0141 [<b style="color:green">∇ </b>FRCLEAR FX 'FRCLEAR;I' '⍝ EXPUNGES THE VARIABLES DESCRIBING THE CURRE]0142 [ NT' '⍝ FINITE RING.' 'I←(EX ''FRPLUS''),(EX ''FRTIMES''),(EX ''FRNEG]0143 [X''),EX ''FRINV''' ]0144 [<b style="color:green">∇ </b>FRDET FX 'D←FRDET A;IO;M;N;K;SIGN;X;NX;S;T;SGN;CFR;U' '⍝ COMPUTES TH]0145 [ E DETERMINANT OF A MATRIX OVER THE FINITE RING,' '⍝ WHICH MUST BE COMMU]0146 [ TATIVE.' 'IO←0' 'DERR∧/(FRTEST A),(2=∆∆A),=/∆A' 'DERR∧/,FRTIMES=íFRTIM]0147 [ ES' 'T←(2*N←1×∆A)∆3-3' 'CFR←∆FRNEG' 'M←A[K←0;]' 'SIGN←1' 'NX←+/2*X←(N,1]0148 [ )∆⌈N' 'LOOP:¸(NóK←K+1)/END' 'T[NX]←⌈∆NX' 'NX←+/2*X←(K+1)SSUB N' 'S←T[(í]0149 [ ((K+1),∆NX)∆NX)-2*X]' 'SIGN←-SIGN' 'U←(,FRTIMES)[A[K;X]+M[S]õCFR]' 'M←(]0150 [ ∊1Ç∆U)∆0' 'X←0=⌈∊1×∆U' 'SGN←SIGN' 'LOOP2:¸(SGN=∊1)/NEG' 'M←(,FRPLUS)[((]0151 [ ∆M)∆X/U)+MõCFR]' '¸INCR' 'NEG:M←(,FRPLUS)[FRNEG[(∆M)∆X/U]+MõCFR]' 'INCR]0152 [X:SGN←-SGN' '¸(~1×X←∊1∨X)/LOOP2' '¸LOOP' 'END:D←+/M' ]0153 [<b style="color:green">∇ </b>FRTEST FX 'T←FRTEST A' '⍝ CHECKS WHETHER A REPRESENTS AN ARRAY OVER]0154 [X THE CURRENT' '⍝ FINITE RING.' 'T←∧/(,A=≤A),(,A<∆FRNEG),,0óA' ]0155 [<b style="color:green">∇ </b>FRDIFF FX 'C←A FRDIFF B;IO' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS]0156 [ OVER THE FINITE' '⍝ RING.' 'IO←0' '¸NOTEST/BEGIN' 'DERR(FRTEST A)∧FRT]0157 [XEST B' 'EXPAND' 'BEGIN:C←(,FRPLUS)[FRNEG[B]+Aõ1×∆FRPLUS]' ]0158 [<b style="color:green">∇ </b>FRINIT FX 'A FRINIT B;IO;C;U' '⍝ INITIALIZES THE GLOBAL VARIABLES FO]0159 [ R THE CURRENT FINITE' '⍝ RING. A IS THE ADDITION TABLE AND B IS THE]0160 [ ' '⍝ MULTIPLICATION TABLE.' 'FRPLUS←A' 'FRTIMES←B' 'FRNEG←SFEL A=IO←0']0161 [X 'U←FRINV/⌈∆FRINV←(∧/íC)∧∧/C←B=1' 'FRINV[U]←SFEL C[U;]' ]0162 [<b style="color:green">∇ </b>FRMATPROD FX 'C←A FRMATPROD B;M;RHO;RR;X;AX;BX;IO;RA;RB' '⍝ COMPUTES]0163 [ THE MATRIX PRODUCT OF TWO NONSCALAR ARRAYS' '⍝ OVER THE FINITE RING.' ]0164 [ 'IO←0' 'DERR(FRTEST A)∧(FRTEST B)∧(∧/0<(∆∆A),∆∆B)∧(∊1×∆A)=1×∆B' 'RHO←(]0165 [ RA←∊1Ç∆A),RB←1Ç∆B' 'RR←((∆RA)+⌈∆RB),⌈∆RA' 'C←RHO∆0' 'M←1×∆FRTIMES' 'X←(]0166 [ 1×∆B)×1' 'LOOP:AX←RRí(RB,RA)∆X/A' 'BX←RHO∆XðB' 'C←(,FRPLUS)[(,FRTIMES)[]0167 [XBX+AXõM]+CõM]' '¸(~1×X←∊1∨X)/LOOP' ]0168 [<b style="color:green">∇ </b>FRPOWER FX 'C←A FRPOWER B;RHO;I;J;IO;M' '⍝ COMPUTES THE B-TH POWER O]0169 [<b style="color:green">∇ </b> A IN THE FINITE RING' '⍝ USING THE BINARY POWER ALGORITHM.' 'IO←0']0170 [ 'DERR(FRTEST A)∧∧/,(B=≤B),B⎕0' 'EXPAND' 'RHO←∆A' 'C←(∆A←,A)∆1' 'I←(B>0]0171 [ )/⌈∆B←,B' 'M←1×∆FRTIMES' 'LOOP:C[J]←(,FRTIMES)[A[J]+MõC[J←(2|B[I])/I]]']0172 [ '¸(0=∆I←(B[I]⎕2)/I)/END' 'A[I]←(,FRTIMES)[A[I]õM+1]' 'B[I]←≤B[I]ö2' '¸]0173 [XLOOP' 'END:C←RHO∆C' ]0174 [<b style="color:green">∇ </b>FRPROD FX 'C←A FRPROD B;IO' '⍝ COMPUTES THE PRODUCT OF TWO ARRAYS OV]0175 [ ER THE FINITE RING.' 'IO←0' '¸NOTEST/BEGIN' 'DERR(FRTEST A)∧FRTEST B' ]0176 [X'EXPAND' 'BEGIN:C←(,FRTIMES)[B+Aõ1×∆FRTIMES]' ]0177 [<b style="color:green">∇ </b>FRSUM FX 'C←A FRSUM B;IO' '⍝ COMPUTES THE SUM OF TWO ARRAYS OVER THE]0178 [ FINITE RING.' 'IO←0' '¸NOTEST/BEGIN' 'DERR(FRTEST A)∧FRTEST B' 'EXPAN]0179 [XD' 'BEGIN:C←(,FRPLUS)[B+Aõ1×∆FRPLUS]' ]0180 [<b style="color:green">∇ </b>FRXDEGREE FX 'B←FRXDEGREE A' '⍝ COMPUTES THE ARRAY OF DEGREES OF AN A]0181 [ RRAY OF POLYNOMIALS' '⍝ OVER THE FINITE RING.' 'DERR FRTEST A' 'B←ZXDEG]0182 [XREE A' ]0183 [<b style="color:green">∇ </b>FRXDIFF FX 'C←A FRXDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS O]0184 [XF POLYNOMIALS' '⍝ OVER THE FINITE RING.' 'C←A FRXSUM FRNEG[B]' ]0185 [<b style="color:green">∇ </b>FRXSUM FX 'C←A FRXSUM B;M;D' '⍝ COMPUTES THE SUM OF TWO ARRAYS OF POL]0186 [ YNOMIALS OVER' '⍝ THE FINITE RING.' 'EXPANDV' 'M←(∆A)©∆B' 'C←(M×A)FRSUM]0187 [X M×B' 'D←1©+/∧\∨∧ð((õ/∊1Ç∆C),∊1×∆C)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0188 [<b style="color:green">∇ </b>FRXEVAL FX 'Y←A FRXEVAL B;I;IO;RHO;M' '⍝ EVALUTES THE POLYNOMIALS IN]0189 [ A AT B IN THE' '⍝ FINITE RING. COMMUTATIVITY OF THE RING IS NOT C]0190 [ HECKED.' 'DERR(FRTEST A)∧FRTEST B←((∆B),1)∆B' 'EXPANDV' 'A←((õ/RHO←∊1Ç∆]0191 [ A),∊1×∆A)∆A' 'Y←(∆B←,B)∆IO←0' 'M←1×∆FRPLUS' 'I←(∆A)[1]' 'LOOP:¸(0>I←I-]0192 [X1)/END' 'Y←(,FRPLUS)[(,FRTIMES)[B+MõY]+MõA[;I]]' '¸LOOP' 'END:Y←RHO∆Y' ]0193 [<b style="color:green">∇ </b>FRXLEAD FX 'C←FRXLEAD A;EPSILON' '⍝ COMPUTES THE LEADING COEFFICIENTS]0194 [ OF AN ARRAY OF' '⍝ POLYNOMIALS OVER THE CURRENT FINITE RING.' 'DERR FR]0195 [XTEST A' 'EPSILON←0' 'C←RXLEAD A' ]0196 [<b style="color:green">∇ </b>FRXPROD FX 'C←A FRXPROD B;IO;D;RHO;I' '⍝ COMPUTES THE ENTRY-BY-ENTRY]0197 [ PRODUCT OF TWO ARRAYS' '⍝ OF POLYNOMIALS OVER THE FINITE RING.' 'EXPAN]0198 [ DV' 'IO←0' 'D←((⌈∊1+∆∆A),0 ∊1+∆∆A)íBø.õ(∊1×∆A)∆1' 'D←(Aø.õ(∊1×∆B)∆1)FR]0199 [ PROD D' 'D←D,((∆A),∊1+∊1×∆A)∆0' 'D←((∆A)∆-⌈∊1×∆A)∨D' 'RHO←∆D' 'D←((õ/∊2]0200 [ ÇRHO),∊2×RHO)∆D' 'C←(∆D)[0 2]∆0' 'I←∊1' 'LOOP:¸((∆D)[1]=I←I+1)/END' 'C←]0201 [ C FRSUM D[;I;]' '¸LOOP' 'END:D←1©+/∧\∨∧ð0≠C' 'C←((∊2ÇRHO),D)∆((1×∆C),D)]0202 [X×C' ]0203 [<b style="color:green">∇ </b>GAUSSFACTOR FX 'C←GAUSSFACTOR A;IO;P;I;J;U;Q;NOTEST' '⍝ PRODUCES A L]0204 [ IST OF GAUSSIAN PRIMES WHOSE PRODUCT' '⍝ IS AN ASSOCIATE OF THE NONZERO]0205 [ GAUSSIAN INTEGER A.' '⍝ NO RATIONAL PRIME IN THE NORM OF A MAY BE' ]0206 [ '⍝ LARGER THAN 10000.' 'DERR∧/(,A=≤A),(1⎕∆∆A),(∧/,A≠0),(õ/∆A)î1 2' 'C←0]0207 [ 2∆0' 'IO←1' '¸(0=∆P←SSORT ZFACTOR A+.õA←2×A)/0' 'DERR 10000>∊1×P' 'Q←]0208 [ ((2=P[1]),2)∆1 1' 'Q←Q,[1]((3=4|P)/P),[1.5]0' 'NOTEST←1' '¸(0=∆P←(1=4|P]0209 [ )/P)/LOOP' 'I←SFEL U=≤U←(0©Pø.-(⌈≤(∊1×P)*0.5)*2)*0.5' 'Q←Q,[1]í(I,I),[0]0210 [ .5]J,-J←≤(P-IõI)*0.5' 'LOOP:¸(0=∆Q←(∧/0=Q GAUSSREM(∆Q)∆A)ðQ)/END' 'C←C,]0211 [X[1]Q' 'A←≤A CQUOT CPRODRED Q' '¸LOOP' 'END:C←C[ûC[;2];]' 'C←C[û+/C*2;]']0212 [<b style="color:green">∇ </b>GAUSSREM FX 'C←A GAUSSREM B;EPSILON' '⍝ COMPUTES ONE REMAINDER OF B ]0213 [ DIVIDED BY A IN THE' '⍝ EUCLIDEAN DOMAIN OF GAUSSIAN INTEGERS.' 'EPS]0214 [XILON←0' 'C←B CDIFF A CPROD B GAUSSQUOT A' ]0215 [<b style="color:green">∇ </b>GAUSSQUOT FX 'C←A GAUSSQUOT B;EPSILON' '⍝ COMPUTES ONE QUOTIENT OF A]0216 [ BY B IN THE' '⍝ EUCLIDEAN DOMAIN OF GAUSSIAN INTEGERS.' 'EPSILON←0']0217 [X 'C←≤0.5+A CQUOT B' ]0218 [<b style="color:green">∇ </b>GPALLORB FX 'B←GPALLORB A;N;x;I;NOTEST;C' '⍝ COMPUTES A SUMMARY OF TH]0219 [ E ORBITS OF THE PERMUTATION' '⍝ GROUP GENERATED BY THE ROWS OF THE MATR]0220 [ IX A.' '⍝ THE FIRST ROW OF B GIVES THE LENGTHS OF THE ORBITS.' '⍝ TH]0221 [ E SECOND ROW OF B GIVES REPRESENTATIVES.' '⍝ q[I] IS THE FIRST POINT]0222 [ IN THE ORBIT CONTAINING I.' 'DERR(GPTEST A)∧2=∆∆A' 'q←(N←∊1×∆A)∆∊1' ']0223 [ B←2 0∆0' 'NOTEST←1' 'LOOP:¸((N+IO)óI←q⌈∊1)/0' 'q[C←A GPORBIT I]←I' 'B←]0224 [XB,I,∆C' '¸LOOP' ]0225 [<b style="color:green">∇ </b>GPTEST FX 'T←GPTEST A;M;N;Z' '⍝ CHECKS THAT A IS AN ARRAY OF PERMUT]0226 [ ATIONS.' '¸(~T←∧/(1ó∆∆A),,A=≤A)/0' '¸(~T←(∧/,A⎕IO)∧∧/A<IO+N←∊1×∆A)/0']0227 [X 'Z←(õ/∆A)∆0' 'Z[(,A)+,í(N,M)∆Nõ(⌈M←õ/∊1Ç∆A)-IO]←1' 'T←∧/Z' ]0228 [<b style="color:green">∇ </b>GPORBIT FX 'C←A GPORBIT I;V' '⍝ COMPUTES A LIST C AND THE CHARACTER]0229 [ ISTIC VECTOR x' '⍝ OF THE ORBIT CONTAINING I OF THE PERMUATION GROUP]0230 [ ' '⍝ GENERATED BY THE ROWS OF THE MATRIX A.' 'DERR(1=∆I)∧(2=∆∆A)∧(∧/I=]0231 [ ≤I←,I)∧GPTEST A' 'x←(∊1×∆A)∆0' 'x[C←V←I]←1' 'LOOP:C←C,V←SSORT(~x[V])/V←]0232 [X,A[;V]' 'x[V]←1' '¸(0≠∆V)/LOOP' 'C←SSORT C' ]0233 [<b style="color:green">∇ </b>GPCYCIN FX 'X←N GPCYCIN C;Y;I;D;U' '⍝ CONSTRUCTS THE VECTOR FORM OF T]0234 [ HE PERMUTATION OF ⌈N' '⍝ GIVEN AS A PRODUCT OF CYCLES IN THE CHARACTER]0235 [ VECTOR C.' '⍝ THE CYCLES DO NOT NEED TO BE DISJOINT. ORIGIN DEPENDEN]0236 [ T.' 'DERR(1=∆N)∧N=≤N←,N' 'X←⌈N' 'C←(C≠'' '')/C←,C' '⍝ GET THE NEXT CYCL]0237 [ E.' 'LOOP:¸(0=∆C)/0' 'D←(I←(C⌈'')'')+1-IO)×C' 'C←IÇC' 'DERR(''(''=1×D)]0238 [ ∧'')''=∊1×D' 'D←∊1Ç1ÇD' 'D[(D='','')/⌈∆D]←'' ''' 'DERR∧/Dî''0123456789 ]0239 [ ''' 'DERR(∆U)=∆SSORT U←,∊D' 'DERR∧/U<N+IO' 'Y←⌈N' 'Y[U]←1∨U' 'X←Y[X]' ]0240 [X'¸LOOP' ]0241 [<b style="color:green">∇ </b>GPCYCOUT FX 'C←GPCYCOUT X;T;I;J' '⍝ CONSTRUCTS THE CYCLE FORM OF THE ]0242 [ PERMUTATION X.' 'DERR 1=∆∆X' 'DERR∧/X[ûX]=⌈∆X' 'C←''''' 'T←(∆X)∆0' '⍝ ]0243 [<b style="color:green">∇ </b>IND THE START OF THE NEXT CYCLE.' 'LOOP1:¸((IO+∆X)óI←T⌈0)/0' 'T[I]←1']0244 [ 'C←C,''('',®J←I' 'LOOP2:¸(I=J←X[J])/CLOSE' 'C←C,'','',®J' 'T[J]←1' '¸L]0245 [XOOP2' 'CLOSE:C←C,'')''' '¸LOOP1' ]0246 [<b style="color:green">∇ </b>GPINV FX 'C←GPINV A;N;L;M' '⍝ COMPUTES THE INVERSES OF THE PERMUTATIO]0247 [ NS IN A.' '¸NOTEST/BEGIN' 'DERR GPTEST A' 'BEGIN:C←(N←õ/∆A)∆2' 'L←≤NöM←]0248 [X∊1×∆A' 'C[(,A)+,í(M,L)∆Mõ(⌈L)-IO]←N∆⌈M' 'C←(∆A)∆C' ]0249 [<b style="color:green">∇ </b>GPPROD FX 'C←A GPPROD B;M;RHO;N;I' '⍝ COMPUTES THE ELEMENT-BY-ELEMENT]0250 [ PRODUCT OF TWO' '⍝ ARRAYS OF PERMUTATIONS (OR MAPS).' '¸NOTEST/BEGIN' ]0251 [ 'DERR∧/(,A=≤A),(,A⎕IO),,A<IO+∊1×∆B' 'EXPANDV' 'BEGIN:M←õ/∊1ÇRHO←∆A' ']0252 [XN←∊1×RHO' 'I←RHO∆í(N,M)∆Nõ(⌈M)-IO' 'C←(,B)[A+I]' ]0253 [<b style="color:green">∇ </b>GPSGN FX 'B←GPSGN A;C;D;N' '⍝ COMPUTES THE SIGNS OF THE PERMUTATIONS ]0254 [ IN A.' '¸NOTEST/BEGIN' 'DERR GPTEST A' 'BEGIN:D←((⌈∊2+∆∆C),IO+(∆∆C)-1]0255 [X 2)íC←Aø.õ(N←∊1×∆A)∆1' 'B←∊1*+/+/(C>D)∧(∆C)∆(⌈N)ø.<⌈N' ]0256 [<b style="color:green">∇ </b>GPSGP FX 'H←GPSGP X;N;HP;V;VP' '⍝ COMPUTES THE PERMUTATION GROUP GENE]0257 [ RATED BY THE' '⍝ ROWS OF THE MATRIX X. VALID FOR DEGREES AT MOST 12.']0258 [ '⍝ WORKSPACE FULL ERRORS ARE LIKELY FOR DEGREES OVER 7.' 'DERR(GPTEST ]0259 [ X)∧(2=∆∆X)∧12⎕∊1×∆X' 'N←∊1×∆X' 'H←(N∆N+1)HP←SSORT(N+1)(⌈N),V←X←íX' 'L]0260 [ OOP:HP←HP,VP←SSORT(~VPîHP)/VP←,(N+1)X[V;]' 'H←H,V←(N∆N+1)VP' '¸(0≠∆VP]0261 [X)/LOOP' 'H←íH' ]0262 [<b style="color:green">∇ </b>GPSYMG FX 'T←GPSYMG N;V' '⍝ LISTS THE ELEMENTS OF THE SYMMETRIC GROUP]0263 [ ON ⌈N.' 'DERR∧/(0óN←''''∆N),(N=≤N),1=∆N←,N' '¸(N>0)/GENERAL' 'T←1 0∆0]0264 [ ' '¸0' 'GENERAL:T←((!N),N-1)∆GPSYMG N-1' 'V←,í((!N-1),N)∆(⌈N)-IO' 'T←V]0265 [X∨((-V)∨T),N+IO-1' ]0266 [<b style="color:green">∇ </b>GTCHECK FX 'T←GTCHECK G;IO;E;N;M;I;GTABLE;GTIO;GTINV' '⍝ CHECKS WHET]0267 [ HER G IS A GROUP TABLE WITH IDENTITY' '⍝ EQUAL TO THE INDEX ORIGIN.' ]0268 [ '⍝ IS G A SQUARE INTEGER MATRIX?' '¸(∧/(2≠∆∆G),(≠/∆G),,G≠≤G)/NO' '⍝ T]0269 [ HE ORIGIN SHOULD BE SET EQUAL TO ≤/,G' '¸(∧/0 1≠E←≤/,G)/NO' 'GTIO←IO←]0270 [ E' '⍝ CHECK CLOSURE.' '¸(∧/,G>M←∊1+IO+N←1×∆G)/NO' '⍝ ANY BINARY OPERAT]0271 [ ION ON ⌈1 IS A GROUP.' '¸(N=1)/YES' '⍝ CHECK FOR TWO-SIDED IDENTITY.']0272 [ '¸(∧/(G[IO;]≠⌈N),G[;IO]≠⌈N)/NO' '⍝ COPY G INTO GTABLE FOR USE IN ]0273 [ GTSGP AND' '⍝ SET G TO 1 TO SAVE SPACE.' 'GTINIT G' 'G←1' '⍝ TRY TO]0274 [ FIND A GENERATING SET U WITH N⎕2*∆U.' 'U←⌈0' 'X←IO=⌈N' 'LOOP1:¸(M<]0275 [ I←X⌈0)/TEST' '¸(N<2*∆U←U,I)/NO' 'X[GTSGP U]←1' '¸LOOP1' '⍝ MAKE SURE EL]0276 [ EMENTS OF U HAVE LEFT INVERSES.' 'TEST:¸(~∧/∧ðGTABLE[;U]=IO)/NO' '⍝ ]0277 [ CHECK ASSOCIATIVITY FOR TRIPLES WITH THIRD' '⍝ ELEMENT IN U.' 'I←IO-1]0278 [ ' 'LOOP2:¸((IO+∆U)óI←I+1)/YES' '¸(∧/GTABLE[GTABLE;U[I]]≠GTABLE[;GTABLE]0279 [X[;U[I]]])/NO' '¸LOOP2' 'NO:¸T←0' 'YES:T←1' ]0280 [<b style="color:green">∇ </b>GTINIT FX 'GTINIT A;IO' '⍝ INITIALIZES THE CURRENT ABSTRACT GROUP.' ]0281 [X'GTABLE←A' 'IO←GTIO←≤/A[IO←1;]' 'GTINV←SFEL A=IO' ]0282 [<b style="color:green">∇ </b>GTSGP FX 'B←GTSGP A;IO;V' '⍝ COMPUTES THE SUBGROUP GENERATED BY A ]0283 [ IN THE' '⍝ CURRENT ABSTRACT GROUP.' 'IO←GTIO' 'DERR GTTEST A' 'B←SSORT]0284 [ IO,V←,A' 'LOOP:B←B,V←SSORT(~VîB)/V←,GTABLE[V;A]' '¸(0≠∆V)/LOOP' 'B←B[]0285 [XûB]' ]0286 [<b style="color:green">∇ </b>GTTEST FX 'T←GTTEST A' '⍝ CHECKS WHETHER A REPRESENTS AN ARRAY OVER]0287 [ ' '⍝ THE CURRENT ABSTRACT GROUP.' '¸(~T←∧/,A=≤A)/0' 'T←(∧/,A⎕GTIO)∧∧/,A]0288 [X<GTIO+∆GTINV' ]0289 [<b style="color:green">∇ </b>GTCLEAR FX 'GTCLEAR;I' '⍝ EXPUNGES THE VARIABLES DESCRIBING THE CURRE]0290 [ NT' '⍝ ABSTRACT GROUP.' 'I←(EX ''GTABLE''),(EX ''GTIO''),EX ''GTINV']0291 [X'' ]0292 [<b style="color:green">∇ </b>GTLCON FX 'B←GTLCON A;IO;X' '⍝ COMPUTES THE CHARACTERISTIC MATRIX FO]0293 [ R LEFT CONGRUENCE' '⍝ MODULO THE SUBGOUP OF THE CURRENT ABSTRACT' '⍝ GR]0294 [ OUP LISTED IN A.' 'IO←GTIO' 'DERR(1ó∆A)∧GTTEST A←,A' 'X←(∆GTINV)∆0' ']0295 [XX[A]←1' 'DERR∧/,X[GTABLE[A;A]]' 'B←X[GTABLE[GTINV;]]' ]0296 [<b style="color:green">∇ </b>GTPROD FX 'C←A GTPROD B;IO' '⍝ COMPUTES ENTRY-BY-ENTRY PRODUCTS IN T]0297 [ HE CURRENT' '⍝ ABSTRACT GROUP.' 'IO←GTIO' '¸NOTEST/BEGIN' 'DERR(GTTEST]0298 [X A)∧GTTEST B' 'EXPAND' 'BEGIN:C←(,GTABLE)[B+(A-IO)õ∆GTINV]' ]0299 [<b style="color:green">∇ </b>GTRCON FX 'B←GTRCON A;IO;X' '⍝ COMPUTES THE CHARACTERISTIC MATRIX FO]0300 [ R RIGHT CONGRUENCE' '⍝ MODULO THE SUBGROUP OF THE CURRENT ABSTRACT' '⍝ ]0301 [ GROUP LISTED IN A.' 'IO←GTIO' 'DERR(1ó∆A)∧GTTEST A←,A' 'X←(∆GTINV)∆0']0302 [X 'X[A]←1' 'DERR∧/,X[GTABLE[A;A]]' 'B←X[GTABLE[;GTINV]]' ]0303 [<b style="color:green">∇ </b>MPZDET FX 'D←MPZDET A;IO;E;N;n;F;G;P;I;q;N2' '⍝ MULTIPLE PRECISION D]0304 [ ETERMINANT OF A SINGLE PRECISION' '⍝ INTEGER MATRIX A LA CABAY AND LAM.]0305 [ ' 'DERR∧/(2=∆∆A),(=/∆A),,A=≤A' 'IO←1' 'E←(⊥2)++/⊥(+/AõA)*0.5' 'DERR(∆B]0306 [ IGPRIMES)⎕N←©Eö⊥BIGPRIMES[1]' 'N2←≤0.5õn←BIGPRIMES[1]' 'D←,(n|N2+ZNDET ]0307 [ A)-N2' 'P←,1' 'I←1' 'LOOP:¸(N<I←I+1)/END' 'N2←≤0.5õn←BIGPRIMES[I]' 'F←Z]0308 [ NDET A' 'G←(n|N2+BIGINV[I]õF-1000000(,n)MPZREM0 D)-N2' 'P←P MPZPROD0,B]0309 [XIGPRIMES[I-1]' 'D←D MPZSUM0 P MPZPROD0,G' '¸LOOP' 'END:D←MPZFORM D' ]0310 [<b style="color:green">∇ </b>MPZREM0 FX 'C←A MPZREM0 B;IO;I;L;M;N;Q;R;SA;SC;T' '⍝ COMPUTES MULTIP]0311 [ LE PRECISION REMAINDER USING VECTORS' '⍝ OF DIGITS TO THE BASE 1E6. TH]0312 [ E QUOTIENT IS SAVED' '⍝ IN THE GLOBAL VARIABLE q.' 'q←,IO←0' 'C←MPZNR]0313 [ MLZ B' '¸(0=SA←õ1×A←MPZNRMLZ A)/0' 'A←|A' 'LOOP:¸(((∆C)<∆A)∧0>SC←õ1×C)/]0314 [ NEG' '¸((∆C)>∆A)/DIVIDE' '¸(0>SC)/DIVIDE' '¸((∆C)<∆A)/0' '¸((∆A)=I←(A≠C]0315 [ )⌈1)/DIVIDE' '¸(A[I]>C[I])/0' 'DIVIDE:N←≤10⊥Q←(1000000|(M←3≤∆C)×C)ö100]0316 [ 0000(L←3≤∆A)×A' '¸(12>T←N+6õ((∆C)-M)-(∆A)-L)/SMALL' 'Q←≤Qõ10*T-N+6õR←∊]0317 [ 2+≤Tö6' 'Q←(SAõSCõ,(3∆1000000)Q),R∆0' '¸ADJUST' 'SMALL:Q←≤SAõSCõQõ10*T]0318 [ -N' 'Q←(õQ)õ((1+≤10⊥|Q)∆1000000)|Q' 'ADJUST:q←q MPZSUM0 Q' 'C←C MPZSUM]0319 [X0(-SA)õQ MPZPROD0 A' '¸LOOP' 'NEG:C←C MPZSUM0 A' 'q←q MPZSUM0-SA' ]0320 [<b style="color:green">∇ </b>MPZPROD0 FX 'C←A MPZPROD0 B;IO;U' '⍝ COMPUTES THE PRODUCT OF TWO VEC]0321 [ TORS OF DIGITS TO' '⍝ THE BASE 1E6.' 'IO←0' 'U←(A←,A)ø.õ,B' 'C←MPZNRML]0322 [XZ+ð(-⌈∆A)∨U,(0 ∊1+2∆∆A)∆0' ]0323 [<b style="color:green">∇ </b>MPZSUM0 FX 'C←A MPZSUM0 B;M' '⍝ ADDS VECTORS OF DIGITS TO BASE 1E6.' ]0324 [X'M←-(∆A←,A)©∆B←,B' 'C←MPZNRMLZ(M×A)+M×B' ]0325 [<b style="color:green">∇ </b>MPZFORM FX 'X←MPZFORM A' '⍝ CONVERTS A VECTOR OF DIGITS TO THE BASE 1]0326 [ E6 TO' '⍝ A VECTOR OF CHARACTERS.' 'X←,((∆A),∊6)×®((∆A),1)∆≤|A←,A' 'X[(]0327 [XX='' '')/⌈∆X]←''0''' 'X←((∊1=õ1×A)∆''∊''),(((''0''≠∊1ÇX)⌈1)-IO)ÇX' ]0328 [<b style="color:green">∇ </b>MPZNRMLZ FX 'B←MPZNRMLZ A;SIGN;S' '⍝ NORMALIZES A VECTOR OF DIGITS TO]0329 [ THE BASE 1E6.' 'DERR∧/(1⎕∆∆A),B=≤B←,A' 'SIGN←1' 'LOOP:¸(0=∆B←(((B≠0)⌈1]0330 [ )-IO)ÇB)/ZERO' 'B←≤BõS←õ1×B' 'SIGN←SõSIGN' '¸(∧/(B<1000000),B⎕0)/END' ]0331 [X'B←(S,0)+0,B-1000000õS←≤Bö1000000' '¸LOOP' 'ZERO:¸B←,0' 'END:B←SIGNõB' ]0332 [<b style="color:green">∇ </b>MPZDIFF FX 'Z←X MPZDIFF Y' '⍝ COMPUTES THE DIFFERENCE OF TWO MULTIPLE]0333 [ PRECISION' '⍝ INTEGERS REPRESENTED AS CHARACTER VECTORS.' 'Z←MPZFORM(M]0334 [XPZUNF X)MPZSUM0-MPZUNF Y' ]0335 [<b style="color:green">∇ </b>MPZUNF FX 'A←MPZUNF X;IO;M;SIGN' '⍝ CONVERTS THE CHARACTER VECTOR OF]0336 [ A MULTIPLE PRECISION' '⍝ INTEGER INTO A VECTOR OF DIGITS TO THE BASE 1]0337 [ E6.' 'IO←0' 'M←∧/''+∊''=1×X←,X' 'SIGN←1×M×X' 'DERR∧/(X←MÇX)î''01234567]0338 [ 89''' 'A←,∊((7õM)∆0 1 1 1 1 1 1)\(∊6õM←©(∆X)ö6)×X' 'A←(∊1*SIGN=''∊'')õA]0339 [X' ]0340 [<b style="color:green">∇ </b>MPZGCD FX 'Z←X MPZGCD Y' '⍝ COMPUTES THE GCD OF TWO INTEGERS GIVEN BY]0341 [ ' '⍝ CHARACTER VECTORS OF DIGITS TO THE BASE 10.' 'Z←MPZFORM(MPZUNF X)M]0342 [XPZGCD0 MPZUNF Y' ]0343 [<b style="color:green">∇ </b>MPZGCD0 FX 'C←A MPZGCD0 B;q' '⍝ COMPUTES THE GCD OF TWO INTEGERS GIVE]0344 [ N' '⍝ BY VECTORS OF DIGITS TO THE BASE 1E6.' 'A←|MPZNRMLZ A' 'C←|MPZNRM]0345 [XLZ B' 'LOOP:¸(0=1×A)/0' 'B←A MPZREM0 C' 'C←A' 'A←B' '¸LOOP' ]0346 [<b style="color:green">∇ </b>MPZMAG FX 'B←MPZMAG A;N' '⍝ COMPUTES THE ABSOLUTE VALUE OF AN INTEGER]0347 [ ' '⍝ GIVEN BY A CHARACTER VECTOR OF DIGITS TO' '⍝ THE BASE 10.' 'DERR(1]0348 [ ⎕∆∆A)∧∧/,Aî''0123456789+∊''' '¸(~(1×A←,A)î''+∊'')/NOSIGN' 'A←1ÇA' 'NOSI]0349 [XGN:N←+/∧\A=''0''' '¸(0<∆B←NÇA)/0' 'B←,''0''' ]0350 [<b style="color:green">∇ </b>MPZMAG0 FX 'B←MPZMAG0 A' '⍝ COMPUTES THE MAGNITUDE OF AN INTEGER GIVE]0351 [XN' '⍝ BY A VECTOR OF DIGITS TO THE BASE 1E6.' 'B←|MPZNRMLZ A' ]0352 [<b style="color:green">∇ </b>MPZNEG FX 'B←MPZNEG A;IO;I;C' '⍝ COMPUTES THE NEGATIVE OF AN INTEGER]0353 [ GIVEN' '⍝ BY A CHARACTER VECTOR OF DIGITS TO THE BASE 10.' 'IO←0' 'DE]0354 [ RR(1⎕∆∆A)∧'' ''=1×0×,A' 'I←(C←1×B←,A)î''+∊''' 'B←IÇB' 'DERR∧/Bî''012345]0355 [X6789''' 'B←(+/∧\''0''=∊1ÇB)ÇB' '¸((C=''∊'')∧''0''=1×B)/0' 'B←''∊'',B' ]0356 [<b style="color:green">∇ </b>MPZPOWER FX 'Z←X MPZPOWER N' '⍝ COMPUTES THE N-TH POWER OF THE MULTIP]0357 [ LE PRECISION' '⍝ INTEGER WITH CHARACTER VECTOR X. N IS AN' '⍝ ORDINA]0358 [XRY INTEGER.' 'Z←MPZFORM(MPZUNF X)MPZPOWER0 N' ]0359 [<b style="color:green">∇ </b>MPZPOWER0 FX 'B←A MPZPOWER0 N' '⍝ RAISES A VECTOR OF DIGITS TO BASE 1]0360 [ E6 TO' '⍝ THE POWER N, WHICH IS AN ORDINARY INTEGER.' 'DERR(N=≤N)∧N⎕0' ]0361 [ 'A←MPZNRMLZ A' 'B←,1' 'LOOP:¸(N=0)/0' '¸(0=2|N)/EVEN' 'B←B MPZPROD0 A' ]0362 [X'EVEN:A←A MPZPROD0 A' 'N←≤Nö2' '¸LOOP' ]0363 [<b style="color:green">∇ </b>MPZPROD FX 'Z←X MPZPROD Y' '⍝ MULTIPLE PRECISION PRODUCT OF INTEGERS ]0364 [ GIVEN' '⍝ BY CHARACTER VECTORS OF DIGITS TO THE BASE 10.' 'Z←MPZFORM(MP]0365 [XZUNF X)MPZPROD0 MPZUNF Y' ]0366 [<b style="color:green">∇ </b>MPZREM FX 'Z←X MPZREM Y' '⍝ COMPUTES THE REMAINDER WHEN THE MULTIPLE ]0367 [ PRECISION' '⍝ INTEGER Y IS DIVIDED BY THE MULTIPLE PRECISION' '⍝ INTE]0368 [ GER X. THE INTEGER QUOTIENT IS SAVED IN THE' '⍝ GLOBAL VARIABLE q. ]0369 [ HERE X AND Y ARE' '⍝ CHARACTER VECTORS OF DIGITS TO THE BASE 10.' ']0370 [XZ←MPZFORM(MPZUNF X)MPZREM0 MPZUNF Y' 'q←MPZFORM q' ]0371 [<b style="color:green">∇ </b>MPZSGN FX 'T←MPZSGN A' '⍝ COMPUTES THE SIGNUM OF A MULTIPLE PRECISION]0372 [ INTEGER' '⍝ GIVEN BY A CHARACTER VECTOR OF DIGITS TO THE BASE 10.' 'DE]0373 [ RR∧/(1⎕∆∆A),,Aî''0123456789+∊''' '¸(''∊''≠1×A←,A)/NONNEG' 'T←∊1' '¸0' ']0374 [XNONNEG:¸(∧/Aî''0+'')/ZERO' 'T←1' '¸0' 'ZERO:T←0' ]0375 [<b style="color:green">∇ </b>MPZSUM FX 'Z←X MPZSUM Y' '⍝ COMPUTES THE SUM OF TWO MULTIPLE PRECISIO]0376 [ N INTEGERS' '⍝ IN CHARACTER FORM.' 'Z←MPZFORM(MPZUNF X)MPZSUM0 MPZUNF Y]0377 [X' ]0378 [XNNOTEST 0 0 ]0379 [<b style="color:green">∇ </b>QNRMLZ FX 'B←QNRMLZ A;D;RHO' '⍝ COMPUTES THE STANDARD REPRESENTATION ]0380 [ OF AN ARRAY OF' '⍝ RATIONAL NUMBERS EXPRESSED AS QUOTIENTS OF INTEGERS.]0381 [ ' '⍝ FOR SCALARS AND ARRAYS OF VECTORS OF LENGTH 1 A' '⍝ DENOMINATOR OF]0382 [ 1 IS ADDED.' '¸NOTEST/BEGIN' 'DERR QTEST A' 'BEGIN:¸((0=∆∆B)∧1=∊1×∆B←A]0383 [ )/ADDDEN' 'RHO←∊1Ç∆A' 'D←(((RHO,1)×A)ZGCD0 D)õõD←(RHO,∊1)×A' 'B←≤AöD,D']0384 [X '¸0' 'ADDDEN:B←A,1' ]0385 [<b style="color:green">∇ </b>QTEST FX 'T←QTEST A' '⍝ CHECKS WHETHER A REPRESENTS AN ARRAY' '⍝ OF]0386 [ RATIONAL NUMBERS.' '¸(~T←(∧/,A=≤A)∧(0=∆∆A)∧(0<∆∆A)∧∧/1 2=∊1×∆A)/0' '¸(]0387 [X(0=∆∆A)∧1=∊1×∆A)/0' 'T←∧/0≠,0 1/A' ]0388 [<b style="color:green">∇ </b>QDIFF FX 'C←A QDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO RATIONAL ARR]0389 [XAYS.' 'C←A QSUM QNEG B' ]0390 [<b style="color:green">∇ </b>QSUM FX 'C←A QSUM B;RA;RB;AN;AD;BN;BD;NT' '⍝ COMPUTES THE SUM OF TWO ]0391 [ RATIONAL ARRAYS.' '¸NOTEST/BEGIN' 'A←QNRMLZ A' 'B←QNRMLZ B' 'EXPANDV' ']0392 [ BEGIN:RA←∊1Ç∆A' 'RB←∊1Ç∆B' 'AN←(RA,1)×A' 'AD←(RA,∊1)×A' 'BN←(RB,1)×B' ']0393 [ BD←(RB,∊1)×B' 'NT←NOTEST' 'NOTEST←1' 'C←QNRMLZ((ANõBD)+ADõBN),ADõBD' 'N]0394 [XOTEST←NT' ]0395 [<b style="color:green">∇ </b>QNEG FX 'B←QNEG A' '⍝ COMPUTES THE NEGATIVE OF A RATIONAL ARRAY.' '¸N]0396 [XOTEST/BEGIN' 'A←QNRMLZ A' 'BEGIN:B←Aõ(∆A)∆∊1 1' ]0397 [<b style="color:green">∇ </b>QINV FX 'B←QINV A;D' '⍝ COMPUTES THE RECIPROCAL OF A RATIONAL ARRAY.']0398 [ '¸NOTEST/BEGIN' 'A←QNRMLZ A' 'DERR∧/0≠,1 0/A' 'BEGIN:B←(∨A)õD,D←õ1 0/A]0399 [X' ]0400 [<b style="color:green">∇ </b>QMATPROD FX 'C←A QMATPROD B;IO;X;AX;BX;RR;NOTEST;RA;RB' '⍝ COMPUTES ]0401 [ THE MATRIX PRODUCT OF TWO NONSCALAR ARRAYS' '⍝ OF RATIONAL NUMBERS.' ']0402 [ IO←1' 'NOTEST←0' 'A←QNRMLZ A' 'B←QNRMLZ B' 'DERR∧/2ó(∆∆A),∆∆B' 'DERR(∆A]0403 [ )[∊1+∆∆A]=1×∆B' 'C←((RA←∊2Ç∆A),(RB←∊1Ç1Ç∆B),2)∆0 1' 'X←1=⌈1×∆B' 'RR←((∆]0404 [ RA)+⌈∆RB),(⌈∆RA),∆∆C' 'NOTEST←1' 'LOOP:AX←RRí(RB,RA,2)∆X/[∊1+∆∆A]A' 'BX]0405 [X←(∆C)∆XðB' 'C←C QSUM AX QPROD BX' '¸(~1×X←∊1∨X)/LOOP' ]0406 [<b style="color:green">∇ </b>QPROD FX 'C←A QPROD B;NT' '⍝ COMPUTES THE PRODUCT OF TWO RATIONAL ARR]0407 [ AYS.' '¸NOTEST/BEGIN' 'A←QNRMLZ A' 'B←QNRMLZ B' 'EXPANDV' 'BEGIN:NT←NOT]0408 [XEST' 'NOTEST←1' 'C←QNRMLZ AõB' 'NOTEST←NT' ]0409 [<b style="color:green">∇ </b>QPOWER FX 'C←A QPOWER B;RHO;RC;I;J;NOTEST' '⍝ COMPUTES THE B-TH POWER]0410 [ OF THE RATIONAL' '⍝ ARRAY A USING THE BINARY POWER ALGORITHM.' 'NOTE]0411 [ ST←0' 'A←QNRMLZ A' 'DERR∧/(,B=≤B),,B⎕0' 'B←((∆B),1)∆B' 'EXPANDV' 'RC←(õ]0412 [ /∊1ÇRHO←∆A),2' 'A←RC∆A' 'C←RC∆1 1' 'I←(B>0)/⌈∆B←,B' 'NOTEST←1' 'LOOP:C[]0413 [ J;]←C[J;]QPROD A[J←(2|B[I])/I;]' '¸(0=∆I←(B[I]⎕2)/I)/END' 'A[I;]←A[I;]Q]0414 [XPROD A[I;]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:C←RHO∆C' ]0415 [<b style="color:green">∇ </b>QQUOT FX 'C←A QQUOT B' '⍝ COMPUTES THE QUOTIENT OF TWO RATIONAL ARRAY]0416 [XS.' 'C←A QPROD QINV B' ]0417 [<b style="color:green">∇ </b>RXLEAD FX 'C←RXLEAD A;IO;D;RHO;I;R' '⍝ COMPUTES THE ARRAY OF LEADING]0418 [ COEFFICIENTS OF AN' '⍝ ARRAY OF REAL POLYNOMIALS.' 'IO←0' '¸(0≠∆∆A)/N]0419 [ EXT' 'A←,A' 'NEXT:RHO←∊1Ç∆A←Aõ(|A)⎕EPSILONõ©/,|A' 'D←,∊1++/∧\∨0≠A' 'I←(]0420 [XD⎕0)/⌈R←õ/RHO' 'C←R∆1' 'C[I]←(,A)[D[I]+(∊1×∆A)õI]' 'C←RHO∆C' ]0421 [<b style="color:green">∇ </b>RACLEAR FX 'RACLEAR;I' '⍝ EXPUNGES THE ARRAY OF STRUCTURE CONSTANTS F]0422 [XOR' '⍝ THE CURRENT R-ALGEBRA.' 'I←EX ''RSC''' ]0423 [<b style="color:green">∇ </b>RADIFF FX 'C←A RADIFF B' '⍝ COMPUTES DIFFERENCES IN THE CURRENT R-ALG]0424 [XEBRA.' 'C←A RASUM-B' ]0425 [<b style="color:green">∇ </b>RASUM FX 'C←A RASUM B' '⍝ COMPUTE SUMS IN THE CURRENT R-ALGEBRA.' 'A←]0426 [XRANRMLZ A' 'B←RANRMLZ B' 'EXPANDV' 'C←A+B' ]0427 [<b style="color:green">∇ </b>RANRMLZ FX 'C←RANRMLZ A;IO' '⍝ RETURNS THE STANDARD REPRESENTATION O]0428 [<b style="color:green">∇ </b> AN ARRAY' '⍝ OVER THE THE CURRENT R-ALGEBRA. SCALARS AND' '⍝ VECTORS]0429 [ OF LENGTH 1 ARE PADDED WITH ZEROS.' 'IO←1' 'DERR(0=∆∆A)∧(1=∊1×∆A)∧(1×]0430 [ ∆RSC)=∊1×∆A' 'C←((∆A),⌈0=∆∆A)∆A' '¸((1×∆RSC)=∊1×∆C)/0' 'C←((∊1Ç∆C),1×∆R]0431 [XSC)×C' ]0432 [<b style="color:green">∇ </b>RAINIT FX 'RAINIT A' '⍝ INITIALIZED THE ARRAY OF STRUCTURE CONSTANTS']0433 [X '⍝ FOR THE CURRENT R-ALGEBRA.' 'DERR∧/(3=∆∆A),(1Ç∆A)=∊1Ç∆A' 'RSC←A' ]0434 [<b style="color:green">∇ </b>RANEG FX 'C←RANEG A' '⍝ COMPUTES NEGATIVES IN THE CURRENT R-ALGEBRA.']0435 [X 'C←RANRMLZ-A' ]0436 [<b style="color:green">∇ </b>RAPOWER FX 'C←A RAPOWER B;R;RHO;I;J;M' '⍝ COMPUTES THE B-TH POWER OF ]0437 [ A IN THE CURRENT' '⍝ R-ALGEBRA.' 'DERR∧/(,B=≤B),,B⎕0' 'A←RANRMLZ A' ']0438 [ B←((∆B),1)∆B' 'EXPANDV' 'R←õ/∊1ÇRHO←∆A' 'A←(R,M←∊1×∆A)∆A' 'C←(∆A)∆M×1' ]0439 [ 'I←(B>0)/⌈∆B←,B' 'LOOP:C[J;]←C[J;]RAPROD A[J←(2|B[I])/I;]' '¸(0=∆I←(B[I]0440 [ ]⎕2)/I)/END' 'A[I;]←A[I;]RAPROD A[I;]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:C←RH]0441 [XO∆C' ]0442 [<b style="color:green">∇ </b>RAPROD FX 'C←A RAPROD B;IO;R;RHO;M' '⍝ COMPUTES PRODUCTS IN THE CURR]0443 [ ENT R-ALGEBRA.' 'A←RANRMLZ A' 'B←RANRMLZ B' 'EXPANDV' 'R←õ/∊1ÇRHO←∆A' ']0444 [ IO←0' 'M←∊1×∆RSC' 'A←(R,MõM)∆2 0 1í(M,R,M)∆A' 'B←(R,MõM)∆1 0 2í(M,R,M)]0445 [X∆B' 'C←AõB' 'C←RHO∆C+.õ((MõM),M)∆RSC' ]0446 [<b style="color:green">∇ </b>RXDET FX 'D←RXDET A;IO;V;M;X;J;W;Q;R;S;U;DEG;a;NOTEST' '⍝ COMPUTES T]0447 [ HE DETERMINANT OF A MATRIX' '⍝ OF REAL POLYNOMIALS.' 'DERR(3=∆∆A)∧=/2×∆]0448 [ A' 'D←,IO←1' '¸(0=1×∆A)/0' 'A←Aõ(|A)⎕EPSILONõ©/,|A' 'NOTEST←1' 'LOOP:¸]0449 [ (1=1×∆A)/END' 'BACK:¸(∧/∊1=DEG←RXDEGREE V←A[;1;])/ZERO' 'M←≤/(DEG>∊1)/D]0450 [ EG' 'X←(M=DEG)/⌈∆DEG' 'J←X[(|V[X;M+1])⌈©/|V[X;M+1]]' '¸(J=1)/OK' 'A[1,J]0451 [ ;;]←A[J,1;;]' 'D←-D' 'OK:¸(∧/,0=W←1 0ÇA[;1;])/ENDLP' 'Q←(-1 0+∆U)×U←W R]0452 [ XQUOT A[1;1;]' 'R←TRAV((2×∆A),∊1×∆Q)∆Q' 'S←(∆A)∆A[1;;]' 'A←A RXDIFF R R]0453 [ XPROD S' '¸BACK' 'ENDLP:D←D RXPROD A[1;1;]' 'A←1 1 0ÇA' '¸LOOP' 'ZERO:D]0454 [X←,0' '¸0' 'END:D←D RXPROD A[1;1;]' ]0455 [<b style="color:green">∇ </b>RXDEGREE FX 'B←RXDEGREE A' '⍝ COMPUTES THE ARRAY OF DEGREES OF AN ARR]0456 [ AY OF' '⍝ REAL POLYNOMIALS.' '¸(0<∆∆A)/BEGIN' 'A←,A' 'BEGIN:B←∊1++/∧\∨0]0457 [X≠Aõ(|A)⎕EPSILONõ©/,|A' ]0458 [<b style="color:green">∇ </b>RXQUOT FX 'C←A RXQUOT B;IO;DB;N;K;L;R;I;F;D;E;RHO' '⍝ COMPUTES QUOTI]0459 [ ENTS IN THE EUCLIDEAN DOMAIN' '⍝ OF REAL POLYNOMIALS. THE REMAINDER IS]0460 [ SAVED' '⍝ IN THE GLOBAL VARIABLE a.' 'IO←0' 'EXPANDV' 'DERR∧/,0óDB←R]0461 [ XDEGREE B' 'N←õ/RHO←∆DB' 'L←K©(+/∊1×∆A)+©/R←(∊1+K←+/∊1×∆B)-,DB' 'B←(-R)]0462 [ ∨(N,K)∆B' 'A←(-R)∨(N,L)×(N,∊1×∆A)∆A' 'C←(N,I←1++/L-K)∆2-2' 'E←öB[;K-1]']0463 [ 'LOOP:¸(0>I←I-1)/END' 'C[;I]←F←A[;I+K-1]õE' 'A[;I+⌈K]←A[;I+⌈K]-Bõí(∨∆B]0464 [ )∆F' '¸LOOP' 'END:C←Cõ(|C)⎕EPSILONõ©/,|C' 'D←1©+/∧\∨∧ðC≠0' 'C←(RHO,D)∆(]0465 [ N,D)×C' 'A←Aõ(|A)⎕EPSILONõ©/(,|A),,|B' 'D←1©+/∧\∨∧ð0≠A←R∨A' 'a←(RHO,D)∆]0466 [X(N,D)×A' ]0467 [<b style="color:green">∇ </b>RXDIFF FX 'C←A RXDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS OF ]0468 [XREAL POLYNOMIALS.' 'C←A RXSUM-B' ]0469 [<b style="color:green">∇ </b>RXPROD FX 'C←A RXPROD B;IO;D' '⍝ COMPUTES THE ENTRY-BY-ENTRY PRODUCT]0470 [ OF TWO ARRAYS' '⍝ OF REAL POLYNOMIALS.' '¸NOTEST/BEGIN' 'EXPANDV' 'BEG]0471 [ IN:IO←0' 'C←(Aø.õ(∊1×∆B)∆1)õ((⌈∊1+∆∆A),0 ∊1+∆∆A)íBø.õ(∊1×∆A)∆1' 'C←C,(]0472 [ (∆A),∊1+∊1×∆A)∆0' 'C←+/[∊2+∆∆C]((∆A)∆-⌈∊1×∆A)∨C' 'C←Cõ(|C)⎕EPSILONõ©/,|]0473 [XC' 'D←1©©/,+/∧\∨C≠0' 'C←((∊1Ç∆C),D)×C' ]0474 [<b style="color:green">∇ </b>RXSUM FX 'C←A RXSUM B;M;D' '⍝ COMPUTES THE SUM OF TWO ARRAYS OF REAL ]0475 [ POLYNOMIALS.' '¸NOTEST/BEGIN' 'EXPANDV' 'BEGIN:M←(∆A)©∆B' 'C←(M×A)+M×B']0476 [X 'C←Cõ(|C)⎕EPSILONõ©/,|C' 'D←1©©/,+/∧\∨0≠C' 'C←((∊1Ç∆C),D)×C' ]0477 [<b style="color:green">∇ </b>RXEVAL FX 'Y←A RXEVAL B;IO' '⍝ EVALUATES THE REAL POLYNOMIALS IN A ]0478 [ AT B.' 'IO←0' 'B←((∆B),1)∆B' 'EXPANDV' 'B←(∊1Ç∆B)∆B' 'Y←+/AõBø.*⌈∊1×]0479 [X∆A' 'Y←Yõ(|Y)⎕EPSILONõ©/,|Y' ]0480 [<b style="color:green">∇ </b>RXFACTOR FX 'G←RXFACTOR F;IO;D;TOL;N;GCD;DF;r;s;H;S;ADDH;CENT;DEL;DE]0481 [ R;DH;DR;MAX;NEWR;a;A;CLOSE;CNT;I;ND;SQ;S2;U;VAL;X' '⍝ ATTEMPTS TO PRODU]0482 [ CE A LIST OF MONIC REAL' '⍝ IRREDUCIBLE POLYNOMIALS WHOSE PRODUCT IS TH]0483 [ E' '⍝ MONIC ASSOCIATE OF A GIVEN POLYNOMIAL.' 'IO←0' 'DERR∧/(1=∆∆F),,0]0484 [ <D←RXDEGREE F' 'TOL←EPSILONõ©/,|F←((D+1)×F)öF[D]' 'SQ←4 2∆1 1 ∊1 1 ∊1 ∊]0485 [ 1 1 ∊1' 'N←+/∧\0=F' 'G←(N,3)∆0 1 0' 'AGAIN:GCD←F RXGCD DF←1ÇFõ⌈∆F←NÇF' ]0486 [ 'DERR∧/TOL⎕|GCD RXDIFF(F RXPROD r)RXSUM DF RXPROD s' '¸(2<D←∆H←F RXQUOT]0487 [ GCD)/NONLIN' 'CENT←1 2∆2×-H[0]öH[1]' '¸CLEANUP' 'NONLIN:CENT←(2 2×SQ)õ]0488 [ S←0.5õ©/(∨Dõ|∊1ÇH)*ö1Ç⌈D' 'ADDH←|1ÇDHõ⌈∆DH←1ÇHõ⌈∆H' 'DH←DH,0' 'CLOSE←CN]0489 [ T←0' 'LOOP:¸(15<CNT←CNT+1)/CLEANUP' 'DER←VAL←(∆CENT)∆0' 'I←D' 'EVAL:¸(0]0490 [ >I←I-1)/DONE' 'VAL←((∆VAL)∆H[I],0)+(-/CENTõVAL),[0.5]+/CENTõ∨VAL' 'DER←]0491 [ ((∆DER)∆DH[I],0)+(-/CENTõDER),[0.5]+/CENTõ∨DER' '¸EVAL' 'DONE:X←~TOL⎕DR]0492 [ ←(ND←+/DERõDER)*0.5' 'DEL←(XðDERõ(∆DER)∆1 ∊1)öND,[0.5]ND←X/ND' 'DEL←(-/]0493 [ VALõDEL),[0.5]+/DELõ∨VAL←XðVAL' '¸CLOSE/NEWTON' 'MAX←(S2←Sõ1.415)+(+/Xð]0494 [ CENTõCENT)*0.5' 'MAX←(MAXø.*⌈∆ADDH)+.õADDH' 'NEWR←MAXõSõSöX/DR' 'X←(~X)]0495 [ ∧X\(NEWR+S2)⎕(+/DELõDEL)*0.5' 'CENT←(4 1õ∆CENT)∆0 2 1 2í(CENT←XðCENT)ø.]0496 [ +SQõS←Sö2' 'CLOSE←(8óCNT)∧(1×∆CENT)ó1×∆DER' '¸LOOP' 'NEWTON:CENT←(XðCEN]0497 [ T)-DEL' '¸(∧/,TOL⎕|VAL)/CLEANUP' '¸LOOP' 'CLEANUP:CENT←(CENT[;1]⎕0)ðCEN]0498 [ T' 'D←∆F' 'I←∊1' 'NEXT:¸((1×∆CENT)óI←I+1)/END' 'A←CENT[I;]' '¸(A[1]≠0)/]0499 [ COMPLEX' 'U←(-A[0]),1' '¸CHECK' 'COMPLEX:U←(+/AõA),(-2õA[0]),1' 'CHECK:]0500 [ ¸(~∧/TOL⎕|U RXREM F)/NEXT' 'G←G,[0]3×U' 'F←F RXQUOT U' '¸CHECK' 'END:DE]0501 [XRR D>∆F' '¸(1<∆F)/AGAIN' 'G←Gõ~(|G)óEPSILONõ©/,|G' ]0502 [<b style="color:green">∇ </b>RXGCD FX 'C←A RXGCD B;IO;M;U;V;R;RHO;I;Q;T;D;LA;LB;NOTEST;a' '⍝ COMP]0503 [ UTES MONIC GCD''S OF REAL POLYNOMIALS. THE' '⍝ RESULT C IS (r RXPRO]0504 [ D A) RXSUM s RXPROD B.' 'IO←1' 'A←Aõ(|A)⎕EPSILONõ©/,|A' 'B←Bõ(|B)⎕EPSI]0505 [ LONõ©/,|B' 'EXPANDV' 'M←1©+/∧\∨∧ð0≠((õ/∊1Ç∆A),∊1×∆A)∆A' 'M←M©+/∧\∨∧ð0≠(]0506 [ (õ/∊1Ç∆B),∊1×∆B)∆B' 'R←õ/RHO←∊1Ç∆A' 'NOTEST←1' 'A←(R,M)∆(RHO,M)×A RXPRO]0507 [ D LA←(RHO,1)∆öRXLEAD A' 'B←(R,M)∆(RHO,M)×B RXPROD LB←(RHO,1)∆öRXLEAD B']0508 [ 'U←((∆A)×(R,1)∆LA),[1]((∆A)∆0),[0.5]A' 'V←((∆B)∆0),[1]((∆B)×(R,1)∆LB),]0509 [ [0.5]B' 'I←⌈R' 'LOOP:¸(0=∆I←(∧/V[3;I;]≠0)/I)/END' 'Q←((∆I),M)×U[3;I;]RX]0510 [ QUOT V[3;I;]' 'T←(3,(∆I),M)×U[;I;]RXDIFF V[;I;]RXPROD(3,∆Q)∆Q' 'T[3;;]←]0511 [ T[3;;]õ(|T[3;;])⎕í(∨1Ç∆T)∆EPSILONõ©/|V[3;I;]' 'T←(∆T)×T RXPROD(3,(∆I),1]0512 [ )∆öRXLEAD T[3;;]' 'U[;I;]←V[;I;]' 'V[;I;]←T' '¸LOOP' 'END:D←1©+/∧\∨∧ð0≠]0513 [ U[3;;]' 'C←(RHO,D)∆(R,D)×U[3;;]' 'D←1©+/∧\∨∧ð0≠U[1;;]' 'r←(RHO,D)∆(R,D)]0514 [X×U[1;;]' 'D←1©+/∧\∨∧ð0≠U[2;;]' 's←(RHO,D)∆(R,D)×U[2;;]' ]0515 [<b style="color:green">∇ </b>RXREM FX 'C←A RXREM B;a;Q' '⍝ COMPUTES THE REMAINDER OF B MODULO A]0516 [ IN THE' '⍝ EUCLIDEAN DOMAIN OF REAL POLYNOMIALS.' 'Q←B RXQUOT A' 'C←a]0517 [X' ]0518 [<b style="color:green">∇ </b>RXFCLEAR FX 'RXFCLEAR;I' '⍝ EXPUNGES THE VARIABLE RXRT DESCRIBING THE]0519 [X CURRENT' '⍝ QUOTIENT ALGEBRA OF R[X].' 'I←EX ''RXRT''' ]0520 [<b style="color:green">∇ </b>RXFDIFF FX 'C←A RXFDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS I]0521 [XN THE' '⍝ CURRENT QUOTIENT ALGEBRA OF R[X].' 'C←A RXFSUM-B' ]0522 [<b style="color:green">∇ </b>RXFSUM FX 'C←A RXFSUM B;D;E' '⍝ COMPUTES THE SUM OF TWO ARRAYS OVER T]0523 [ HE CURRENT' '⍝ QUOTIENT ALGEBRA OF R[X].' 'D←∊1×∆C←A RXSUM B' 'DERR Dó+]0524 [ /∆RXRT' '¸(DóE←∊1×∆RXRT)/0' 'C←(((∊1Ç∆C),E)×C)+(((-∆∆C)×E)ÇC)+.õ((D-E),]0525 [XE)×RXRT' 'D←1©+/∧\∨∧ð((õ/∊1Ç∆C),E)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0526 [<b style="color:green">∇ </b>RXFINIT FX 'RXFINIT F;IO;D;I' '⍝ INITIALIZES THE CURRENT QUOTIENT AL]0527 [ GEBRA OF R[X].' 'IO←0' 'DERR 1õ∆∆F' 'DERR 1óD←∊1++/∧\∨0≠F' 'RXRT←((D-1]0528 [ ),D)∆-F←(öF[D])õD×F' 'I←0' 'LOOP:¸((D-1)óI←I+1)/0' 'RXRT[I;]←(0,∊1ÇRXRT]0529 [X[I-1;])-FõRXRT[I-1;D-1]' '¸LOOP' ]0530 [<b style="color:green">∇ </b>RXFINV FX 'r←RXFINV A;s;D;E' '⍝ COMPUTES INVERSES IN THE CURRENT QUOT]0531 [ IENT' '⍝ ALGEBRA OF R[X].' 'DERR(∊1×∆A)óE←∊1×∆RXRT' '¸(E=1)/SMALL' 'D←]0532 [XA RXGCD(-RXRT[IO;]),1' 'DERR∧/(,D=1),1=∊1×∆D' '¸0' 'SMALL:r←öA' ]0533 [<b style="color:green">∇ </b>RXFPOWER FX 'C←A RXFPOWER B;R;RHO;I;J;M;N;D' '⍝ COMPUTES THE B-TH POW]0534 [ ER OF A IN THE CURRENT' '⍝ QUOTIENT OF R[X].' 'B←((∆B),1)∆B' 'EXPAND]0535 [ V' 'DERR(M←∊1×∆A)óN←∊1×∆RXRT' 'R←õ/RHO←∊1Ç∆A' 'A←(R,N)×(R,M←∊1×∆A)∆A' ']0536 [ C←(R,N)∆N×1' 'I←(B>0)/⌈∆B←,B' 'LOOP:C[J;]←((∆J),N)×C[J;]RXFPROD A[J←(2|]0537 [ B[I])/I;]' '¸(0=∆I←(B[I]⎕2)/I)/END' 'A[I;]←((∆I),N)×A[I;]RXFPROD A[I;]']0538 [X 'B[I]←≤B[I]ö2' '¸LOOP' 'END:D←1©©/,+/∧\∨0≠C' 'C←(RHO,D)∆(R,D)×C' ]0539 [<b style="color:green">∇ </b>RXFPROD FX 'C←A RXFPROD B;D;E' '⍝ COMPUTES THE PRODUCT OF TWO ARRAYS ]0540 [ OVER THE' '⍝ CURRENT QUOTIENT ALGEBRA OF R[X].' 'C←A RXPROD B' 'DERR(D←]0541 [ ∊1×∆C)ó+/∆RXRT' '¸(DóE←∊1×∆RXRT)/0' 'C←(((∊1Ç∆C),E)×C)+(((-∆∆C)×E)ÇC)+.]0542 [Xõ((D-E),E)×RXRT' 'D←1©+/∧\∨∧ð((õ/∊1Ç∆C),E)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0543 [<b style="color:green">∇ </b>RXGCD0 FX 'C←A RXGCD0 B;M;R;RHO;I;T;D;NOTEST' '⍝ COMPUTES MONIC GCD'']0544 [ S OF REAL POLYNOMIALS WITHOUT' '⍝ EXPRESSING THE RESULT AS A LINEAR COM]0545 [ BINATION' '⍝ OF THE ARGUMENTS.' 'A←Aõ(|A)⎕EPSILONõ©/,|A' 'B←Bõ(|B)⎕EPSI]0546 [ LONõ©/,|B' 'EXPANDV' 'M←1©+/∧\∨0≠((õ/∊1Ç∆A),∊1×∆A)∆A' 'M←M©+/∧\∨0≠((õ/∊]0547 [ 1Ç∆B),∊1×∆B)∆B' 'I←⌈R←õ/RHO←∊1Ç∆A' 'NOTEST←1' 'A←(R,M)∆(RHO,M)×A RXPROD]0548 [ (RHO,1)∆öRXLEAD A' 'B←(R,M)∆(RHO,M)×B RXPROD(RHO,1)∆öRXLEAD B' 'LOOP:¸(]0549 [ 0=∆I←(∧/B[I;]≠0)/I)/END' 'T←((∆I),M)×B[I;]RXREM A[I;]' 'T←Tõ(|T)⎕EPSILO]0550 [ Nõ(©/|B[I;])ø.õM∆1' 'T←(∆T)×T RXPROD((∆I),1)∆öRXLEAD T' 'A[I;]←B[I;]' ']0551 [XB[I;]←T' '¸LOOP' 'END:D←1©+/∧\∨∧ð0≠A' 'C←(RHO,D)∆(R,D)×A' ]0552 [<b style="color:green">∇ </b>RXINTERP FX 'C←A RXINTERP B;IO;D' '⍝ INTERPOLATES REAL POLYNOMIALS. ]0553 [ THE VECTOR A' '⍝ GIVES THE VALUES OF THE ARGUMENT AND THE VECTORS' '⍝]0554 [ ALONG THE LAST AXIS OF B GIVE THE VALUES THE' '⍝ POLYNOMIALS ARE TO ]0555 [ HAVE.' 'DERR∧/(1=∆∆A),(0<∆A),(0<∆∆B),(∆A)=∊1×∆B' 'IO←0' 'C←B+.õíAø.*⌈]0556 [X∆A' 'C←Cõ(|C)⎕EPSILONõ©/,|C' 'D←1©©/,+/∧\∨0≠C' 'C←((∊1Ç∆C),D)×C' ]0557 [<b style="color:green">∇ </b>SSUB FX 'T←K SSUB N;X' '⍝ LISTS ALL K-ELEMENT SUBSETS OF ⌈N. ORIGIN ]0558 [ DEPENDENT.' 'DERR∧/(K⎕0),(KóN),(1=∆K),(1=∆N),(N=≤N←,N),K=≤K←,K' '¸(∧/K≠]0559 [ 0 1)/GENERAL' 'T←((K!N),K)∆⌈N' '¸0' 'GENERAL:T←1+(K-1)SSUB N-1' 'X←,T[;]0560 [XIO]ø.>⌈N-1' 'T←(X/(∆X)∆⌈N-1),T[X/,í((N-1),1×∆T)∆⌈1×∆T;]' ]0561 [<b style="color:green">∇ </b>SFEL FX 'R←SFEL A' '⍝ COMPUTES THE FIRST ELEMENTS IN THE SETS WHOSE' ]0562 [ '⍝ CHARACTERISTIC VECTORS ARE IN A.' '⍝ THE SETS MUST BE NONEMPTY.' '¸]0563 [XNOTEST/BEGIN' 'DERR(1ó∆∆A)∧∧/,∧/A' 'BEGIN:R←IO++/∧\~A' ]0564 [<b style="color:green">∇ </b>SSORT FX 'W←SSORT V' '⍝ SORTS A VECTOR INTO INCREASING ORDER AND REMO]0565 [XVES' '⍝ DUPLICATES.' 'DERR 1=∆∆V' 'W←(1,(1ÇW)>∊1ÇW)/W←V[ûV]' ]0566 [<b style="color:green">∇ </b>RXMATPROD FX 'C←A RXMATPROD B;IO;X;AX;BX;RR;D;NOTEST;RA;RB' '⍝ COMPU]0567 [ TES THE MATRIX PRODUCT OF TWO NONSCALAR ARRAYS' '⍝ OF REAL POLYNOMIALS.]0568 [ ' 'IO←1' 'DERR∧/2ó(∆∆A),∆∆B' 'DERR(∆A)[∊1+∆∆A]=1×∆B' 'C←((RA←∊2Ç∆A),(R]0569 [ B←∊1Ç1Ç∆B),1)∆0' 'X←1=⌈1×∆B' 'RR←((∆RA)+⌈∆RB),(⌈∆RA),∆∆C' 'NOTEST←1' 'L]0570 [ OOP:AX←RRí(RB,RA,∊1×∆A)∆X/[∊1+∆∆A]A' 'BX←((∊1Ç∆C),∊1×∆B)∆XðB' 'C←C RXSU]0571 [XM AX RXPROD BX' '¸(~1×X←∊1∨X)/LOOP' 'D←1©©/,+/∧\∨0≠C' 'C←((∊1Ç∆C),D)×C']0572 [<b style="color:green">∇ </b>RXPRODRED FX 'C←RXPRODRED A;IO;RHO;D;E;CC;L;M;NOTEST' '⍝ COMPUTES TH]0573 [ E PRODUCT REDUCTION ALONG THE LAST' '⍝ AXIS OF AN ARRAY OF REAL POLYNOM]0574 [ IALS.' '¸(1⎕∆∆C←A)/0' 'IO←1' 'L←õ/RHO←∊2Ç∆C' 'C←(L,∊2×∆C)∆C' '¸(0=(∆C)]0575 [ [2])/ZERO' 'NOTEST←1' 'LOOP:¸(1=D←(∆C)[2])/ONE' 'CC←((L,E,∊1×∆C)×C)RXPR]0576 [ OD(L,(-E←≤Dö2),∊1×∆C)×C' '¸(D≠2õE)/ODD' 'C←CC' '¸LOOP' 'ODD:M←(+/∧\∨∧ð0]0577 [ ≠C[;E+1;])©∊1×∆CC' 'C←((L,M)×C[;E+1;]),[2]((∊1Ç∆CC),M)×CC' '¸LOOP' 'ONE]0578 [X:C←(RHO,∊1×∆C)∆C' '¸0' 'ZERO:C←(RHO,1)∆1' ]0579 [<b style="color:green">∇ </b>RXREDUCE FX 'B←RXREDUCE A;IO;I;J;K;L;M;N;Q;E;D;Y;Z;U;V;X;a' '⍝ REDUC]0580 [ ES A MATRIX OF POLYNOMIALS IN R[X] USING' '⍝ ROW AND COLUMN OPERATION]0581 [ S. PRODUCES MATRICES r' '⍝ AND s SUCH THAT B IS THE MATRIX PRODU]0582 [ CT OF' '⍝ r, A AND s.' 'DERR 3=∆∆A' 'B←Aõ(|A)⎕EPSILONõ©/,|A' 'IO←0']0583 [ 'r←(K,K,1)∆1,(K←1×∆B)∆0' 's←(L,L,1)∆1,(L←(∆B)[1])∆0' 'I←∊1' 'LOOPI:¸(∧]0584 [ /∊1=D←,RXDEGREE((I,I←I+1),0)ÇB)/CLEANUP' 'V←I+((2×∆B)-I)D⌈≤/(D⎕0)/D' ']0585 [ X←B[J←V[0];K←V[1];]' 'COL:¸(∧/∊1=D←RXDEGREE X RXREM B[;K;])/ROW' 'L←D⌈≤]0586 [ /(D⎕0)/D' 'Q←B[L;K;]RXQUOT X' 'E←Q RXPROD B[J;;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊]0587 [ 1×∆E)×B' 'B[L;;]←B[L;;]-(1Ç∆B)×E' 'E←Q RXPROD r[J;;]' 'r←((∊1Ç∆r),(∊1×∆]0588 [ r)©∊1×∆E)×r' 'r[L;;]←r[L;;]-(1Ç∆r)×E' 'B←Bõ(|B)⎕EPSILONõ©/,|B' 'X←B[J←L]0589 [ ;K;]' '¸COL' 'ROW:¸(∧/∊1=D←RXDEGREE X RXREM B[J;;])/GENERAL' 'M←D⌈≤/(D⎕]0590 [ 0)/D' 'Q←B[J;M;]RXQUOT X' 'E←Q RXPROD B[;M;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E]0591 [ )×B' 'B[;M;]←B[;M;]-(∆B)[0 2]×E' 'E←Q RXPROD s[;M;]' 'S←((∊1Ç∆s),(∊1×∆s]0592 [ )©∊1×∆E)×s' 's[;M;]←s[;M;]-(∆s)[0 2]×E' 'B←Bõ(|B)⎕EPSILONõ©/,|B' 'X←B[J]0593 [ ;K←M;]' '¸COL' 'GENERAL:¸(∧/∊1=D←,RXDEGREE X RXREM(I,I,0)ÇB)/END' 'V←I+]0594 [ ((2×∆B)-I)D⌈≤/(D⎕0)/D' 'Q←B[L←V[0];K;]RXQUOT X' 'E←Q RXPROD B[J;;]' 'B]0595 [ ←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[L;;]←B[L;;]-(1Ç∆B)×E' 'E←Q RXPROD r[J;;]]0596 [ ' 'r←((∊1Ç∆r),(∊1×∆r)©∊1×∆E)×r' 'r[L;;]←r[L;;]-(1Ç∆r)×E' 'Q←B[L;M←V[1];]0597 [ ]RXQUOT X' 'E←Q RXPROD B[;K;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[;M;]←B[]0598 [ ;M;]-(∆B)[0 2]×E' 'E←Q RXPROD s[;K;]' 's←((∊1Ç∆s),(∊1×∆s)©∊1×∆E)×s' 's[]0599 [ ;M;]←s[;M;]-(∆s)[0 2]×E' 'B←Bõ(|B)⎕EPSILONõ©/,|B' 'X←B[J←L;K←M;]' '¸COL]0600 [ ' 'END:B[I,J;;]←B[J,I;;]' 'r[I,J;;]←r[J,I;;]' 'B[;I,K;]←B[;K,I;]' 's[;I]0601 [ ,K;]←s[;K,I;]' 'B[I;;]←B[I;;]õU←öRXLEAD X' 'r[I;;]←r[I;;]õU' 'Q←B[Y←(I+]0602 [ 1)Ç⌈1×∆B;I;]RXQUOT B[I;I;]' 'E←(1 0 2í((∆B)[1],∆Q)∆Q)RXPROD((1×∆Q),1Ç∆B]0603 [ )∆B[I;;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[Y;;]←B[Y;;]-((∆Y),1Ç∆B)×E' ']0604 [ E←(1 0 2í((∆r)[1],∆Q)∆Q)RXPROD((1×∆Q),1Ç∆r)∆r[I;;]' 'r←((∊1Ç∆r),(∊1×∆r)]0605 [ ©∊1×∆E)×r' 'r[Y;;]←r[Y;;]-((∆Y),1Ç∆r)×E' 'Q←B[I;Z←(I+1)Ç⌈(∆B)[1];]RXQUO]0606 [ T B[I;I;]' 'B[I;Z;]←0' 'E←(1 0 2í((1×∆Q),(∆s)[0 2])∆s[;I;])RXPROD((1×∆s]0607 [ ),∆Q)∆Q' 's←((∊1Ç∆s),(∊1×∆s)©∊1×∆E)×s' 's[;Z;]←s[;Z;]-((1×∆s),(∆Z),∊1×∆]0608 [ s)×E' 'B←Bõ(|B)⎕EPSILONõ©/,|B' '¸LOOPI' 'CLEANUP:D←1©+/∧\∨∧ð∧ð0≠B' 'B←(]0609 [ (∊1Ç∆B),D)×B' 'D←1©+/∧\∨∧ð∧ð0≠r' 'r←((∊1Ç∆r),D)×r' 'D←1©+/∧\∨∧ð∧ð0≠s' ']0610 [Xs←((∊1Ç∆s),D)×s' ]0611 [<b style="color:green">∇ </b>RXROWREDUCE FX 'B←RXROWREDUCE A;IO;I;J;K;L;C;D;M;a' '⍝ ROW REDUCES A ]0612 [ MATRIX OF POLYNOMIALS IN R[X].' '⍝ PRODUCES AN INVERTIBLE MATRIX r' ']0613 [ ⍝ OF POLYNOMIALS SUCH THAT B IS r RXMATPROD A.' '⍝ THE VECTOR v LI]0614 [ STS THE COLUMNS OF THE CORNER' '⍝ ENTRIES OF B.' 'DERR 3=∆∆A' 'B←A' 'I]0615 [ O←IO' 'IO←1' 'v←⌈0' 'r←(K,K,1)∆1,(K←1×∆B)∆I←J←0' 'LOOP:¸((J⎕1×∆B)∧(∆B]0616 [ )[2]<I←I+1)/END' 'BACK:¸(0=∆D←(C⎕0)/C←RXDEGREE(J,0)ÇB[;I;])/LOOP' 'K←J+]0617 [ C⌈≤/D' 'C←B[;I;]RXQUOT B[K;I;]' 'C[K;]←0' 'D←2 1 3í((∆B)[2],∆C)∆C' 'B←B]0618 [ RXDIFF D RXPROD(∆B)∆B[K;;]' 'D←2 1 3í((∆r)[2],∆C)∆C' 'r←r RXDIFF D RXP]0619 [ ROD(∆r)∆r[K;;]' '¸(1<+/∧/0≠(J,0)ÇB[;I;])/BACK' 'v←v,I' 'B[J,K;;]←B[K,J←]0620 [ J+1;;]' 'r[J,K;;]←r[K,J;;]' 'B[J;;]←B[J;;]õM←öRXLEAD B[J;I;]' 'r[J;;]←r]0621 [X[J;;]õM' '¸LOOP' 'END:v←v-1-IO←IO' ]0622 [<b style="color:green">∇ </b>SCHV FX 'A←N SCHV S;RS' '⍝ COMPUTES THE CHARACTERISTIC VECTORS OF AN ]0623 [ ARRAY OF INTEGER' '⍝ VECTORS LISTING SUBSETS OF ⌈N. ORIGIN DEPENDENT.]0624 [ ' '¸NOTEST/BEGIN' 'DERR∧/(N>0),(N=≤N),1=∆N←,N' 'DERR∧/(,S=≤S),(,S⎕IO),]0625 [ ,S<IO+N' '¸(0<∆∆S)/BEGIN' 'S←,S' 'BEGIN:A←(Nõõ/RS←∊1Ç∆S)∆0' 'S←((õ/RS)]0626 [ ,∊1×∆S)∆S' 'A[IO+N((õ/∆S)∆(⌈1×∆S)-IO),[IO-0.5],íS-IO]←1' 'A←(RS,N)]0627 [X∆A' ]0628 [<b style="color:green">∇ </b>SEQREL FX 'T←SEQREL E;X;NT' '⍝ TESTS IF E IS THE CHARACTERISTIC MATRI]0629 [ X OF AN' '⍝ EQUIVALENCE RELATION ON ⌈1×∆E. E MUST BE A' '⍝ SQUARE LO]0630 [ GICAL MATRIX.' '¸NOTEST/BEGIN' 'DERR∧/(2=∆∆E),(=/∆E),,Eî0 1' 'BEGIN:¸(~]0631 [ T←∧/(2∆IO)íE)/0' 'NT←NOTEST' 'NOTEST←1' 'T←∧/,E=Xø.=X←SFEL E' 'NOTEST←]0632 [XNT' ]0633 [<b style="color:green">∇ </b>RDET FX 'D←RDET A;IO;K;M;I;J;X;Y' '⍝ COMPUTES AN APPROXIMATION TO TH]0634 [ E DETERMINANT OF' '⍝ THE REAL MATRIX A.' 'DERR(2=∆∆A)∧=/∆A' 'D←IO←1' ]0635 [ 'LOOP:¸(0=K←1×∆A)/0' 'A←Aõ(|A)⎕EPSILONõM←©/,|A' '¸(M=0)/ZERO' 'I←(©/|A)]0636 [ ⌈M' 'J←(|A[I;])⌈M' 'D←DõA[I;J]õ∊1*I+J' 'X←A[I;]öA[I;J]' 'A←(I≠⌈K)ðA' 'A]0637 [X←(J≠⌈K)/A-A[;J]ø.õX' '¸LOOP' 'ZERO:D←0' ]0638 [<b style="color:green">∇ </b>RLSYS FX 'C←A RLSYS B;T;X;r;v' '⍝ SOLVES LINEAR SYSTEMS OVER R. PRO]0639 [ DUCES AN ARRAY C' '⍝ SUCH THAT A+.õC IS B AND A MATRIX w WHOSE' ]0640 [ '⍝ ROWS SPAN THE SOLUTION SPACE OF THE CORRESPONDING' '⍝ HOMOGENEOUS SY]0641 [ STEM.' 'DERR∧/(2=∆∆A),(1ó∆∆B),(1×∆A)=1×∆B' 'A←RROWREDUCE A' 'B←Bõ(|B)⎕E]0642 [ PSILONõ©/(,|A),,|B←r+.õB' 'DERR∧/,0=((∆v),(∊1+∆∆B)∆0)ÇB' 'X←(~T←(∊1×∆A)]0643 [ SCHV v)/⌈∊1×∆A' 'w←((∆X),∆T)∆0' 'w[;X]←Xø.=X' 'w[;v]←í-A[⌈∆v;X]' 'C←Tñ(]0644 [X(∆v),1Ç∆B)×B' ]0645 [<b style="color:green">∇ </b>RROWREDUCE FX 'B←RROWREDUCE A;IO;I;J;K;L;M;F;X' '⍝ ROW REDUCES THE RE]0646 [ AL MATRIX B. PRODUCES r, AN' '⍝ INVERTIBLE REAL MATRIX SUCH THAT B ]0647 [ IS r+.õA.' '⍝ THE VECTOR v LISTS THE COLUMNS CONTAINING THE' '⍝ COR]0648 [ NER ENTRIES OF B.' 'DERR 2=∆∆B←Aõ(|A)⎕EPSILONõ©/,|A' 'IO←IO' 'IO←1' ]0649 [ 'L←∊1×∆B' 'r←(K,K)∆1,(K←1×∆B)∆0' 'v←⌈I←J←0' 'LOOP:¸((J⎕K)∧L<I←I+1)/END']0650 [ '¸(0=M←©/C←|JÇB[;I])/LOOP' 'v←v,I' 'X←J+C⌈M' 'B[J,X;]←B[X,J←J+1;]' 'r[]0651 [ J,X;]←r[X,J;]' 'B[J;]←B[J;]õM←öB[J;I]' 'r[J;]←r[J;]õM' 'F←(J≠⌈K)õB[;I]']0652 [ 'B←Bõ(|B)⎕EPSILONõ©/,|B←B-Fø.õB[J;]' 'r←r-Fø.õr[J;]' '¸LOOP' 'END:v←v-]0653 [X1-IO←IO' 'r←rõ(|r)⎕EPSILONõ©/,|r' ]0654 [<b style="color:green">∇ </b>TRAV FX 'B←TRAV A;R' '⍝ TRANSPOSES AN ARRAY OF VECTORS.' '¸(1⎕∆∆A)/SM]0655 [XALL' 'R←⌈∆∆A' 'B←((∨∊1ÇR),∊1×R)íA' '¸0' 'SMALL:B←A' ]0656 [<b style="color:green">∇ </b>ZGCD0 FX 'C←A ZGCD0 B;RHO;T;I' '⍝ COMPUTES INTEGER GCD''S WITH A MINI]0657 [ MUM AMOUNT OF' '⍝ CHECKING AND WITHOUT EXPRESSING THE RESULT AS A' '⍝ L]0658 [ INEAR COMBINATION OF THE ARGUMENTS.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A),,B=]0659 [ ≤B' 'EXPAND' 'BEGIN:RHO←∆A' 'I←⌈∆A←|,A' 'B←|,B' 'LOOP:¸(0=∆I←(B[I]≠0)/I]0660 [X)/END' 'T←B[I]|A[I]' 'A[I]←B[I]' 'B[I]←T' '¸LOOP' 'END:C←RHO∆A' ]0661 [<b style="color:green">∇ </b>ZXDEGREE FX 'B←ZXDEGREE A' '⍝ COMPUTES THE ARRAY OF DEGREES OF AN ARR]0662 [ AY OF INTEGER' '⍝ POLYNOMIALS.' '¸NOTEST/BEGIN' 'DERR∧/,A=≤A' '¸(0<∆∆A)]0663 [X/BEGIN' 'A←,A' 'BEGIN:B←∊1++/∧\∨A≠0' ]0664 [<b style="color:green">∇ </b>ZFACTOR FX 'P←ZFACTOR N;Q;R;IO' '⍝ FACTORS A POSITIVE INTEGER INTO A]0665 [ PRODUCT OF PRIMES.' '⍝ THE RESULT IS CORRECT IF N IS LESS THAN 2.5E9]0666 [ .' 'DERR∧/(N=≤N),(1óN),1=∆N←,N' 'P←⌈IO←0' 'Q←2 3 5,R←,(30õ⌈77≤©(N*0.5)]0667 [ ö30)ø.+7 11 13 17 19 23 29 31' 'LOOP:¸(0=∆Q←(0=Q|N)/Q)/NEXT' 'P←P,1×Q' ]0668 [ '¸LOOP,N←≤NöQ[0]' 'NEXT:¸(N=1)/0' '¸((∊1×R)⎕50000≤N*0.5)/END' '¸(R[0]≠7]0669 [X)/GEN' 'R←(∧ð0≠7 11ø.|R)/R' 'GEN:Q←R←R+2310' '¸LOOP' 'END:P←P,N' ]0670 [<b style="color:green">∇ </b>ZNDET FX 'D←ZNDET A;IO;V;J;W;Q' '⍝ COMPUTES THE DETERMINANT OF AN IN]0671 [ TEGER MATRIX' '⍝ USING INTEGER ROW OPERATIONS MODULO n.' 'DERR∧/(n<100]0672 [ 00000),(,A=≤A),(2=∆∆A),=/∆A←n|A' 'D←IO←1' '¸(0=1×∆A)/0' 'LOOP:¸(1=1×∆A]0673 [ )/END' 'BACK:¸(∧/0=V←A[;1])/ZERO' 'J←V⌈≤/(V≠0)/V' '¸(J=1)/OK' 'A[1,J;]←]0674 [ A[J,1;]' 'D←n|-D' 'OK:¸(∧/0=W←1ÇA[;1])/ENDLP' 'Q←0,≤WöA[1;1]' 'A←n|A-Qø]0675 [ .õA[1;]' '¸BACK' 'ENDLP:D←n|DõA[1;1]' 'A←1 1ÇA' '¸LOOP' 'ZERO:¸D←0' 'EN]0676 [XD:D←n|DõA[1;1]' ]0677 [<b style="color:green">∇ </b>ZACLEAR FX 'ZACLEAR;I' '⍝ EXPUNGES THE ARRAY OF STRUCTURE CONSTANTS F]0678 [XOR' '⍝ THE CURRENT Z-ALGEBRA.' 'I←EX ''ZSC''' ]0679 [<b style="color:green">∇ </b>ZADIFF FX 'C←A ZADIFF B' '⍝ COMPUTES DIFFERENCES IN THE CURRENT Z-ALG]0680 [XEBRA.' 'C←A ZASUM-B' ]0681 [<b style="color:green">∇ </b>ZASUM FX 'C←A ZASUM B' '⍝ COMPUTE SUMS IN THE CURRENT Z-ALGEBRA.' 'A←]0682 [XZANRMLZ A' 'B←ZANRMLZ B' 'EXPANDV' 'C←A+B' ]0683 [<b style="color:green">∇ </b>ZANRMLZ FX 'C←ZANRMLZ A;IO' '⍝ RETURNS THE STANDARD REPRESENTATION O]0684 [<b style="color:green">∇ </b> AN ARRAY' '⍝ OVER THE THE CURRENT Z-ALGEBRA. SCALARS AND' '⍝ VECTORS]0685 [ OF LENGTH 1 ARE PADDED WITH ZEROS.' 'IO←1' 'DERR∧/(,A=≤A),(0=∆∆A)∧(1=]0686 [ ∊1×∆A)∧(1×∆ZSC)=∊1×∆A' 'C←((∆A),⌈0=∆∆A)∆A' '¸((1×∆ZSC)=∊1×∆C)/0' 'C←((∊]0687 [X1Ç∆C),1×∆ZSC)×C' ]0688 [<b style="color:green">∇ </b>ZAINIT FX 'ZAINIT A' '⍝ INITIALIZES THE ARRAY OF STRUCTURE CONSTANTS']0689 [ '⍝ FOR THE CURRENT Z-ALGEBRA.' 'DERR∧/(3=∆∆A),((1Ç∆A)=∊1Ç∆A),,A=≤A' 'Z]0690 [XSC←A' ]0691 [<b style="color:green">∇ </b>ZANEG FX 'C←ZANEG A' '⍝ COMPUTES NEGATIVES IN THE CURRENT Z-ALGEBRA.']0692 [X 'C←ZANRMLZ-A' ]0693 [<b style="color:green">∇ </b>ZAPOWER FX 'C←A ZAPOWER B;R;RHO;I;J;M' '⍝ COMPUTES THE B-TH POWER OF ]0694 [ A IN THE CURRENT' '⍝ Z-ALGEBRA.' 'DERR∧/(,B=≤B),,B⎕0' 'A←ZANRMLZ A' ']0695 [ B←((∆B),1)∆B' 'EXPANDV' 'R←õ/∊1ÇRHO←∆A' 'A←(R,M←∊1×∆A)∆A' 'C←(∆A)∆M×1' ]0696 [ 'I←(B>0)/⌈∆B←,B' 'LOOP:C[J;]←C[J;]ZAPROD A[J←(2|B[I])/I;]' '¸(0=∆I←(B[I]0697 [ ]⎕2)/I)/END' 'A[I;]←A[I;]ZAPROD A[I;]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:C←RH]0698 [XO∆C' ]0699 [<b style="color:green">∇ </b>ZAPROD FX 'C←A ZAPROD B;IO;R;RHO;M' '⍝ COMPUTES PRODUCTS IN THE CURR]0700 [ ENT Z-ALGEBRA.' 'A←ZANRMLZ A' 'B←ZANRMLZ B' 'EXPANDV' 'R←õ/∊1ÇRHO←∆A' ']0701 [ IO←0' 'M←∊1×∆ZSC' 'A←(R,MõM)∆2 0 1í(M,R,M)∆A' 'B←(R,MõM)∆1 0 2í(M,R,M)]0702 [X∆B' 'C←AõB' 'C←RHO∆C+.õ((MõM),M)∆ZSC' ]0703 [<b style="color:green">∇ </b>ZCHREM FX 'C←A ZCHREM B;IO;r;s;RHO;D;L;M;N;B1;B2;A1;F;E;X' '⍝ SOLVES]0704 [ THE SIMULTANEOUS CONGRUENCE C CONGRUENT' '⍝ TO THE I-TH CROSS SECTIO]0705 [ N OF A ALONG THE LAST AXIS' '⍝ MODULO B[I]. THE VARIABLE B MUST BE A ]0706 [ VECTOR AND' '⍝ THE LCM OF THE COMPONENTS OF B IN COMPUTED AS m.' 'I]0707 [ O←1' 'X←∧/(1=∆∆B),(1ó∆∆A),((∊1×∆A)=∆B),(0<∆B),,0≠B←|B' 'DERR∧/X,(,B=≤B)]0708 [ ,,A=≤A' 'A←((N←õ/RHO←∊1Ç∆A),∊1×∆A)∆A' 'LOOP:¸(1=M←∆B)/END' 'L←B1õ≤B2öD←]0709 [ (B1←E×B)ZGCD B2←(-E←≤Mö2)×B' 'DERR∧/,0=((∆F)∆D)|F←((N,-E)×A)-A1←(N,E)×A]0710 [ ' 'B←B[X←(E+1)õ⌈M≠2õE],L' 'A←(A[;X]),((∆F)∆L)|A1+(≤Fö(∆F)∆D)õ(∆F)∆rõB1']0711 [X '¸LOOP' 'END:m←B[1]' 'C←RHO∆A' ]0712 [<b style="color:green">∇ </b>ZGCD FX 'C←A ZGCD B;IO;RHO;M;U;V;I;Q;T' '⍝ C IS RETURNED AS THE ENT]0713 [ RY-BY-ENTRY GCD OF THE INTEGER' '⍝ ARRAYS A AND B.' '⍝ THE VARIABLES]0714 [ r AND s EXPRESS C AS(rõA)+sõB.' 'IO←1' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A)]0715 [ ,,B=≤B' '⍝ TEST FOR CONFORMABILITY.' 'EXPAND' '⍝ REPLACE A AND B BY]0716 [ THEIR RAVELS AND' '⍝ APPLY THE EUCLIDEAN ALGORITHM.' 'BEGIN:M←õ/RHO←∆A]0717 [ ' 'U←(3,M)∆(õA),(M∆0),|A←,A' 'V←(∆U)∆(M∆0),(õB),|B←,B' 'I←⌈M' 'LOOP:¸(0]0718 [ =∆I←(V[3;I]≠0)/I)/END' 'T←U[;I]-V[;I]õ(3,∆I)∆≤U[3;I]öV[3;I]' 'U[;I]←V[;]0719 [XI]' 'V[;I]←T' '¸LOOP' 'END:C←RHO∆U[3;]' 'r←RHO∆U[1;]' 's←RHO∆U[2;]' ]0720 [<b style="color:green">∇ </b>ZDET FX 'D←ZDET A;IO;V;J;W;Q' '⍝ COMPUTES THE DETERMINANT OF AN INTE]0721 [ GER MATRIX' '⍝ USING INTEGER ROW OPERATIONS.' 'DERR∧/(,A=≤A),(2=∆∆A),=/]0722 [ ∆A' 'D←IO←1' '¸(0=1×∆A)/0' 'LOOP:¸(1=1×∆A)/END' 'BACK:¸(∧/0=V←|A[;1])/]0723 [ ZERO' 'J←V⌈≤/(V≠0)/V' '¸(J=1)/OK' 'A[1,J;]←A[J,1;]' 'D←-D' 'OK:¸(∧/0=W←]0724 [ 1ÇA[;1])/ENDLP' 'Q←0,(≤Wö|A[1;1])õõA[1;1]' 'A←A-Qø.õA[1;]' '¸BACK' 'END]0725 [XLP:D←DõA[1;1]' 'A←1 1ÇA' '¸LOOP' 'ZERO:¸D←0' 'END:D←DõA[1;1]' ]0726 [<b style="color:green">∇ </b>ZLCM FX 'C←A ZLCM B' '⍝ COMPUTES THE ENTRY-BY-ENTRY LCM OF THE' '⍝ IN]0727 [XTEGER ARRAYS A AND B.' 'C←(C≠0)õ≤(C←|AõB)öA ZGCD0 B' ]0728 [<b style="color:green">∇ </b>ZLSYS FX 'C←A ZLSYS B;IO;M;D;Q;r;s' '⍝ SOLVES LINEAR SYSTEMS OVER TH]0729 [ E INTEGERS.' '⍝ A IS THE MATRIX OF COEFFICIENTS AND THE VECTORS' '⍝ OF]0730 [ CONSTANT TERMS ARE THE VECTORS ALONG THE FIRST' '⍝ AXIS OF B. THE RO]0731 [ WS OF THE GLOBAL ARRAY w' '⍝ ARE A BASIS FOR THE SOLUTIONS OF THE CORR]0732 [ ESPONDING' '⍝ HOMOGENEOUS SYSTEM.' 'IO←1' 'DERR∧/(2=∆∆A),(,A=≤A),(,B=≤]0733 [ B),(1ó∆∆B),(1×∆A)=1×∆B' 'D←(M←+/D≠0)×D←1 1íA←ZREDUCE A' 'DERR∧/,0=(M,(∊]0734 [ 1+∆∆B)∆0)ÇB←r+.õB' 'w←í(0,M)Çs' 'DERR∧/0=(Q←í(∨∆B)∆D)|B←(M,1Ç∆B)×B' 'C←]0735 [X(((1×∆s),M)×s)+.õ≤BöQ' ]0736 [<b style="color:green">∇ </b>ZREDUCE FX 'B←ZREDUCE A;IO;I;J;K;L;M;Q;D;Y;Z;X;V' '⍝ REDUCES AN INTE]0737 [ GER MATRIX. PRODUCES INVERTIBLE' '⍝ INTEGER MATRICES r AND s SUCH ]0738 [ THAT B IS' '⍝ THE MATRIX PRODUCT OF r, A AND s.' 'IO←0' 'DERR∧/(]0739 [ 2=∆∆A),,B=≤B←A' 'r←(K,K)∆1,(K←1×∆B)∆0' 's←(L,L)∆1,(L←1Ç∆B)∆0' 'I←∊1' 'L]0740 [ OOPI:¸(∧/0=D←|,(I,I←I+1)ÇB)/0' 'V←I+((∆B)-I)D⌈≤/(D≠0)/D' 'X←B[J←V[0];K]0741 [ ←V[1]]' 'COL:¸(∧/0=D←|X|B[;K])/ROW' 'L←D⌈≤/(D≠0)/D' 'B[L;]←B[L;]-(Q←≤(B]0742 [ [L;K]-X|B[L;K])öX)õB[J;]' 'r[L;]←r[L;]-Qõr[J;]' 'X←B[J←L;K]' '¸COL' 'RO]0743 [ W:¸(∧/0=D←|X|B[J;])/GENERAL' 'M←D⌈≤/(D≠0)/D' 'B[;M]←B[;M]-(Q←≤(B[J;M]-X]0744 [ |B[J;M])öX)õB[;K]' 's[;M]←s[;M]-Qõs[;K]' 'X←B[J;K←M]' '¸COL' 'GENERAL:¸]0745 [ (∧/0=D←|X|,(I,I)ÇB)/END' 'V←I+((∆B)-I)D⌈≤/(D≠0)/D' 'B[L;]←B[L;]-(Q←∊1+]0746 [ ≤B[L←V[0];K]öX)õB[J;]' 'r[L;]←r[L;]-Qõr[J;]' 'B[;M]←B[;M]-(Q←≤(B[L;M]-X]0747 [ |B[L;M←V[1]])öX)õB[;K]' 's[;M]←s[;M]-Qõs[;K]' 'X←B[J←L;K←M]' '¸COL' 'EN]0748 [ D:B[I,J;]←B[J,I;]' 'r[I,J;]←r[J,I;]' 'B[;I,K]←B[;K,I]' 's[;I,K]←s[;K,I]]0749 [ ' 'B[I;]←B[I;]õõX' 'r[I;]←r[I;]õõX' 'B[Y;]←B[Y;]-(Q←≤B[Y←(I+1)Ç⌈1×∆B;I]]0750 [ öB[I;I])ø.õB[I;]' 'r[Y;]←r[Y;]-Qø.õr[I;]' 'B[;Z]←B[;Z]-B[;I]ø.õQ←≤B[I;Z]0751 [X←(I+1)Ç⌈1Ç∆B]öB[I;I]' 's[;Z]←s[;Z]-s[;I]ø.õQ' '¸LOOPI' ]0752 [<b style="color:green">∇ </b>ZMATINV FX 'C←ZMATINV A;IO;B;r;v' '⍝ COMPUTES THE INVERSE OF THE SQU]0753 [ ARE INTEGER' '⍝ MATRIX A, WHICH MUST HAVE DETERMINANT 1 OR ∊1.' 'DERR∧]0754 [X/(2=∆∆A),=/∆A' 'IO←1' 'B←ZROWREDUCE A' 'DERR∧/1=1 1íB' 'C←r' ]0755 [<b style="color:green">∇ </b>ZROWREDUCE FX 'B←ZROWREDUCE A;IO;I;J;K;L;D;E;F;X;Y;N;M' '⍝ ROW REDUCE]0756 [ S THE INTEGER MATRIX A. PRODUCES r, AN' '⍝ INVERTIBLE INTEGER MATRIX]0757 [ SUCH THAT B IS r+.õA.' '⍝ ALSO PRODUCES A VECTOR v LISTING THE COLU]0758 [ MNS CONTAINING' '⍝ THE CORNER ENTRIES OF B.' 'DERR∧/(2=∆∆A),,A=≤A' 'IO←]0759 [ IO' 'IO←1' 'L←∊1×∆B←A' 'r←(K,K)∆1,(K←1×∆B)∆0' 'v←⌈I←J←0' 'LOOP:¸((J⎕K]0760 [ )∧L<I←I+1)/END' 'BACK:¸(0=∆D←(E≠0)/E←|JÇB[;I])/LOOP' 'X←J+E⌈N←≤/D' 'F←(]0761 [ (X≠Y←JÇ⌈K)õJÇB[;I])ZQUOT B[X;I]' 'B[Y;]←((J,0)ÇB)-Fø.õB[X;]' 'r[Y;]←((J]0762 [ ,0)Çr)-Fø.õr[X;]' '¸(1<+/0≠JÇB[;I])/BACK' 'v←v,I' 'B[J,X;]←B[X,J←J+1;]']0763 [ 'r[J,X;]←r[X,J;]' 'B[J;]←B[J;]õM←õB[J;I]' 'r[J;]←r[J;]õM' 'F←B[Y←⌈J-1;]0764 [ I]ZQUOT B[J;I]' 'B[Y;]←B[Y;]-Fø.õB[J;]' 'r[Y;]←r[Y;]-Fø.õr[J;]' '¸LOOP']0765 [X 'END:v←v-1-IO←IO' ]0766 [<b style="color:green">∇ </b>ZQUOT FX 'C←A ZQUOT B' '⍝ COMPUTES THE INTEGER QUOTIENT OF TWO INTEGE]0767 [XR ARRAYS.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A),,B=≤B' 'BEGIN:C←(≤Aö|B)õõB' ]0768 [<b style="color:green">∇ </b>ZNACLEAR FX 'ZNACLEAR;I' '⍝ EXPUNGES THE ARRAY OF STRUCTURE CONSTANTS]0769 [X' '⍝ FOR THE CURRENT ZN-ALGEBRA.' 'I←EX ''ZNSC''' ]0770 [<b style="color:green">∇ </b>ZNADIFF FX 'C←A ZNADIFF B' '⍝ COMPUTES DIFFERENCES IN THE CURRENT ZN-]0771 [XALGEBRA.' 'C←A ZNASUM-B' ]0772 [<b style="color:green">∇ </b>ZNASUM FX 'C←A ZNASUM B' '⍝ COMPUTE SUMS IN THE CURRENT ZN-ALGEBRA.' ]0773 [X'A←ZNANRMLZ A' 'B←ZNANRMLZ B' 'EXPANDV' 'C←n|A+B' ]0774 [<b style="color:green">∇ </b>ZNANRMLZ FX 'C←ZNANRMLZ A;IO' '⍝ RETURNS THE STANDARD REPRESENTATION]0775 [ OF AN ARRAY' '⍝ OVER THE THE CURRENT ZN-ALGEBRA. SCALARS AND' '⍝ VECT]0776 [ ORS OF LENGTH 1 ARE PADDED WITH ZEROS.' 'IO←1' 'DERR∧/(,A=≤A),(0=∆∆A)∧]0777 [ (1=∊1×∆A)∧(1×∆ZNSC)=∊1×∆A' 'C←((∆A),⌈0=∆∆A)∆n|A' '¸((1×∆ZNSC)=∊1×∆C)/0']0778 [X 'C←((∊1Ç∆C),1×∆ZNSC)×C' ]0779 [<b style="color:green">∇ </b>ZNAINIT FX 'ZNAINIT A' '⍝ INITIALIZES THE ARRAY OF STRUCTURE CONSTANT]0780 [ S' '⍝ FOR THE CURRENT ZN-ALGEBRA.' 'DERR∧/(3=∆∆A),((1Ç∆A)=∊1Ç∆A),,A=≤A']0781 [X 'ZNSC←n|A' ]0782 [<b style="color:green">∇ </b>ZNANEG FX 'C←ZNANEG A' '⍝ COMPUTES NEGATIVES IN THE CURRENT ZN-ALGEBR]0783 [XA.' 'C←ZNANRMLZ n|-A' ]0784 [<b style="color:green">∇ </b>ZNAPOWER FX 'C←A ZNAPOWER B;R;RHO;I;J;M' '⍝ COMPUTES THE B-TH POWER O]0785 [<b style="color:green">∇ </b> A IN THE CURRENT' '⍝ ZN-ALGEBRA. n MUST NOT EXCEED 1E7.' 'DERR∧/(]0786 [ nó1000000),(,B=≤B),,B⎕0' 'A←ZNANRMLZ A' 'B←((∆B),1)∆B' 'EXPANDV' 'R←õ/∊]0787 [ 1ÇRHO←∆A' 'A←(R,M←∊1×∆A)∆A' 'C←(∆A)∆M×1' 'I←(B>0)/⌈∆B←,B' 'LOOP:C[J;]←C]0788 [ [J;]ZNAPROD A[J←(2|B[I])/I;]' '¸(0=∆I←(B[I]⎕2)/I)/END' 'A[I;]←A[I;]ZNAP]0789 [XROD A[I;]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:C←RHO∆C' ]0790 [<b style="color:green">∇ </b>ZNAPROD FX 'C←A ZNAPROD B;IO;R;RHO;M' '⍝ COMPUTES PRODUCTS IN THE CU]0791 [ RRENT ZN-ALGEBRA.' '⍝ n MUST NOT EXCEED 1E7.' 'DERR nó10000000' 'A←ZNA]0792 [ NRMLZ A' 'B←ZNANRMLZ B' 'EXPANDV' 'R←õ/∊1ÇRHO←∆A' 'IO←0' 'M←∊1×∆ZNSC' ]0793 [ 'A←(R,MõM)∆2 0 1í(M,R,M)∆A' 'B←(R,MõM)∆1 0 2í(M,R,M)∆B' 'C←n|AõB' 'C←RH]0794 [XO∆n|C+.õ((MõM),M)∆ZNSC' ]0795 [<b style="color:green">∇ </b>ZNDIFF FX 'C←A ZNDIFF B' '⍝ COMPUTES THE DIFFERENCE OF A AND B MO]0796 [ DULO n.' '⍝ A AND B MUST BE INTEGERS.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤]0797 [XA),,B=≤B' 'BEGIN:C←n|A-B' ]0798 [<b style="color:green">∇ </b>ZNINV FX 'B←ZNINV A;r;s;D' '⍝ COMPUTES THE INVERSES OF THE ENTRIES OF]0799 [X A MODULO n.' 'DERR∧/,1=A ZGCD(∆A)∆n' 'B←n|r' ]0800 [<b style="color:green">∇ </b>ZNLSYS FX 'C←A ZNLSYS B;T;X;r;v' '⍝ SOLVES LINEAR SYSTEMS OVER ZN, W]0801 [ HERE n MUST BE' '⍝ PRIME. PRODUCES AN ARRAY C SUCH THAT A+.õC IS]0802 [ ' '⍝ B AND A MATRIX w WHOSE ROWS ARE A BASIS FOR THE' '⍝ SOLUTION SP]0803 [ ACE OF THE CORRESPONDING HOMOGENEOUS' '⍝ SYSTEM.' 'DERR∧/(1=∆ZFACTOR n)]0804 [ ,(,A=≤A),(,B=≤B)' 'DERR∧/(2=∆∆A),(1ó∆∆B),(1×∆A)=1×∆B' 'A←ZNROWREDUCE A']0805 [ 'B←n|r+.õB' 'DERR∧/,0=((∆v),(∊1+∆∆B)∆0)ÇB' 'X←(~T←(∊1×∆A)SCHV v)/⌈∊1×∆]0806 [ A' 'w←((∆X),∆T)∆0' 'w[;X]←Xø.=X' 'w[;v]←ín|-A[⌈∆v;X]' 'C←Tñ((∆v),1Ç∆B)×]0807 [XB' ]0808 [<b style="color:green">∇ </b>ZNROWREDUCE FX 'B←ZNROWREDUCE A;IO;I;J;K;L;M;X;U;GCD;s;Y;D;NOTEST;R' ]0809 [ '⍝ ROW REDUCES A MODULO n, WHICH MUST BE LESS' '⍝ THAN 1E7. PRODUCE]0810 [ S r, AN INVERTIBLE MATRIX MODULO n' '⍝ SUCH THAT B IS r ZNMATPROD ]0811 [ A, AND A VECTOR v LISTING' '⍝ THE COLUMNS CONTAINING THE ''CORNER ENT]0812 [ RIES'' OF B.' 'DERR∧/(n<10000000),(,A=≤A),2=∆∆A' 'IO←IO' 'IO←NOTEST←]0813 [ 1' 'L←∊1×∆B←n|A' 'R←(K,K)∆1,(K←1×∆B)∆0' 'v←⌈I←J←0' 'LOOP1:¸((J⎕K)∧L<I←I]0814 [ +1)/END' 'LOOP2:¸(∧/0=U←JÇB[;I])/LOOP1' 'M←≤/(U≠0)/U' 'X←J+U⌈M' 'D←M ZG]0815 [ CD n' 'B[X;]←n|B[X;]õr' 'R[X;]←n|R[X;]õr' 'Y←(X≠⌈K)õB[;I]ZQUOT(1×∆B)∆B[]0816 [ X;I]' 'B←n|B-Yø.õB[X;]' 'R←n|R-Yø.õR[X;]' '¸(1=+/U≠0)/END1' '¸LOOP2' 'E]0817 [ ND1:v←v,I' 'B[J,X;]←B[X,J←J+1;]' 'R[J,X;]←R[X,J;]' '¸LOOP1' 'END:v←v-1-]0818 [XIO←IO' 'r←R' ]0819 [<b style="color:green">∇ </b>ZNMATINV FX 'C←ZNMATINV A;IO;B;r;v' '⍝ COMPUTES THE INVERSE OF THE S]0820 [ QUARE INTEGER' '⍝ MATRIX A MODULO n.' 'DERR∧/(2=∆∆A),=/∆A' 'IO←1' ']0821 [XB←ZNROWREDUCE A' 'DERR∧/1=1 1íB' 'C←r' ]0822 [<b style="color:green">∇ </b>ZNMATPROD FX 'C←A ZNMATPROD B' '⍝ COMPUTES THE MATRIX PRODUCT OF THE ]0823 [ ARRAYS A AND B' '⍝ MODULO n, WHICH IS ASSUMED TO BE LESS THAN 1E7.']0824 [ '¸NOTEST/BEGIN' 'DERR∧/(,A=A←n|A),(,B=≤B←n|B),n<10000000' 'BEGIN:C←n|A]0825 [X+.õB' ]0826 [<b style="color:green">∇ </b>ZNNEG FX 'B←ZNNEG A' '⍝ COMPUTES THE NEGATIVE OF A MODULO n.' '⍝ A]0827 [ MUST BE AN INTEGER ARRAY.' '¸NOTEST/BEGIN' 'DERR∧/,A=≤A' 'BEGIN:B←n|-A]0828 [X' ]0829 [<b style="color:green">∇ </b>ZNPOWER FX 'C←A ZNPOWER B;RHO;I;J;NOTEST' '⍝ COMPUTES n|A*B USING T]0830 [ HE BINARY POWER ALGORITHM.' '⍝ A AND B MUST BE INTEGER ARRAYS AND B]0831 [ ⎕0.' 'DERR∧/(,A=≤A),(B=≤B),,B⎕0' 'EXPAND' 'RHO←∆A' 'C←(∆A←,A)∆1' 'I←(B>]0832 [ 0)/⌈∆B←,B' 'NOTEST←1' 'LOOP:C[J]←C[J]ZNPROD A[J←(2|B[I])/I]' '¸(0=∆I←(B]0833 [ [I]⎕2)/I)/END' 'A[I]←A[I]ZNPROD A[I]' 'B[I]←≤B[I]ö2' '¸LOOP' 'END:C←RHO]0834 [X∆C' ]0835 [<b style="color:green">∇ </b>ZNPROD FX 'C←A ZNPROD B;RHO;D;Q;IO' '⍝ COMPUTES n|AõB USING MULTIP]0836 [ LE PRECISION IF n ⎕ 1E7.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A←n|A),,B=≤B←n|B]0837 [ ' 'BEGIN:¸(n>10000000)/GEN' 'C←n|AõB' '¸0' 'GEN:EXPAND' 'RHO←∆A' 'IO←1]0838 [ ' 'D←(Q←3∆M←1000000)≤((A←,A)õB←,B)ön' 'A←QA' 'B←QB' 'C←(5 3,1Ç∆A)×((]0839 [ 2 1 3í(3∆1)ø.õA)õ(3∆1)ø.õB)-(Qn)ø.õD' 'C←+/[2](0 ∊1 ∊2ø.õ(1Ç∆A)∆1)∨[1]]0840 [ C' 'LOOP:C[1Ç⌈5;]←∊499999+M|D←499999+1 0ÇC' 'C[⌈4;]←(∊1 0ÇC)+≤DöM' '¸(∧]0841 [X/,0≠∊3 0ÇC)/LOOP' 'C←n|RHO∆M2 0ÇC' ]0842 [<b style="color:green">∇ </b>ZNSUM FX 'C←A ZNSUM B' '⍝ COMPUTES THE SUM OF A AND B MODULO n.']0843 [ '⍝ A AND B MUST BE INTEGER ARRAYS.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A),,B=]0844 [X≤B' 'BEGIN:C←n|A+B' ]0845 [<b style="color:green">∇ </b>ZNXDEGREE FX 'B←ZNXDEGREE A' '⍝ COMPUTES THE DEGREES OF AN ARRAY OF P]0846 [XOLYNOMIALS' '⍝ OVER THE INTEGERS MODULO n.' 'B←ZXDEGREE n|A' ]0847 [<b style="color:green">∇ </b>ZNXDET FX 'D←ZNXDET A;IO;DEG;J;V;W;Q;R;S;a;NOTEST' '⍝ COMPUTES THE D]0848 [ ETERMINANT OF A MATRIX OF INTEGER' '⍝ POLYNOMIALS MODULO n, WHICH MUST]0849 [ BE A PRIME' '⍝ LESS THAN 1E7.' 'DERR∧/(,A=≤A),(3=∆∆A),(=/2×∆A),(1=∆ZFA]0850 [ CTOR n),n<10000000' 'A←n|A' 'D←,IO←NOTEST←1' '¸(0=1×∆A)/0' 'LOOP:¸(1=1]0851 [ ×∆A)/END' 'BACK:¸(∧/∊1=DEG←∊1++/∧\∨0≠A[;1;])/ZERO' 'J←DEG⌈≤/(DEG≠∊1)/DE]0852 [ G' '¸(J=1)/OK' 'A[1,J;;]←A[J,1;;]' 'D←n|-D' 'OK:¸(∧/,0=W←(1 0)ÇA[;1;])/]0853 [ ENDLP' 'Q←(-1 0+∆V)×V←W ZNXQUOT(∆W)∆A[1;1;]' 'R←TRAV((2×∆A),∊1×∆Q)∆Q' ']0854 [ S←(∆A)∆A[1;;]' 'A←A ZNXDIFF R ZNXPROD S' '¸BACK' 'ENDLP:D←D ZNXPROD A[1]0855 [X;1;]' 'A←1 1 0ÇA' '¸LOOP' 'ZERO:¸D←,0' 'END:D←D ZNXPROD A[1;1;]' ]0856 [<b style="color:green">∇ </b>ZNXQUOT FX 'C←A ZNXQUOT B;IO;DB;N;K;L;R;I;F;D;E;RHO' '⍝ COMPUTES THE]0857 [ QUOTIENT OF A BY B IN THE RING' '⍝ OF INTEGER POLYNOMIALS MODULO n]0858 [ , WHICH MUST BE' '⍝ LESS THAN 1E7. THE LEADING COEFFICIENTS IN B' '⍝ ]0859 [ MUST BE UNITS. THE GLOBAL VARIABLE a CONTAINS' '⍝ THE REMAINDERS.' ']0860 [ IO←0' 'DERR∧/(,A=≤A←n|A),(,B=≤B←n|B),n<10000000' 'EXPANDV' 'DERR∧/,0óD]0861 [ B←∊1++/∧\∨0≠B' 'N←õ/RHO←∆DB' 'L←K©(+/∊1×∆A)+©/R←(∊1+K←+/∊1×∆B)-,DB' 'B←]0862 [ (-R)∨(N,K)∆B' 'A←(-R)∨(N,L)×(N,∊1×∆A)∆A' 'C←(N,I←1++/L-K)∆2-2' 'E←ZNINV]0863 [ B[;K-1]' 'LOOP:¸(0>I←I-1)/END' 'C[;I]←F←n|A[;I+K-1]õE' 'A[;I+⌈K]←n|A[;]0864 [ I+⌈K]-Bõí(∨∆B)∆F' '¸LOOP' 'END:D←1©©/,+/∧\∨0≠C' 'C←(RHO,D)∆(N,D)×C' 'D←]0865 [X1©©/,+/∧\∨0≠A←R∨A' 'a←(RHO,D)∆(N,D)×A' ]0866 [<b style="color:green">∇ </b>ZNXDIFF FX 'C←A ZNXDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS O]0867 [XF POLYNOMIALS' '⍝ OVER THE INTEGERS MODULO n.' 'C←A ZNXSUM-B' ]0868 [<b style="color:green">∇ </b>ZNXPROD FX 'C←A ZNXPROD B;D' '⍝ COMPUTES THE PRODUCT OF TWO ARRAYS OF]0869 [ POLYNOMIALS' '⍝ OVER THE INTEGERS MODULO n.' 'C←n|(n|A)ZXPROD n|B' 'D←]0870 [X1©©/,+/∧\∨0≠C' 'C←((∊1Ç∆C),D)×C' ]0871 [<b style="color:green">∇ </b>ZNXSUM FX 'C←A ZNXSUM B;D' '⍝ COMPUTES THE SUM OF TWO ARRAYS OF POLYN]0872 [ OMIALS OF' '⍝ INTEGERS MODULO n.' 'C←n|(n|A)ZXSUM n|B' 'D←1©©/,+/∧\∨0≠]0873 [XC' 'C←((∊1Ç∆C),D)×C' ]0874 [<b style="color:green">∇ </b>ZXPROD FX 'C←A ZXPROD B;IO;D' '⍝ COMPUTES THE ENTRY-BY-ENTRY PRODUCT]0875 [ OF TWO ARRAYS' '⍝ OF INTEGER POLYNOMIALS.' '¸NOTEST/BEGIN' 'DERR∧/(,A=]0876 [ ≤A),,B=≤B' 'EXPANDV' 'BEGIN:IO←0' 'C←(Aø.õ(∊1×∆B)∆1)õ((⌈∊1+∆∆A),0 ∊1+∆]0877 [ ∆A)íBø.õ(∊1×∆A)∆1' 'C←C,((∆A),∊1+∊1×∆A)∆0' 'C←+/[∊2+∆∆C]((∆A)∆-⌈∊1×∆A)∨]0878 [XC' 'D←1©©/,+/∧\∨C≠0' 'C←((∊1Ç∆C),D)×C' ]0879 [<b style="color:green">∇ </b>ZXSUM FX 'C←A ZXSUM B;M;D' '⍝ COMPUTES THE SUM OF TWO ARRAYS OF INTEG]0880 [ ER POLYNOMIALS.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A),,B=≤B' 'EXPANDV' 'BEGIN]0881 [X:M←(∆A)©∆B' 'C←(M×A)+M×B' 'D←1©©/,+/∧\∨C≠0' 'C←((∊1Ç∆C),D)×C' ]0882 [<b style="color:green">∇ </b>ZNXEVAL FX 'Y←A ZNXEVAL B;I;NOTEST;IO;RHO' '⍝ EVALUATES THE POLYNOMI]0883 [ ALS IN A AT B MODULO n.' 'DERR∧/(,A=≤A),(,B=≤B←((∆B),1)∆B),n<10000]0884 [ 000' 'EXPANDV' 'A←((õ/RHO←∊1Ç∆A),∊1×∆A)∆n|A' 'Y←(∆B←,n|B)∆0' 'IO←NOTES]0885 [ T←1' 'I←1+(∆A)[2]' 'LOOP:¸(0⎕I←I-1)/END' 'Y←n|A[;I]+BõY' '¸LOOP' 'END:Y]0886 [X←RHO∆Y' ]0887 [<b style="color:green">∇ </b>ZNXFACTOR FX 'G←ZNXFACTOR F;IO;M;R;D;H;U;I;V;E;J;W;a;CNT;UD;ZNXRT;F1]0888 [ ' '⍝ COMPUTES THE MONIC IRREDUCIBLE FACTORS OF AN' '⍝ INTEGER POLYNOMIA]0889 [ L MODULO n, WHICH MUST BE A' '⍝ PRIME LESS THAN 1E7. THE ALGORITHM US]0890 [ ED IS' '⍝ PROBABILISTIC AND SO HAS A SMALL CHANCE OF' '⍝ NOT FINDING AL]0891 [ L THE FACTORS.' 'DERR∧/(n<10000000),(1=∆ZFACTOR n),(1=∆∆F),,F=≤F' 'DERR]0892 [ 0óD←∊1++/∧\∨F≠0' 'IO←0' 'F←(D+1)×n|FõZNINV F[D]' 'G←(0,D+1)∆M←0' 'R←0]0893 [ 1' 'LOOP:¸((D←ZNXDEGREE F)<2õM←M+1)/END' 'ZNXFINIT F' 'R←D×(F ZNXREM R]0894 [ )ZNXFPOWER n' '¸(1=∆H←F ZNXGCD0 R-D×0 1)/LOOP' '¸(M=∊1+∆H)/IRR' '¸(200>]0895 [ n*M)/SMALL' 'U←(1,∆H)∆H' 'LOOPA:¸(∧/M=UD←ZNXDEGREE U)/ENDA' 'I←(M<UD)⌈1]0896 [ ' 'ZNXFINIT F1←(1+E←UD[I])×U[I;]' 'CNT←0' 'LOOPA1:¸(10<CNT←CNT+1)/ENDA1]0897 [ ' 'V←í(E∆n)?5∆n*E' '¸(n=2)/EVEN' 'V←(5,E)×V ZNXFPOWER(∊1+n*M)ö2' 'V←(V]0898 [ ∧.≠0)ðV' 'V←(V∧.≠E×1)ðV' '¸(0=1×∆V←(V∧.≠E×n-1)ðV)/LOOPA1' 'V←V[0;]' '¸(]0899 [ 1≠∆W←(V+E×1)ZNXGCD0 F1)/SPLIT' 'W←V ZNXGCD0 F1' '¸SPLIT' 'EVEN:J←1' 'W←]0900 [ V' 'LOOPA1A:¸(MóJ←J+1)/ENDA1A' 'W←n|W+V←V ZNXFPROD V' '¸LOOPA1A' 'ENDA1]0901 [ A:W←(W∧.≠0)ðW' '¸(0=1×∆W←(W∧.≠E×1)ðW)/LOOPA1' 'W←F1 ZNXGCD0 W←W[0;]' 'S]0902 [ PLIT:U←((I≠⌈1×∆U)ðU),[0]((∆H)×W),[∊0.5](∆H)×F1 ZNXQUOT W' '¸LOOPA' 'END]0903 [ A1:''BAD LUCK, YOU LOSE!''' '¸' 'ENDA:G←G,[0]((1×∆U),∊1×∆G)×U' 'F←F ZNX]0904 [ QUOT H' '¸(1=∆H←F ZNXGCD0 H)/LOOP' 'U←((U ZNXREM H)∧.=0)ðU' '¸ENDA' 'SM]0905 [ ALL:U←(í(M∆n)⌈n*M),1' 'U←((U ZNXREM H)∧.=0)ðU' '¸ENDA' 'IRR:G←G,[0](∊1]0906 [ ×∆G)×H' 'F←F ZNXQUOT H' 'LOOPB:W←F ZNXQUOT H' '¸(a∧.≠0)/LOOP' 'G←G,[0](]0907 [ ∊1×∆G)×H' 'F←W' '¸LOOPB' 'END:¸(D=0)/ONE' 'G←G,[0](∊1×∆G)×F' 'ONE:D←ZNX]0908 [XDEGREE,G[∊1+1×∆G;]' 'G←((1×∆G),D+1)×G' ]0909 [<b style="color:green">∇ </b>ZNXFINIT FX 'ZNXFINIT F;D;IO;I' '⍝ INITIALIZES THE CURRENT QUOTIENT ]0910 [ ALGEBRA OF ZN[X].' '⍝ THE VALUE OF n MAY NOT EXCEED 1E7.' 'IO←0' 'D]0911 [ ERR∧/(n<10000000),(1=∆∆F),,F=≤F←n|F' 'DERR 1óD←∊1++/∧\∨0≠F' 'ZNXRT←((D-]0912 [ 1),D)∆n|-F←n|(D×F)õZNINV F[D]' 'I←0' 'LOOP:¸((D-1)óI←I+1)/0' 'ZNXRT[I;]]0913 [X←n|(0,∊1ÇZNXRT[I-1;])-FõZNXRT[I-1;D-1]' '¸LOOP' ]0914 [<b style="color:green">∇ </b>ZNXREM FX 'C←A ZNXREM B;a;Q' '⍝ COMPUTES THE REMAINDER OF B MODULO ]0915 [ A IN THE' '⍝ EUCLIDEAN DOMAIN OF POLYNOMIALS MOD n, WHICH' '⍝ MUST B]0916 [XE A PRIME SMALLER THAN 1E7.' 'Q←B ZNXQUOT A' 'C←a' ]0917 [<b style="color:green">∇ </b>ZNXFPOWER FX 'C←A ZNXFPOWER B;D;E;RHO;R;I;J' '⍝ COMPUTES POWERS IN TH]0918 [ E CURRENT QUOTIENT ALGEBRA' '⍝ OF THE RING OF POLYNOMIALS OVER THE INTE]0919 [ GERS' '⍝ MODULO n. THE ENTRIES IN B MUST BE NONNEGATIVE' '⍝ INTEGER]0920 [ S.' 'DERR∧/(,B=≤B),,B⎕0' 'B←((∆B),1)∆B' 'EXPANDV' '¸((D←∊1×∆ZNXRT)⎕E←∊1]0921 [ ×∆A)/OK' '¸(E>∊1+2õD)/DERR' 'A←n|(((∊1Ç∆A),D)×A)+(((-∆∆A)×D)ÇA)+.õ((E-D]0922 [ ),D)×ZNXRT' 'OK:A←((RHO←∊1Ç∆A),D)×A' 'A←((R←õ/RHO),D)∆A' 'C←(∆A)∆D×1' ']0923 [ I←(B>0)/⌈∆B←,B' 'LOOP:C[J;]←((∆J),D)×C[J;]ZNXFPROD A[J←(2|B[I])/I;]' '¸]0924 [ (0=∆I←(B[I]⎕2)/I)/END' 'A[I;]←((∆I),D)×A[I;]ZNXFPROD A[I;]' 'B[I]←≤B[I]]0925 [Xö2' '¸LOOP' 'END:D←1©+/∧\∨∧ð((õ/∊1Ç∆C),D)∆C≠0' 'C←(RHO,D)∆(R,D)×C' ]0926 [<b style="color:green">∇ </b>ZNXGCD0 FX 'C←A ZNXGCD0 B;M;R;RHO;I;T;D;LCI' '⍝ COMPUTES GCD''S OF IN]0927 [ TEGER POLYNOMIALS MODULO' '⍝ n WITH A MINIMUM OF CHECKING AND WITHOUT']0928 [ '⍝ EXPRESSING THE RESULT AS A LINEAR COMBINATION' '⍝ OF THE ARGUMENTS.]0929 [ ' 'DERR∧/(n<10000000),(1=∆ZFACTOR n),(,A=≤A),,B=≤B' 'EXPANDV' 'M←1©+/∧\]0930 [ ∨∧ð0≠((õ/∊1Ç∆A),∊1×∆A)∆A←n|A' 'M←M©+/∧\∨∧ð0≠((õ/∊1Ç∆B),∊1×∆B)∆B←n|B' 'R]0931 [ ←õ/RHO←∊1Ç∆A' 'A←(R,M)∆(RHO,M)×A' 'B←(R,M)∆(RHO,M)×B' 'I←⌈R' 'LOOP:¸(0=]0932 [ ∆I←(∧/B[I;]≠0)/I)/END' 'T←((∆I),M)×B[I;]ZNXREM A[I;]' 'A[I;]←B[I;]' 'B[]0933 [ I;]←T' '¸LOOP' 'END:D←1©+/∧\∨∧ð0≠A' 'LCI←ZNINV(RHO,1)∆ZNXLEAD C←(RHO,D)]0934 [X∆(R,D)×A' 'C←C ZNXPROD LCI' ]0935 [<b style="color:green">∇ </b>ZNXFPROD FX 'C←A ZNXFPROD B;D;E' '⍝ COMPUTE THE PRODUCT OF TWO ARRAYS]0936 [ OVER THE' '⍝ CURRENT QUOTIENT ALGEBRA OF THE RING OF POLYNOMIALS' '⍝ O]0937 [ VER THE INTEGERS MODULO n.' 'C←n|(n|A)ZXPROD n|B' 'DERR(D←∊1×∆C)ó+/∆ZN]0938 [ XRT' '¸(DóE←∊1×∆ZNXRT)/0' 'C←n|(((∊1Ç∆C),E)×C)+(((-∆∆C)×E)ÇC)+.õ((D-E),]0939 [XE)×ZNXRT' 'D←1©+/∧\∨∧ð((õ/∊1Ç∆C),E)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0940 [<b style="color:green">∇ </b>ZNXLEAD FX 'C←ZNXLEAD A;IO;D;RHO;I;R' '⍝ COMPUTES THE ARRAY OF LEADI]0941 [ NG COEFFICIENTS OF AN' '⍝ ARRAY OF INTEGER POLYNOMIALS MODULO n.' 'IO]0942 [ ←0' '¸NOTEST/BEGIN' 'DERR∧/,A=≤A' '¸(0≠∆∆A←n|A)/BEGIN' 'A←,A' 'BEGIN:RH]0943 [ O←∊1Ç∆A' 'D←,∊1++/∧\∨0≠A' 'I←(D⎕0)/⌈R←õ/RHO' 'C←R∆1' 'C[I]←(,A)[D[I]+(∊]0944 [X1×∆A)õI]' 'C←RHO∆C' ]0945 [<b style="color:green">∇ </b>ZNXFCLEAR FX 'ZNXFCLEAR;I' '⍝ EXPUNGES THE VARIABLE ZNXRT DESCRIBING ]0946 [XTHE CURRENT' '⍝ QUOTIENT ALGEBRA OF ZN[X].' 'I←EX ''ZNXRT''' ]0947 [<b style="color:green">∇ </b>ZNXFDIFF FX 'C←A ZNXFDIFF B' '⍝ COMPUTES THE DIFFERENCE OF TWO ARRAYS]0948 [X IN THE' '⍝ CURRENT QUOTIENT ALGEBRA OF ZN[X].' 'C←A ZNXFSUM-B' ]0949 [<b style="color:green">∇ </b>ZNXFSUM FX 'C←A ZNXFSUM B;D;E' '⍝ COMPUTES THE SUM OF TWO ARRAYS OVER]0950 [ THE CURRENT' '⍝ QUOTIENT ALGEBRA OF THE RING OF POLYNOMIALS' '⍝ OVER T]0951 [ HE INTEGERS MODULO n.' 'D←∊1×∆C←A ZNXSUM B' 'DERR Dó+/∆ZNXRT' '¸(DóE←∊]0952 [ 1×∆ZNXRT)/0' 'C←n|(((∊1Ç∆C),E)×C)+(((-∆∆C)×E)ÇC)+.õ((D-E),E)×ZNXRT' 'D←]0953 [X1©+/∧\∨∧ð((õ/∊1Ç∆C),E)∆C≠0' 'C←((∊1Ç∆C),D)×C' ]0954 [<b style="color:green">∇ </b>ZNXFINV FX 'r←ZNXFINV A;s;D;E' '⍝ COMPUTES INVERSES IN THE CURRENT QU]0955 [ OTIENT' '⍝ ALGEBRA OF ZN[X]. n MUST BE PRIME.' 'DERR(∊1×∆A)óE←∊1×∆ZN]0956 [ XRT' '¸(E=1)/SMALL' 'D←A ZNXGCD(-ZNXRT[IO;]),1' 'DERR∧/(,D=1),1=∊1×∆D']0957 [X '¸0' 'SMALL:r←ZNINV A' ]0958 [<b style="color:green">∇ </b>ZNXGCD FX 'C←A ZNXGCD B;IO;M;RHO;F;U;V;I;Q;T;D;LCI;a;R' '⍝ COMPUTES ]0959 [ THE GCD OF TWO ARRAYS OF INTEGER' '⍝ POLYNOMIALS MODULO n, WHICH MUST ]0960 [ BE A PRIME' '⍝ LESS THAN 1E7. THE RESULT C IS WRITTEN' '⍝ IN THE FOR]0961 [ M (r ZNXPROD A) ZNXSUM s ZNXPROD B.' 'DERR∧/(n<10000000),(1=∆ZFACTOR n]0962 [ ),(,A=≤A),,B=≤B' 'IO←1' 'EXPANDV' 'M←1©+/∧\∨∧ð0≠((õ/∊1Ç∆A),∊1×∆A)∆A←n|]0963 [ A' 'M←M©+/∧\∨∧ð0≠((õ/∊1Ç∆B),∊1×∆B)∆B←n|B' 'R←õ/RHO←∊1Ç∆A' 'A←(R,M)∆(RHO]0964 [ ,M)×A' 'B←(R,M)∆(RHO,M)×B' 'U←((∆A)∆M×1),[1]((∆A)∆0),[0.5]A' 'V←((∆B)∆0]0965 [ ),[1]((∆B)∆M×1),[0.5]B' 'I←⌈R' 'LOOP:¸(0=∆I←(∧/V[3;I;]≠0)/I)/END' 'Q←((]0966 [ ∆I),M)×U[3;I;]ZNXQUOT V[3;I;]' 'T←(3,(∆I),M)×U[;I;]ZNXDIFF V[;I;]ZNXPRO]0967 [ D(3,∆Q)∆Q' 'U[;I;]←V[;I;]' 'V[;I;]←T' '¸LOOP' 'END:D←1©+/∧\∨∧ð0≠U[3;;]']0968 [ 'LCI←ZNINV(RHO,1)∆ZNXLEAD C←(RHO,D)∆(R,D)×U[3;;]' 'C←C ZNXPROD LCI' 'D]0969 [ ←1©+/∧\∨∧ð0≠U[1;;]' 'r←LCI ZNXPROD(RHO,D)∆(R,D)×U[1;;]' 'D←1©+/∧\∨∧ð0≠U]0970 [X[2;;]' 's←LCI ZNXPROD(RHO,D)∆(R,D)×U[2;;]' ]0971 [<b style="color:green">∇ </b>ZNXIRRED FX 'A←ZNXIRRED M;IO;I;F;J;C' '⍝ COMPUTES A MATRIX LISTING T]0972 [ HE MONIC IRREDUCIBLE' '⍝ POLYNOMIALS OF DEGREE AT MOST M OVER THE INTE]0973 [ GERS' '⍝ MODULO n, WHICH MUST BE A PRIME LESS THAN 1E7.' 'DERR∧/(n<10]0974 [ 000000),(1=∆ZFACTOR n),1óM' 'IO←0' 'A←(0,M+1)∆0' 'I←⌈1×∆C←ZNXMONIC M' ]0975 [ 'LOOP:A←A,[0]F←C[J←+/1×I;]' 'I←1ÇI' '¸(M<2õZXDEGREE F)/END' 'I←(∧/0≠F Z]0976 [XNXREM C[I;])/I' '¸LOOP' 'END:A←A,[0]C[I;]' ]0977 [<b style="color:green">∇ </b>ZNXMONIC FX 'A←ZNXMONIC M;IO;Q;I' '⍝ COMPUTES A MATRIX LISTING THE M]0978 [ ONIC POLYNOMIALS' '⍝ OF DEGREE AT MOST M OVER THE INTEGERS MODULO n.]0979 [ ' 'IO←0' 'DERR∧/(1=∆M),(,M=≤M),,0<M←,M' 'Q←1' 'A←⌈I←0' 'LOOP:¸(M<I←I+1]0980 [X)/ENCODE' 'A←A,Q+⌈Q←Qõn' '¸LOOP' 'ENCODE:A←∨í((M+1)∆n)A' ]0981 [<b style="color:green">∇ </b>ZNXMATINV FX 'C←ZNXMATINV A;IO;B;r;v' '⍝ COMPUTES THE INVERSE OF A S]0982 [ QUARE MATRIX OVER ZN[X].' 'DERR∧/(3=∆∆A),=/∊1Ç∆A' 'IO←1' 'B←ZNXROWRE]0983 [XDUCE A' 'DERR∧/,(1 1 2íB)=(∆B)[1 3]∆(∊1×∆B)×1' 'C←r' ]0984 [<b style="color:green">∇ </b>ZNXROWREDUCE FX 'B←ZNXROWREDUCE A;IO;I;J;K;L;C;D;M;a' '⍝ ROW REDUCES ]0985 [ A MATRIX OF POLYNOMIALS IN ZN[X].' '⍝ n MUST BE A PRIME. PRODUCES AN ]0986 [ INVERTIBLE MATRIX r' '⍝ OF POLYNOMIALS SUCH THAT B IS r ZNXMATPROD ]0987 [ A.' '⍝ THE VECTOR v LISTS THE CORNER ENTRIES OF B.' 'DERR∧/(1=∆ZFACT]0988 [ OR n),(3=∆∆A),,A=≤A' 'B←n|A' 'IO←IO' 'IO←1' 'v←⌈0' 'r←(K,K,1)∆1,(K←1×]0989 [ ∆B)∆I←J←0' 'LOOP:¸((J⎕1×∆B)∧(∆B)[2]<I←I+1)/END' 'BACK:¸(0=∆D←(C⎕0)/C←ZN]0990 [ XDEGREE(J,0)ÇB[;I;])/LOOP' 'K←J+C⌈≤/D' 'C←B[;I;]ZNXQUOT B[K;I;]' 'C[K;]]0991 [ ←0' 'D←2 1 3í((∆B)[2],∆C)∆C' 'B←B ZNXDIFF D ZNXPROD(∆B)∆B[K;;]' 'D←2 1 ]0992 [ 3í((∆r)[2],∆C)∆C' 'r←r ZNXDIFF D ZNXPROD(∆r)∆r[K;;]' '¸(1<+/∧/0≠(J,0)ÇB]0993 [ [;I;])/BACK' 'v←v,I' 'B[J,K;;]←B[K,J←J+1;;]' 'r[J,K;;]←r[K,J;;]' 'B[J;;]0994 [ ]←n|B[J;;]õM←ZNINV ZNXLEAD B[J;I;]' 'r[J;;]←n|r[J;;]õM' '¸LOOP' 'END:v←]0995 [Xv-1-IO←IO' ]0996 [<b style="color:green">∇ </b>ZNXMATPROD FX 'C←A ZNXMATPROD B;IO;M;X;AX;BX;RR;RA;RB' '⍝ COMPUTES T]0997 [ HE MATRIX PRODUCT OF TWO NONSCALAR ARRAYS' '⍝ OF INTEGER POLYNOMIALS MO]0998 [ DULO n.' 'IO←1' 'DERR∧/(2ó(∆∆A),∆∆B),((∆A)[∊1+∆∆A]=M←1×∆B)' 'C←((RA←∊2]0999 [ Ç∆A),(RB←∊1Ç1Ç∆B),1)∆0' 'X←1=⌈M' 'RR←((∆RA)+⌈∆RB),(⌈∆RA),∆∆C' 'LOOP:AX←]1000 [ RRí(RB,RA,∊1×∆A)∆X/[∊1+∆∆A]A' 'BX←((∊1Ç∆C),∊1×∆B)∆XðB' 'C←C ZNXSUM AX Z]1001 [XNXPROD BX' '¸(~1×X←∊1∨X)/LOOP' ]1002 [<b style="color:green">∇ </b>ZNXPRODRED FX 'C←ZNXPRODRED A;IO;RHO;D;E;CC;L;M' '⍝ COMPUTES THE PRO]1003 [ DUCT REDUCTION ALONG THE LAST' '⍝ AXIS OF AN ARRAY OF POLYNOMIALS OVER ]1004 [ THE INTEGERS' '⍝ MODULO n, WHICH MUST NOT EXCEED 1E7.' '¸(1⎕∆∆C←A)/0' ]1005 [ 'IO←1' 'L←õ/RHO←∊2Ç∆C' 'C←(L,∊2×∆C)∆C' '¸(0=(∆C)[2])/ZERO' 'LOOP:¸(1=D]1006 [ ←(∆C)[2])/ONE' 'CC←((L,E,∊1×∆C)×C)ZNXPROD(L,(-E←≤Dö2),∊1×∆C)×C' '¸(D≠2õ]1007 [ E)/ODD' 'C←CC' '¸LOOP' 'ODD:M←(+/∧\∨∧ð0≠C[;E+1;])©∊1×∆CC' 'C←((L,M)×C[;]1008 [ E+1;]),[2]((∊1Ç∆CC),M)×CC' '¸LOOP' 'ONE:C←(RHO,∊1×∆C)∆C' '¸0' 'ZERO:C←(]1009 [XRHO,1)∆1' ]1010 [<b style="color:green">∇ </b>ZNXREDUCE FX 'B←ZNXREDUCE A;IO;I;J;K;L;M;N;Q;E;D;Y;Z;U;V;X;a' '⍝ RED]1011 [ UCES A MATRIX OF POLYNOMIALS IN ZN[X] USING' '⍝ ROW AND COLUMN OPERAT]1012 [ IONS. PRODUCES MATRICES r' '⍝ AND s SUCH THAT B IS THE MATRIX PR]1013 [ ODUCT OF' '⍝ r, A AND s. n MUST BE A PRIME.' 'DERR∧/(1=∆ZFACTOR n]1014 [ ),(3=∆∆A),,A=≤A' 'B←n|A' 'IO←0' 'r←(K,K,1)∆1,(K←1×∆B)∆0' 's←(L,L,1)∆1,]1015 [ (L←(∆B)[1])∆0' 'I←∊1' 'LOOPI:¸(∧/∊1=D←,ZNXDEGREE((I,I←I+1),0)ÇB)/CLEANU]1016 [ P' 'V←I+((2×∆B)-I)D⌈≤/(D⎕0)/D' 'X←B[J←V[0];K←V[1];]' 'COL:¸(∧/∊1=D←ZNX]1017 [ DEGREE X ZNXREM B[;K;])/ROW' 'L←D⌈≤/(D⎕0)/D' 'Q←B[L;K;]ZNXQUOT X' 'E←Q ]1018 [ ZNXPROD B[J;;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[L;;]←n|B[L;;]-(1Ç∆B)×E]1019 [ ' 'E←Q ZNXPROD r[J;;]' 'r←((∊1Ç∆r),(∊1×∆r)©∊1×∆E)×r' 'r[L;;]←n|r[L;;]-(]1020 [ 1Ç∆r)×E' 'X←B[J←L;K;]' '¸COL' 'ROW:¸(∧/∊1=D←ZNXDEGREE X ZNXREM B[J;;])/]1021 [ GENERAL' 'M←D⌈≤/(D⎕0)/D' 'Q←B[J;M;]ZNXQUOT X' 'E←Q ZNXPROD B[;M;]' 'B←(]1022 [ (∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[;M;]←n|B[;M;]-(∆B)[0 2]×E' 'E←Q ZNXPROD s[]1023 [ ;M;]' 'S←((∊1Ç∆s),(∊1×∆s)©∊1×∆E)×s' 's[;M;]←n|s[;M;]-(∆s)[0 2]×E' 'X←B[]1024 [ J;K←M;]' '¸COL' 'GENERAL:¸(∧/∊1=D←,ZNXDEGREE X ZNXREM(I,I,0)ÇB)/END' 'V]1025 [ ←I+((2×∆B)-I)D⌈≤/(D⎕0)/D' 'Q←B[L←V[0];K;]ZNXQUOT X' 'E←Q ZNXPROD B[J;;]1026 [ ]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[L;;]←n|B[L;;]-(1Ç∆B)×E' 'E←Q ZNXPRO]1027 [ D r[J;;]' 'r←((∊1Ç∆r),(∊1×∆r)©∊1×∆E)×r' 'r[L;;]←n|r[L;;]-(1Ç∆r)×E' 'Q←B]1028 [ [L;M←V[1];]ZNXQUOT X' 'E←Q ZNXPROD B[;K;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B]1029 [ ' 'B[;M;]←n|B[;M;]-(∆B)[0 2]×E' 'E←Q ZNXPROD s[;K;]' 's←((∊1Ç∆s),(∊1×∆s]1030 [ )©∊1×∆E)×s' 's[;M;]←n|s[;M;]-(∆s)[0 2]×E' 'X←B[J←L;K←M;]' '¸COL' 'END:B]1031 [ [I,J;;]←B[J,I;;]' 'r[I,J;;]←r[J,I;;]' 'B[;I,K;]←B[;K,I;]' 's[;I,K;]←s[;]1032 [ K,I;]' 'B[I;;]←n|B[I;;]õU←ZNINV ZNXLEAD X' 'r[I;;]←n|r[I;;]õU' 'Q←B[Y←(]1033 [ I+1)Ç⌈1×∆B;I;]ZNXQUOT B[I;I;]' 'E←(1 0 2í((∆B)[1],∆Q)∆Q)ZNXPROD((1×∆Q),]1034 [ 1Ç∆B)∆B[I;;]' 'B←((∊1Ç∆B),(∊1×∆B)©∊1×∆E)×B' 'B[Y;;]←n|B[Y;;]-((∆Y),1Ç∆B]1035 [ )×E' 'E←(1 0 2í((∆r)[1],∆Q)∆Q)ZNXPROD((1×∆Q),1Ç∆r)∆r[I;;]' 'r←((∊1Ç∆r),]1036 [ (∊1×∆r)©∊1×∆E)×r' 'r[Y;;]←n|r[Y;;]-((∆Y),1Ç∆r)×E' 'Q←B[I;Z←(I+1)Ç⌈(∆B)[]1037 [ 1];]ZNXQUOT B[I;I;]' 'B[I;Z;]←0' 'E←(1 0 2í((1×∆Q),(∆s)[0 2])∆s[;I;])ZN]1038 [ XPROD((1×∆s),∆Q)∆Q' 's←((∊1Ç∆s),(∊1×∆s)©∊1×∆E)×s' 's[;Z;]←n|s[;Z;]-((1×]1039 [ ∆s),(∆Z),∊1×∆s)×E' '¸LOOPI' 'CLEANUP:D←1©+/∧\∨∧ð∧ð0≠B' 'B←((∊1Ç∆B),D)×B]1040 [ ' 'D←1©+/∧\∨∧ð∧ð0≠r' 'r←((∊1Ç∆r),D)×r' 'D←1©+/∧\∨∧ð∧ð0≠s' 's←((∊1Ç∆s),D]1041 [X)×s' ]1042 [<b style="color:green">∇ </b>ZPRIMES FX 'P←ZPRIMES N;IO;Q;R' '⍝ LISTS THE PRIMES UP TO N.' 'IO←0]1043 [ ' 'DERR 1=∆N←,N' 'P←(N⎕P)/P←2 3 5 7 11 13 17 19' '¸(Nó22)/0' 'Q←,(30õ⌈©]1044 [ Nö30)ø.+7 11 13 17 19 23 29 31' 'Q←(∧ð0≠7 11 13 17 19ø.|Q)/Q' 'LOOP:¸((]1045 [ 0=∆Q)∧N<(1×Q)*2)/END' 'P←P,R←(5≤∆Q)×Q' 'Q←(∧ð0≠Rø.|Q)/Q' '¸LOOP' 'END:P]1046 [X←(N⎕P)/P←P,Q' ]1047 [<b style="color:green">∇ </b>ZREM FX 'C←A ZREM B' '⍝ COMPUTES THE REMAINDER WHEN B IS DIVIDED BY]1048 [ A.' '⍝BOTH ARRAYS MUST BE INTEGER.' '¸NOTEST/BEGIN' 'DERR∧/(,A=≤A),,B]1049 [X=≤B' 'BEGIN:C←(|A)|B' ]1050 []</pre>
<div style="background:#003B6F;color:white;"><hr>Page served at: Sun, 06 May 2018 03:51:54 AST.</div>
</body>
</html>