1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
|
\documentclass{article}
\usepackage{open-axiom}
\begin{document}
\title{\$SPAD/src/algebra naalgc.spad}
\author{Johannes Grabmeier, Robert Wisbauer}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{category MONAD Monad}
<<category MONAD Monad>>=
)abbrev category MONAD Monad
++ Authors: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 11 June 1991
++ Basic Operations: *, **
++ Related Constructors: SemiGroup, Monoid, MonadWithUnit
++ Also See:
++ AMS Classifications:
++ Keywords: Monad, binary operation
++ Reference:
++ N. Jacobson: Structure and Representations of Jordan Algebras
++ AMS, Providence, 1968
++ Description:
++ Monad is the class of all multiplicative monads, i.e. sets
++ with a binary operation.
Monad(): Category == SetCategory with
--operations
*: (%,%) -> %
++ a*b is the product of \spad{a} and b in a set with
++ a binary operation.
rightPower: (%,PositiveInteger) -> %
++ rightPower(a,n) returns the \spad{n}-th right power of \spad{a},
++ i.e. \spad{rightPower(a,n) := rightPower(a,n-1) * a} and
++ \spad{rightPower(a,1) := a}.
leftPower: (%,PositiveInteger) -> %
++ leftPower(a,n) returns the \spad{n}-th left power of \spad{a},
++ i.e. \spad{leftPower(a,n) := a * leftPower(a,n-1)} and
++ \spad{leftPower(a,1) := a}.
**: (%,PositiveInteger) -> %
++ a**n returns the \spad{n}-th power of \spad{a},
++ defined by repeated squaring.
add
import RepeatedSquaring(%)
x:% ** n:PositiveInteger == expt(x,n)
rightPower(a,n) ==
one? n => a
res := a
for i in 1..(n-1) repeat res := res * a
res
leftPower(a,n) ==
one? n => a
res := a
for i in 1..(n-1) repeat res := a * res
res
@
\section{category MONADWU MonadWithUnit}
<<category MONADWU MonadWithUnit>>=
)abbrev category MONADWU MonadWithUnit
++ Authors: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 11 June 1991
++ Basic Operations: *, **, 1
++ Related Constructors: SemiGroup, Monoid, Monad
++ Also See:
++ AMS Classifications:
++ Keywords:
++ Keywords: Monad with unit, binary operation
++ Reference:
++ N. Jacobson: Structure and Representations of Jordan Algebras
++ AMS, Providence, 1968
++ Description:
++ MonadWithUnit is the class of multiplicative monads with unit,
++ i.e. sets with a binary operation and a unit element.
++ Axioms
++ leftIdentity("*":(%,%)->%,1) \tab{30} 1*x=x
++ rightIdentity("*":(%,%)->%,1) \tab{30} x*1=x
++ Common Additional Axioms
++ unitsKnown---if "recip" says "failed", that PROVES input wasn't a unit
MonadWithUnit(): Category == Monad with
--constants
1: constant -> %
++ 1 returns the unit element, denoted by 1.
--operations
one?: % -> Boolean
++ one?(a) tests whether \spad{a} is the unit 1.
rightPower: (%,NonNegativeInteger) -> %
++ rightPower(a,n) returns the \spad{n}-th right power of \spad{a},
++ i.e. \spad{rightPower(a,n) := rightPower(a,n-1) * a} and
++ \spad{rightPower(a,0) := 1}.
leftPower: (%,NonNegativeInteger) -> %
++ leftPower(a,n) returns the \spad{n}-th left power of \spad{a},
++ i.e. \spad{leftPower(a,n) := a * leftPower(a,n-1)} and
++ \spad{leftPower(a,0) := 1}.
"**": (%,NonNegativeInteger) -> %
++ \spad{a**n} returns the \spad{n}-th power of \spad{a},
++ defined by repeated squaring.
recip: % -> Union(%,"failed")
++ recip(a) returns an element, which is both a left and a right
++ inverse of \spad{a},
++ or \spad{"failed"} if such an element doesn't exist or cannot
++ be determined (see unitsKnown).
leftRecip: % -> Union(%,"failed")
++ leftRecip(a) returns an element, which is a left inverse of \spad{a},
++ or \spad{"failed"} if such an element doesn't exist or cannot
++ be determined (see unitsKnown).
rightRecip: % -> Union(%,"failed")
++ rightRecip(a) returns an element, which is a right inverse of
++ \spad{a}, or \spad{"failed"} if such an element doesn't exist
++ or cannot be determined (see unitsKnown).
add
import RepeatedSquaring(%)
one? x == x = 1
x:% ** n:NonNegativeInteger ==
zero? n => 1
expt(x,n pretend PositiveInteger)
rightPower(a: %,n: NonNegativeInteger) ==
zero? n => 1
res: % := 1
for i in 1..n repeat res := res * a
res
leftPower(a: %,n: NonNegativeInteger) ==
zero? n => 1
res: % := 1
for i in 1..n repeat res := a * res
res
@
\section{category NARNG NonAssociativeRng}
<<category NARNG NonAssociativeRng>>=
)abbrev category NARNG NonAssociativeRng
++ Author: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 03 July 1991
++ Basic Operations: +, *, -, **
++ Related Constructors: Rng, Ring, NonAssociativeRing
++ Also See:
++ AMS Classifications:
++ Keywords: not associative ring
++ Reference:
++ R.D. Schafer: An Introduction to Nonassociative Algebras
++ Academic Press, New York, 1966
++ Description:
++ NonAssociativeRng is a basic ring-type structure, not necessarily
++ commutative or associative, and not necessarily with unit.
++ Axioms
++ x*(y+z) = x*y + x*z
++ (x+y)*z = x*z + y*z
++ Common Additional Axioms
++ noZeroDivisors ab = 0 => a=0 or b=0
NonAssociativeRng(): Category == Join(AbelianGroup,Monad) with
associator: (%,%,%) -> %
++ associator(a,b,c) returns \spad{(a*b)*c-a*(b*c)}.
commutator: (%,%) -> %
++ commutator(a,b) returns \spad{a*b-b*a}.
antiCommutator: (%,%) -> %
++ antiCommutator(a,b) returns \spad{a*b+b*a}.
add
associator(x,y,z) == (x*y)*z - x*(y*z)
commutator(x,y) == x*y - y*x
antiCommutator(x,y) == x*y + y*x
@
\section{category NASRING NonAssociativeRing}
<<category NASRING NonAssociativeRing>>=
)abbrev category NASRING NonAssociativeRing
++ Author: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 11 June 1991
++ Basic Operations: +, *, -, **
++ Related Constructors: NonAssociativeRng, Rng, Ring
++ Also See:
++ AMS Classifications:
++ Keywords: non-associative ring with unit
++ Reference:
++ R.D. Schafer: An Introduction to Nonassociative Algebras
++ Academic Press, New York, 1966
++ Description:
++ A NonAssociativeRing is a non associative rng which has a unit,
++ the multiplication is not necessarily commutative or associative.
NonAssociativeRing(): Category == Join(NonAssociativeRng,MonadWithUnit) with
--operations
characteristic: NonNegativeInteger
++ characteristic() returns the characteristic of the ring.
--we can not make this a constant, since some domains are mutable
coerce: Integer -> %
++ coerce(n) coerces the integer n to an element of the ring.
add
n:Integer
coerce(n) == n * 1$%
@
\section{category NAALG NonAssociativeAlgebra}
<<category NAALG NonAssociativeAlgebra>>=
)abbrev category NAALG NonAssociativeAlgebra
++ Author: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 11 June 1991
++ Basic Operations: +, -, *, **
++ Related Constructors: Algebra
++ Also See:
++ AMS Classifications:
++ Keywords: nonassociative algebra
++ Reference:
++ R.D. Schafer: An Introduction to Nonassociative Algebras
++ Academic Press, New York, 1966
++ Description:
++ NonAssociativeAlgebra is the category of non associative algebras
++ (modules which are themselves non associative rngs).
++ Axioms
++ r*(a*b) = (r*a)*b = a*(r*b)
NonAssociativeAlgebra(R:CommutativeRing): Category == _
Join(NonAssociativeRng, Module R) with
--operations
plenaryPower : (%,PositiveInteger) -> %
++ plenaryPower(a,n) is recursively defined to be
++ \spad{plenaryPower(a,n-1)*plenaryPower(a,n-1)} for \spad{n>1}
++ and \spad{a} for \spad{n=1}.
add
plenaryPower(a,n) ==
one? n => a
n1 : PositiveInteger := (n-1)::NonNegativeInteger::PositiveInteger
plenaryPower(a,n1) * plenaryPower(a,n1)
@
\section{category FINAALG FiniteRankNonAssociativeAlgebra}
<<category FINAALG FiniteRankNonAssociativeAlgebra>>=
)abbrev category FINAALG FiniteRankNonAssociativeAlgebra
++ Author: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 12 June 1991
++ Basic Operations: +,-,*,**, someBasis
++ Related Constructors: FramedNonAssociativeAlgebra, FramedAlgebra,
++ FiniteRankAssociativeAlgebra
++ Also See:
++ AMS Classifications:
++ Keywords: nonassociative algebra, basis
++ References:
++ R.D. Schafer: An Introduction to Nonassociative Algebras
++ Academic Press, New York, 1966
++
++ R. Wisbauer: Bimodule Structure of Algebra
++ Lecture Notes Univ. Duesseldorf 1991
++ Description:
++ A FiniteRankNonAssociativeAlgebra is a non associative algebra over
++ a commutative ring R which is a free \spad{R}-module of finite rank.
FiniteRankNonAssociativeAlgebra(R:CommutativeRing):
Category == NonAssociativeAlgebra R with
someBasis : () -> Vector %
++ someBasis() returns some \spad{R}-module basis.
rank : () -> PositiveInteger
++ rank() returns the rank of the algebra as \spad{R}-module.
conditionsForIdempotents: Vector % -> List Polynomial R
++ conditionsForIdempotents([v1,...,vn]) determines a complete list
++ of polynomial equations for the coefficients of idempotents
++ with respect to the \spad{R}-module basis \spad{v1},...,\spad{vn}.
structuralConstants: Vector % -> Vector Matrix R
++ structuralConstants([v1,v2,...,vm]) calculates the structural
++ constants \spad{[(gammaijk) for k in 1..m]} defined by
++ \spad{vi * vj = gammaij1 * v1 + ... + gammaijm * vm},
++ where \spad{[v1,...,vm]} is an \spad{R}-module basis
++ of a subalgebra.
leftRegularRepresentation: (% , Vector %) -> Matrix R
++ leftRegularRepresentation(a,[v1,...,vn]) returns the matrix of
++ the linear map defined by left multiplication by \spad{a}
++ with respect to the \spad{R}-module basis \spad{[v1,...,vn]}.
rightRegularRepresentation: (% , Vector %) -> Matrix R
++ rightRegularRepresentation(a,[v1,...,vn]) returns the matrix of
++ the linear map defined by right multiplication by \spad{a}
++ with respect to the \spad{R}-module basis \spad{[v1,...,vn]}.
leftTrace: % -> R
++ leftTrace(a) returns the trace of the left regular representation
++ of \spad{a}.
rightTrace: % -> R
++ rightTrace(a) returns the trace of the right regular representation
++ of \spad{a}.
leftNorm: % -> R
++ leftNorm(a) returns the determinant of the left regular representation
++ of \spad{a}.
rightNorm: % -> R
++ rightNorm(a) returns the determinant of the right regular
++ representation of \spad{a}.
coordinates: (%, Vector %) -> Vector R
++ coordinates(a,[v1,...,vn]) returns the coordinates of \spad{a}
++ with respect to the \spad{R}-module basis \spad{v1},...,\spad{vn}.
coordinates: (Vector %, Vector %) -> Matrix R
++ coordinates([a1,...,am],[v1,...,vn]) returns a matrix whose
++ i-th row is formed by the coordinates of \spad{ai}
++ with respect to the \spad{R}-module basis \spad{v1},...,\spad{vn}.
represents: (Vector R, Vector %) -> %
++ represents([a1,...,am],[v1,...,vm]) returns the linear
++ combination \spad{a1*vm + ... + an*vm}.
leftDiscriminant: Vector % -> R
++ leftDiscriminant([v1,...,vn]) returns the determinant of the
++ \spad{n}-by-\spad{n} matrix whose element at the \spad{i}-th row
++ and \spad{j}-th column is given by the left trace of the product
++ \spad{vi*vj}.
++ Note: the same as \spad{determinant(leftTraceMatrix([v1,...,vn]))}.
rightDiscriminant: Vector % -> R
++ rightDiscriminant([v1,...,vn]) returns the determinant of the
++ \spad{n}-by-\spad{n} matrix whose element at the \spad{i}-th row
++ and \spad{j}-th column is given by the right trace of the product
++ \spad{vi*vj}.
++ Note: the same as \spad{determinant(rightTraceMatrix([v1,...,vn]))}.
leftTraceMatrix: Vector % -> Matrix R
++ leftTraceMatrix([v1,...,vn]) is the \spad{n}-by-\spad{n} matrix
++ whose element at the \spad{i}-th row and \spad{j}-th column is given
++ by the left trace of the product \spad{vi*vj}.
rightTraceMatrix: Vector % -> Matrix R
++ rightTraceMatrix([v1,...,vn]) is the \spad{n}-by-\spad{n} matrix
++ whose element at the \spad{i}-th row and \spad{j}-th column is given
++ by the right trace of the product \spad{vi*vj}.
leftCharacteristicPolynomial: % -> SparseUnivariatePolynomial R
++ leftCharacteristicPolynomial(a) returns the characteristic
++ polynomial of the left regular representation of \spad{a}
++ with respect to any basis.
rightCharacteristicPolynomial: % -> SparseUnivariatePolynomial R
++ rightCharacteristicPolynomial(a) returns the characteristic
++ polynomial of the right regular representation of \spad{a}
++ with respect to any basis.
--we not necessarily have a unit
--if R has CharacteristicZero then CharacteristicZero
--if R has CharacteristicNonZero then CharacteristicNonZero
commutative?:()-> Boolean
++ commutative?() tests if multiplication in the algebra
++ is commutative.
antiCommutative?:()-> Boolean
++ antiCommutative?() tests if \spad{a*a = 0}
++ for all \spad{a} in the algebra.
++ Note: this implies \spad{a*b + b*a = 0} for all \spad{a} and \spad{b}.
associative?:()-> Boolean
++ associative?() tests if multiplication in algebra
++ is associative.
antiAssociative?:()-> Boolean
++ antiAssociative?() tests if multiplication in algebra
++ is anti-associative, i.e. \spad{(a*b)*c + a*(b*c) = 0}
++ for all \spad{a},b,c in the algebra.
leftAlternative?: ()-> Boolean
++ leftAlternative?() tests if \spad{2*associator(a,a,b) = 0}
++ for all \spad{a}, b in the algebra.
++ Note: we only can test this; in general we don't know
++ whether \spad{2*a=0} implies \spad{a=0}.
rightAlternative?: ()-> Boolean
++ rightAlternative?() tests if \spad{2*associator(a,b,b) = 0}
++ for all \spad{a}, b in the algebra.
++ Note: we only can test this; in general we don't know
++ whether \spad{2*a=0} implies \spad{a=0}.
flexible?: ()-> Boolean
++ flexible?() tests if \spad{2*associator(a,b,a) = 0}
++ for all \spad{a}, b in the algebra.
++ Note: we only can test this; in general we don't know
++ whether \spad{2*a=0} implies \spad{a=0}.
alternative?: ()-> Boolean
++ alternative?() tests if
++ \spad{2*associator(a,a,b) = 0 = 2*associator(a,b,b)}
++ for all \spad{a}, b in the algebra.
++ Note: we only can test this; in general we don't know
++ whether \spad{2*a=0} implies \spad{a=0}.
powerAssociative?:()-> Boolean
++ powerAssociative?() tests if all subalgebras
++ generated by a single element are associative.
jacobiIdentity?:() -> Boolean
++ jacobiIdentity?() tests if \spad{(a*b)*c + (b*c)*a + (c*a)*b = 0}
++ for all \spad{a},b,c in the algebra. For example, this holds
++ for crossed products of 3-dimensional vectors.
lieAdmissible?: () -> Boolean
++ lieAdmissible?() tests if the algebra defined by the commutators
++ is a Lie algebra, i.e. satisfies the Jacobi identity.
++ The property of anticommutativity follows from definition.
jordanAdmissible?: () -> Boolean
++ jordanAdmissible?() tests if 2 is invertible in the
++ coefficient domain and the multiplication defined by
++ \spad{(1/2)(a*b+b*a)} determines a
++ Jordan algebra, i.e. satisfies the Jordan identity.
++ The property of \spadatt{commutative("*")}
++ follows from by definition.
noncommutativeJordanAlgebra?: () -> Boolean
++ noncommutativeJordanAlgebra?() tests if the algebra
++ is flexible and Jordan admissible.
jordanAlgebra?:() -> Boolean
++ jordanAlgebra?() tests if the algebra is commutative,
++ characteristic is not 2, and \spad{(a*b)*a**2 - a*(b*a**2) = 0}
++ for all \spad{a},b,c in the algebra (Jordan identity).
++ Example:
++ for every associative algebra \spad{(A,+,@)} we can construct a
++ Jordan algebra \spad{(A,+,*)}, where \spad{a*b := (a@b+b@a)/2}.
lieAlgebra?:() -> Boolean
++ lieAlgebra?() tests if the algebra is anticommutative
++ and \spad{(a*b)*c + (b*c)*a + (c*a)*b = 0}
++ for all \spad{a},b,c in the algebra (Jacobi identity).
++ Example:
++ for every associative algebra \spad{(A,+,@)} we can construct a
++ Lie algebra \spad{(A,+,*)}, where \spad{a*b := a@b-b@a}.
if R has IntegralDomain then
-- we not neccessarily have a unit, hence we don't inherit
-- the next 3 functions anc hence copy them from MonadWithUnit:
recip: % -> Union(%,"failed")
++ recip(a) returns an element, which is both a left and a right
++ inverse of \spad{a},
++ or \spad{"failed"} if there is no unit element, if such an
++ element doesn't exist or cannot be determined (see unitsKnown).
leftRecip: % -> Union(%,"failed")
++ leftRecip(a) returns an element, which is a left inverse of \spad{a},
++ or \spad{"failed"} if there is no unit element, if such an
++ element doesn't exist or cannot be determined (see unitsKnown).
rightRecip: % -> Union(%,"failed")
++ rightRecip(a) returns an element, which is a right inverse of
++ \spad{a},
++ or \spad{"failed"} if there is no unit element, if such an
++ element doesn't exist or cannot be determined (see unitsKnown).
associatorDependence:() -> List Vector R
++ associatorDependence() looks for the associator identities, i.e.
++ finds a basis of the solutions of the linear combinations of the
++ six permutations of \spad{associator(a,b,c)} which yield 0,
++ for all \spad{a},b,c in the algebra.
++ The order of the permutations is \spad{123 231 312 132 321 213}.
leftMinimalPolynomial : % -> SparseUnivariatePolynomial R
++ leftMinimalPolynomial(a) returns the polynomial determined by the
++ smallest non-trivial linear combination of left powers of \spad{a}.
++ Note: the polynomial never has a constant term as in general
++ the algebra has no unit.
rightMinimalPolynomial : % -> SparseUnivariatePolynomial R
++ rightMinimalPolynomial(a) returns the polynomial determined by the
++ smallest non-trivial linear
++ combination of right powers of \spad{a}.
++ Note: the polynomial never has a constant term as in general
++ the algebra has no unit.
leftUnits:() -> Union(Record(particular: %, basis: List %), "failed")
++ leftUnits() returns the affine space of all left units of the
++ algebra, or \spad{"failed"} if there is none.
rightUnits:() -> Union(Record(particular: %, basis: List %), "failed")
++ rightUnits() returns the affine space of all right units of the
++ algebra, or \spad{"failed"} if there is none.
leftUnit:() -> Union(%, "failed")
++ leftUnit() returns a left unit of the algebra
++ (not necessarily unique), or \spad{"failed"} if there is none.
rightUnit:() -> Union(%, "failed")
++ rightUnit() returns a right unit of the algebra
++ (not necessarily unique), or \spad{"failed"} if there is none.
unit:() -> Union(%, "failed")
++ unit() returns a unit of the algebra (necessarily unique),
++ or \spad{"failed"} if there is none.
-- we not necessarily have a unit, hence we can't say anything
-- about characteristic
-- if R has CharacteristicZero then CharacteristicZero
-- if R has CharacteristicNonZero then CharacteristicNonZero
unitsKnown
++ unitsKnown means that \spadfun{recip} truly yields reciprocal
++ or \spad{"failed"} if not a unit,
++ similarly for \spadfun{leftRecip} and
++ \spadfun{rightRecip}. The reason is that we use left, respectively
++ right, minimal polynomials to decide this question.
add
--n := rank()
--b := someBasis()
--gamma : Vector Matrix R := structuralConstants b
-- here is a problem: there seems to be a problem having local
-- variables in the capsule of a category, furthermore
-- see the commented code of conditionsForIdempotents, where
-- we call structuralConstants, which also doesn't work
-- at runtime, i.e. is not properly inherited, hence for
-- the moment we put the code for
-- conditionsForIdempotents, structuralConstants, unit, leftUnit,
-- rightUnit into the domain constructor ALGSC
V ==> Vector
M ==> Matrix
REC ==> Record(particular: Union(V R,"failed"),basis: List V R)
LSMP ==> LinearSystemMatrixPackage(R,V R,V R, M R)
SUP ==> SparseUnivariatePolynomial
NNI ==> NonNegativeInteger
-- next 2 functions: use a general characteristicPolynomial
leftCharacteristicPolynomial a ==
n := rank()$%
ma : Matrix R := leftRegularRepresentation(a,someBasis()$%)
mb : Matrix SUP R := zero(n,n)
for i in 1..n repeat
for j in 1..n repeat
mb(i,j):=
i=j => monomial(ma(i,j),0)$SUP(R) - monomial(1,1)$SUP(R)
monomial(ma(i,j),1)$SUP(R)
determinant mb
rightCharacteristicPolynomial a ==
n := rank()$%
ma : Matrix R := rightRegularRepresentation(a,someBasis()$%)
mb : Matrix SUP R := zero(n,n)
for i in 1..n repeat
for j in 1..n repeat
mb(i,j):=
i=j => monomial(ma(i,j),0)$SUP(R) - monomial(1,1)$SUP(R)
monomial(ma(i,j),1)$SUP(R)
determinant mb
leftTrace a ==
t : R := 0
ma : Matrix R := leftRegularRepresentation(a,someBasis()$%)
for i in 1..rank()$% repeat
t := t + elt(ma,i,i)
t
rightTrace a ==
t : R := 0
ma : Matrix R := rightRegularRepresentation(a,someBasis()$%)
for i in 1..rank()$% repeat
t := t + elt(ma,i,i)
t
leftNorm a == determinant leftRegularRepresentation(a,someBasis()$%)
rightNorm a == determinant rightRegularRepresentation(a,someBasis()$%)
antiAssociative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? ( (b.i*b.j)*b.k + b.i*(b.j*b.k) ) =>
messagePrint("algebra is not anti-associative")$OutputForm
return false
messagePrint("algebra is anti-associative")$OutputForm
true
jordanAdmissible?() ==
b := someBasis()
n := rank()
recip(2 * 1$R) case "failed" =>
messagePrint("this algebra is not Jordan admissible, as 2 is not invertible in the ground ring")$OutputForm
false
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
for l in 1..n repeat
not zero? ( _
antiCommutator(antiCommutator(b.i,b.j),antiCommutator(b.l,b.k)) + _
antiCommutator(antiCommutator(b.l,b.j),antiCommutator(b.k,b.i)) + _
antiCommutator(antiCommutator(b.k,b.j),antiCommutator(b.i,b.l)) _
) =>
messagePrint("this algebra is not Jordan admissible")$OutputForm
return false
messagePrint("this algebra is Jordan admissible")$OutputForm
true
lieAdmissible?() ==
n := rank()
b := someBasis()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? (commutator(commutator(b.i,b.j),b.k) _
+ commutator(commutator(b.j,b.k),b.i) _
+ commutator(commutator(b.k,b.i),b.j)) =>
messagePrint("this algebra is not Lie admissible")$OutputForm
return false
messagePrint("this algebra is Lie admissible")$OutputForm
true
-- conditionsForIdempotents b ==
-- n := rank()
-- gamma : Vector Matrix R := structuralConstants b
-- listOfNumbers : List String := [string(q)$String for q in 1..n]
-- symbolsForCoef : Vector Symbol :=
-- [concat("%", concat("x", i))::Symbol for i in listOfNumbers]
-- conditions : List Polynomial R := []
-- for k in 1..n repeat
-- xk := symbolsForCoef.k
-- p : Polynomial R := monomial( - 1$Polynomial(R), [xk], [1] )
-- for i in 1..n repeat
-- for j in 1..n repeat
-- xi := symbolsForCoef.i
-- xj := symbolsForCoef.j
-- p := p + monomial(_
-- elt((gamma.k),i,j) :: Polynomial(R), [xi,xj], [1,1])
-- conditions := cons(p,conditions)
-- conditions
structuralConstants b ==
--n := rank()
-- be careful with the possibility that b is not a basis
m : NonNegativeInteger := (maxIndex b) :: NonNegativeInteger
sC : Vector Matrix R := [new(m,m,0$R) for k in 1..m]
for i in 1..m repeat
for j in 1..m repeat
covec : Vector R := coordinates(b.i * b.j, b)
for k in 1..m repeat
setelt( sC.k, i, j, covec.k )
sC
if R has IntegralDomain then
leftRecip x ==
zero? x => "failed"
lu := leftUnit()
lu case "failed" => "failed"
b := someBasis()
xx : % := (lu :: %)
k : PositiveInteger := 1
cond : Matrix R := coordinates(xx,b) :: Matrix(R)
listOfPowers : List % := [xx]
while rank(cond) = k repeat
k := k+1
xx := xx*x
listOfPowers := cons(xx,listOfPowers)
cond := horizConcat(cond, coordinates(xx,b) :: Matrix(R) )
vectorOfCoef : Vector R := (nullSpace(cond)$Matrix(R)).first
invC := recip vectorOfCoef.1
invC case "failed" => "failed"
invCR : R := - (invC :: R)
reduce(_+,[(invCR*vectorOfCoef.i)*power for i in _
2..maxIndex vectorOfCoef for power in reverse listOfPowers])
rightRecip x ==
zero? x => "failed"
ru := rightUnit()
ru case "failed" => "failed"
b := someBasis()
xx : % := (ru :: %)
k : PositiveInteger := 1
cond : Matrix R := coordinates(xx,b) :: Matrix(R)
listOfPowers : List % := [xx]
while rank(cond) = k repeat
k := k+1
xx := x*xx
listOfPowers := cons(xx,listOfPowers)
cond := horizConcat(cond, coordinates(xx,b) :: Matrix(R) )
vectorOfCoef : Vector R := (nullSpace(cond)$Matrix(R)).first
invC := recip vectorOfCoef.1
invC case "failed" => "failed"
invCR : R := - (invC :: R)
reduce(_+,[(invCR*vectorOfCoef.i)*power for i in _
2..maxIndex vectorOfCoef for power in reverse listOfPowers])
recip x ==
lrx := leftRecip x
lrx case "failed" => "failed"
rrx := rightRecip x
rrx case "failed" => "failed"
(lrx :: %) ~= (rrx :: %) => "failed"
lrx :: %
leftMinimalPolynomial x ==
zero? x => monomial(1$R,1)$(SparseUnivariatePolynomial R)
b := someBasis()
xx : % := x
k : PositiveInteger := 1
cond : Matrix R := coordinates(xx,b) :: Matrix(R)
while rank(cond) = k repeat
k := k+1
xx := x*xx
cond := horizConcat(cond, coordinates(xx,b) :: Matrix(R) )
vectorOfCoef : Vector R := (nullSpace(cond)$Matrix(R)).first
res : SparseUnivariatePolynomial R := 0
for i in 1..k repeat
res := res+monomial(vectorOfCoef.i,i)$(SparseUnivariatePolynomial R)
res
rightMinimalPolynomial x ==
zero? x => monomial(1$R,1)$(SparseUnivariatePolynomial R)
b := someBasis()
xx : % := x
k : PositiveInteger := 1
cond : Matrix R := coordinates(xx,b) :: Matrix(R)
while rank(cond) = k repeat
k := k+1
xx := xx*x
cond := horizConcat(cond, coordinates(xx,b) :: Matrix(R) )
vectorOfCoef : Vector R := (nullSpace(cond)$Matrix(R)).first
res : SparseUnivariatePolynomial R := 0
for i in 1..k repeat
res := res+monomial(vectorOfCoef.i,i)$(SparseUnivariatePolynomial R)
res
associatorDependence() ==
n := rank()
b := someBasis()
cond : Matrix(R) := new(n**4,6,0$R)$Matrix(R)
z : Integer := 0
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
a123 : Vector R := coordinates(associator(b.i,b.j,b.k),b)
a231 : Vector R := coordinates(associator(b.j,b.k,b.i),b)
a312 : Vector R := coordinates(associator(b.k,b.i,b.j),b)
a132 : Vector R := coordinates(associator(b.i,b.k,b.j),b)
a321 : Vector R := coordinates(associator(b.k,b.j,b.i),b)
a213 : Vector R := coordinates(associator(b.j,b.i,b.k),b)
for r in 1..n repeat
z:= z+1
setelt(cond,z,1,elt(a123,r))
setelt(cond,z,2,elt(a231,r))
setelt(cond,z,3,elt(a312,r))
setelt(cond,z,4,elt(a132,r))
setelt(cond,z,5,elt(a321,r))
setelt(cond,z,6,elt(a213,r))
nullSpace(cond)
jacobiIdentity?() ==
n := rank()
b := someBasis()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? ((b.i*b.j)*b.k + (b.j*b.k)*b.i + (b.k*b.i)*b.j) =>
messagePrint("Jacobi identity does not hold")$OutputForm
return false
messagePrint("Jacobi identity holds")$OutputForm
true
lieAlgebra?() ==
not antiCommutative?() =>
messagePrint("this is not a Lie algebra")$OutputForm
false
not jacobiIdentity?() =>
messagePrint("this is not a Lie algebra")$OutputForm
false
messagePrint("this is a Lie algebra")$OutputForm
true
jordanAlgebra?() ==
b := someBasis()
n := rank()
recip(2 * 1$R) case "failed" =>
messagePrint("this is not a Jordan algebra, as 2 is not invertible in the ground ring")$OutputForm
false
not commutative?() =>
messagePrint("this is not a Jordan algebra")$OutputForm
false
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
for l in 1..n repeat
not zero? (associator(b.i,b.j,b.l*b.k)+_
associator(b.l,b.j,b.k*b.i)+associator(b.k,b.j,b.i*b.l)) =>
messagePrint("not a Jordan algebra")$OutputForm
return false
messagePrint("this is a Jordan algebra")$OutputForm
true
noncommutativeJordanAlgebra?() ==
b := someBasis()
n := rank()
recip(2 * 1$R) case "failed" =>
messagePrint("this is not a noncommutative Jordan algebra, as 2 is not invertible in the ground ring")$OutputForm
false
not flexible?()$% =>
messagePrint("this is not a noncommutative Jordan algebra, as it is not flexible")$OutputForm
false
not jordanAdmissible?()$% =>
messagePrint("this is not a noncommutative Jordan algebra, as it is not Jordan admissible")$OutputForm
false
messagePrint("this is a noncommutative Jordan algebra")$OutputForm
true
antiCommutative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in i..n repeat
not zero? (i=j => b.i*b.i; b.i*b.j + b.j*b.i) =>
messagePrint("algebra is not anti-commutative")$OutputForm
return false
messagePrint("algebra is anti-commutative")$OutputForm
true
commutative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in i+1..n repeat
not zero? commutator(b.i,b.j) =>
messagePrint("algebra is not commutative")$OutputForm
return false
messagePrint("algebra is commutative")$OutputForm
true
associative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? associator(b.i,b.j,b.k) =>
messagePrint("algebra is not associative")$OutputForm
return false
messagePrint("algebra is associative")$OutputForm
true
leftAlternative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? (associator(b.i,b.j,b.k) + associator(b.j,b.i,b.k)) =>
messagePrint("algebra is not left alternative")$OutputForm
return false
messagePrint("algebra satisfies 2*associator(a,a,b) = 0")$OutputForm
true
rightAlternative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? (associator(b.i,b.j,b.k) + associator(b.i,b.k,b.j)) =>
messagePrint("algebra is not right alternative")$OutputForm
return false
messagePrint("algebra satisfies 2*associator(a,b,b) = 0")$OutputForm
true
flexible?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? (associator(b.i,b.j,b.k) + associator(b.k,b.j,b.i)) =>
messagePrint("algebra is not flexible")$OutputForm
return false
messagePrint("algebra satisfies 2*associator(a,b,a) = 0")$OutputForm
true
alternative?() ==
b := someBasis()
n := rank()
for i in 1..n repeat
for j in 1..n repeat
for k in 1..n repeat
not zero? (associator(b.i,b.j,b.k) + associator(b.j,b.i,b.k)) =>
messagePrint("algebra is not alternative")$OutputForm
return false
not zero? (associator(b.i,b.j,b.k) + associator(b.i,b.k,b.j)) =>
messagePrint("algebra is not alternative")$OutputForm
return false
messagePrint("algebra satisfies 2*associator(a,b,b) = 0 = 2*associator(a,a,b) = 0")$OutputForm
true
leftDiscriminant v == determinant leftTraceMatrix v
rightDiscriminant v == determinant rightTraceMatrix v
coordinates(v:Vector %, b:Vector %) ==
m := new(#v, #b, 0)$Matrix(R)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
setRow!(m, j, coordinates(qelt(v, i), b))
m
represents(v, b) ==
m := minIndex v - 1
reduce(_+,[v(i+m) * b(i+m) for i in 1..maxIndex b])
leftTraceMatrix v ==
matrix [[leftTrace(v.i*v.j) for j in minIndex v..maxIndex v]$List(R)
for i in minIndex v .. maxIndex v]$List(List R)
rightTraceMatrix v ==
matrix [[rightTrace(v.i*v.j) for j in minIndex v..maxIndex v]$List(R)
for i in minIndex v .. maxIndex v]$List(List R)
leftRegularRepresentation(x, b) ==
m := minIndex b - 1
matrix
[members coordinates(x*b(i+m),b) for i in 1..rank()]$List(List R)
rightRegularRepresentation(x, b) ==
m := minIndex b - 1
matrix
[members coordinates(b(i+m)*x,b) for i in 1..rank()]$List(List R)
@
\section{category FRNAALG FramedNonAssociativeAlgebra}
<<category FRNAALG FramedNonAssociativeAlgebra>>=
)abbrev category FRNAALG FramedNonAssociativeAlgebra
++ Author: J. Grabmeier, R. Wisbauer
++ Date Created: 01 March 1991
++ Date Last Updated: 11 June 1991
++ Basic Operations: +,-,*,**,basis
++ Related Constructors: FiniteRankNonAssociativeAlgebra, FramedAlgebra,
++ FiniteRankAssociativeAlgebra
++ Also See:
++ AMS Classifications:
++ Keywords: nonassociative algebra, basis
++ Reference:
++ R.D. Schafer: An Introduction to Nonassociative Algebras
++ Academic Press, New York, 1966
++ Description:
++ FramedNonAssociativeAlgebra(R) is a
++ \spadtype{FiniteRankNonAssociativeAlgebra} (i.e. a non associative
++ algebra over R which is a free \spad{R}-module of finite rank)
++ over a commutative ring R together with a fixed \spad{R}-module basis.
FramedNonAssociativeAlgebra(R:CommutativeRing): Category == _
Join(FiniteRankNonAssociativeAlgebra(R),Eltable(Integer,R)) with
--operations
basis: () -> Vector %
++ basis() returns the fixed \spad{R}-module basis.
coordinates: % -> Vector R
++ coordinates(a) returns the coordinates of \spad{a}
++ with respect to the
++ fixed \spad{R}-module basis.
coordinates: Vector % -> Matrix R
++ coordinates([a1,...,am]) returns a matrix whose i-th row
++ is formed by the coordinates of \spad{ai} with respect to the
++ fixed \spad{R}-module basis.
structuralConstants:() -> Vector Matrix R
++ structuralConstants() calculates the structural constants
++ \spad{[(gammaijk) for k in 1..rank()]} defined by
++ \spad{vi * vj = gammaij1 * v1 + ... + gammaijn * vn},
++ where \spad{v1},...,\spad{vn} is the fixed \spad{R}-module basis.
conditionsForIdempotents: () -> List Polynomial R
++ conditionsForIdempotents() determines a complete list
++ of polynomial equations for the coefficients of idempotents
++ with respect to the fixed \spad{R}-module basis.
represents: Vector R -> %
++ represents([a1,...,an]) returns \spad{a1*v1 + ... + an*vn},
++ where \spad{v1}, ..., \spad{vn} are the elements of the
++ fixed \spad{R}-module basis.
convert: % -> Vector R
++ convert(a) returns the coordinates of \spad{a} with respect to the
++ fixed \spad{R}-module basis.
convert: Vector R -> %
++ convert([a1,...,an]) returns \spad{a1*v1 + ... + an*vn},
++ where \spad{v1}, ..., \spad{vn} are the elements of the
++ fixed \spad{R}-module basis.
leftDiscriminant : () -> R
++ leftDiscriminant() returns the
++ determinant of the \spad{n}-by-\spad{n}
++ matrix whose element at the \spad{i}-th row and \spad{j}-th column is
++ given by the left trace of the product \spad{vi*vj}, where
++ \spad{v1},...,\spad{vn} are the
++ elements of the fixed \spad{R}-module basis.
++ Note: the same as \spad{determinant(leftTraceMatrix())}.
rightDiscriminant : () -> R
++ rightDiscriminant() returns the determinant of the \spad{n}-by-\spad{n}
++ matrix whose element at the \spad{i}-th row and \spad{j}-th column is
++ given by the right trace of the product \spad{vi*vj}, where
++ \spad{v1},...,\spad{vn} are the elements of
++ the fixed \spad{R}-module basis.
++ Note: the same as \spad{determinant(rightTraceMatrix())}.
leftTraceMatrix : () -> Matrix R
++ leftTraceMatrix() is the \spad{n}-by-\spad{n}
++ matrix whose element at the \spad{i}-th row and \spad{j}-th column is
++ given by left trace of the product \spad{vi*vj},
++ where \spad{v1},...,\spad{vn} are the
++ elements of the fixed \spad{R}-module
++ basis.
rightTraceMatrix : () -> Matrix R
++ rightTraceMatrix() is the \spad{n}-by-\spad{n}
++ matrix whose element at the \spad{i}-th row and \spad{j}-th column is
++ given by the right trace of the product \spad{vi*vj}, where
++ \spad{v1},...,\spad{vn} are the elements
++ of the fixed \spad{R}-module basis.
leftRegularRepresentation : % -> Matrix R
++ leftRegularRepresentation(a) returns the matrix of the linear
++ map defined by left multiplication by \spad{a} with respect
++ to the fixed \spad{R}-module basis.
rightRegularRepresentation : % -> Matrix R
++ rightRegularRepresentation(a) returns the matrix of the linear
++ map defined by right multiplication by \spad{a} with respect
++ to the fixed \spad{R}-module basis.
if R has Field then
leftRankPolynomial : () -> SparseUnivariatePolynomial Polynomial R
++ leftRankPolynomial() calculates the left minimal polynomial
++ of the generic element in the algebra,
++ defined by the same structural
++ constants over the polynomial ring in symbolic coefficients with
++ respect to the fixed basis.
rightRankPolynomial : () -> SparseUnivariatePolynomial Polynomial R
++ rightRankPolynomial() calculates the right minimal polynomial
++ of the generic element in the algebra,
++ defined by the same structural
++ constants over the polynomial ring in symbolic coefficients with
++ respect to the fixed basis.
apply: (Matrix R, %) -> %
++ apply(m,a) defines a left operation of n by n matrices
++ where n is the rank of the algebra in terms of matrix-vector
++ multiplication, this is a substitute for a left module structure.
++ Error: if shape of matrix doesn't fit.
--attributes
--attributes
--separable <=> discriminant() ~= 0
add
V ==> Vector
M ==> Matrix
P ==> Polynomial
F ==> Fraction
REC ==> Record(particular: Union(V R,"failed"),basis: List V R)
LSMP ==> LinearSystemMatrixPackage(R,V R,V R, M R)
CVMP ==> CoerceVectorMatrixPackage(R)
--GA ==> GenericNonAssociativeAlgebra(R,rank()$%,_
-- [random()$Character :: String :: Symbol for i in 1..rank()$%], _
-- structuralConstants()$%)
--y : GA := generic()
if R has Field then
leftRankPolynomial() ==
n := rank()
b := basis()
gamma : Vector Matrix R := structuralConstants b
listOfNumbers : List String := [string(q)$String for q in 1..n]
symbolsForCoef : Vector Symbol :=
[concat("%", concat("x", i))::Symbol for i in listOfNumbers]
xx : M P R := new(1,n,0)
mo : P R
x : M P R := new(1,n,0)
for i in 1..n repeat
mo := monomial(1, [symbolsForCoef.i], [1])$(P R)
qsetelt!(x,1,i,mo)
y : M P R := copy x
k : PositiveInteger := 1
cond : M P R := copy x
-- multiplication in the generic algebra means using
-- the structural matrices as bilinear forms.
-- left multiplication by x, we prepare for that:
genGamma : V M P R := coerceP$CVMP gamma
x := reduce(horizConcat,[x*genGamma(i) for i in 1..#genGamma])
while rank(cond) = k repeat
k := k+1
for i in 1..n repeat
setelt(xx,[1],[i],x*transpose y)
y := copy xx
cond := horizConcat(cond, xx)
vectorOfCoef : Vector P R := (nullSpace(cond)$Matrix(P R)).first
res : SparseUnivariatePolynomial P R := 0
for i in 1..k repeat
res := res+monomial(vectorOfCoef.i,i)$(SparseUnivariatePolynomial P R)
res
rightRankPolynomial() ==
n := rank()
b := basis()
gamma : Vector Matrix R := structuralConstants b
listOfNumbers : List String := [string(q)$String for q in 1..n]
symbolsForCoef : Vector Symbol :=
[concat("%", concat("x", i))::Symbol for i in listOfNumbers]
xx : M P R := new(1,n,0)
mo : P R
x : M P R := new(1,n,0)
for i in 1..n repeat
mo := monomial(1, [symbolsForCoef.i], [1])$(P R)
qsetelt!(x,1,i,mo)
y : M P R := copy x
k : PositiveInteger := 1
cond : M P R := copy x
-- multiplication in the generic algebra means using
-- the structural matrices as bilinear forms.
-- left multiplication by x, we prepare for that:
genGamma : V M P R := coerceP$CVMP gamma
x := reduce(horizConcat,[genGamma(i)*transpose x for i in 1..#genGamma])
while rank(cond) = k repeat
k := k+1
for i in 1..n repeat
setelt(xx,[1],[i],y * transpose x)
y := copy xx
cond := horizConcat(cond, xx)
vectorOfCoef : Vector P R := (nullSpace(cond)$Matrix(P R)).first
res : SparseUnivariatePolynomial P R := 0
for i in 1..k repeat
res := res+monomial(vectorOfCoef.i,i)$(SparseUnivariatePolynomial P R)
res
leftUnitsInternal : () -> REC
leftUnitsInternal() ==
n := rank()
b := basis()
gamma : Vector Matrix R := structuralConstants b
cond : Matrix(R) := new(n**2,n,0$R)$Matrix(R)
rhs : Vector(R) := new(n**2,0$R)$Vector(R)
z : Integer := 0
addOn : R := 0
for k in 1..n repeat
for i in 1..n repeat
z := z+1 -- index for the rows
addOn :=
k=i => 1
0
setelt(rhs,z,addOn)$Vector(R)
for j in 1..n repeat -- index for the columns
setelt(cond,z,j,elt(gamma.k,j,i))$Matrix(R)
solve(cond,rhs)$LSMP
leftUnit() ==
res : REC := leftUnitsInternal()
res.particular case "failed" =>
messagePrint("this algebra has no left unit")$OutputForm
"failed"
represents (res.particular :: V R)
leftUnits() ==
res : REC := leftUnitsInternal()
res.particular case "failed" =>
messagePrint("this algebra has no left unit")$OutputForm
"failed"
[represents(res.particular :: V R)$%, _
map(represents, res.basis)$ListFunctions2(Vector R, %) ]
rightUnitsInternal : () -> REC
rightUnitsInternal() ==
n := rank()
b := basis()
gamma : Vector Matrix R := structuralConstants b
condo : Matrix(R) := new(n**2,n,0$R)$Matrix(R)
rhs : Vector(R) := new(n**2,0$R)$Vector(R)
z : Integer := 0
addOn : R := 0
for k in 1..n repeat
for i in 1..n repeat
z := z+1 -- index for the rows
addOn :=
k=i => 1
0
setelt(rhs,z,addOn)$Vector(R)
for j in 1..n repeat -- index for the columns
setelt(condo,z,j,elt(gamma.k,i,j))$Matrix(R)
solve(condo,rhs)$LSMP
rightUnit() ==
res : REC := rightUnitsInternal()
res.particular case "failed" =>
messagePrint("this algebra has no right unit")$OutputForm
"failed"
represents (res.particular :: V R)
rightUnits() ==
res : REC := rightUnitsInternal()
res.particular case "failed" =>
messagePrint("this algebra has no right unit")$OutputForm
"failed"
[represents(res.particular :: V R)$%, _
map(represents, res.basis)$ListFunctions2(Vector R, %) ]
unit() ==
n := rank()
b := basis()
gamma : Vector Matrix R := structuralConstants b
cond : Matrix(R) := new(2*n**2,n,0$R)$Matrix(R)
rhs : Vector(R) := new(2*n**2,0$R)$Vector(R)
z : Integer := 0
u : Integer := n*n
addOn : R := 0
for k in 1..n repeat
for i in 1..n repeat
z := z+1 -- index for the rows
addOn :=
k=i => 1
0
setelt(rhs,z,addOn)$Vector(R)
setelt(rhs,u,addOn)$Vector(R)
for j in 1..n repeat -- index for the columns
setelt(cond,z,j,elt(gamma.k,j,i))$Matrix(R)
setelt(cond,u,j,elt(gamma.k,i,j))$Matrix(R)
res : REC := solve(cond,rhs)$LSMP
res.particular case "failed" =>
messagePrint("this algebra has no unit")$OutputForm
"failed"
represents (res.particular :: V R)
apply(m:Matrix(R),a:%) ==
v : Vector R := coordinates(a)
v := m *$Matrix(R) v
convert v
structuralConstants() == structuralConstants basis()
conditionsForIdempotents() == conditionsForIdempotents basis()
convert(x:%):Vector(R) == coordinates(x, basis())
convert(v:Vector R):% == represents(v, basis())
leftTraceMatrix() == leftTraceMatrix basis()
rightTraceMatrix() == rightTraceMatrix basis()
leftDiscriminant() == leftDiscriminant basis()
rightDiscriminant() == rightDiscriminant basis()
leftRegularRepresentation x == leftRegularRepresentation(x, basis())
rightRegularRepresentation x == rightRegularRepresentation(x, basis())
coordinates(x: %) == coordinates(x, basis())
represents(v:Vector R):%== represents(v, basis())
coordinates(v:Vector %) ==
m := new(#v, rank(), 0)$Matrix(R)
for i in minIndex v .. maxIndex v for j in minRowIndex m .. repeat
setRow!(m, j, coordinates qelt(v, i))
m
@
\section{License}
<<license>>=
--Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
--All rights reserved.
--
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are
--met:
--
-- - Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
--
-- - Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in
-- the documentation and/or other materials provided with the
-- distribution.
--
-- - Neither the name of The Numerical ALgorithms Group Ltd. nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--
--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
--IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
--TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
--PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
--OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
--EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
--PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
--PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
--LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
--NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@
<<*>>=
<<license>>
<<category MONAD Monad>>
<<category MONADWU MonadWithUnit>>
<<category NARNG NonAssociativeRng>>
<<category NASRING NonAssociativeRing>>
<<category NAALG NonAssociativeAlgebra>>
<<category FINAALG FiniteRankNonAssociativeAlgebra>>
<<category FRNAALG FramedNonAssociativeAlgebra>>
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}
|