aboutsummaryrefslogtreecommitdiff
path: root/generics
diff options
context:
space:
mode:
Diffstat (limited to 'generics')
-rw-r--r--generics/commutative-test.pd61
-rw-r--r--generics/commutator.pd33
2 files changed, 68 insertions, 26 deletions
diff --git a/generics/commutative-test.pd b/generics/commutative-test.pd
index 58359aa..54153e7 100644
--- a/generics/commutative-test.pd
+++ b/generics/commutative-test.pd
@@ -1,26 +1,35 @@
-#N canvas 394 81 620 407 10;
-#X obj 18 84 \$1;
-#X obj 52 158 -;
-#X obj 68 115 \$1;
-#X obj 68 96 f;
-#X obj 18 19 inlet a;
-#X obj 84 32 inlet b;
-#X text 75 134 ba;
-#X text 33 103 ab;
-#X obj 49 376 outlet uh...;
-#X text 170 21 commutativity rule for operator \$1 is ab=ba;
-#X text 170 38 that's like ab-ba=0;
-#X obj 18 38 t a b a;
-#X text 10 158 note: - is float-only;
-#X text 170 54 absolute error is ab-ba;
-#X text 172 71 what is relative error supposed to be relative to?;
-#X text 172 88 (we don't know what the real result is);
-#X connect 0 0 1 0;
-#X connect 2 0 1 1;
-#X connect 3 0 2 0;
-#X connect 4 0 11 0;
-#X connect 5 0 3 1;
-#X connect 5 0 0 1;
-#X connect 11 0 0 0;
-#X connect 11 1 3 0;
-#X connect 11 2 2 1;
+#N canvas 671 304 452 362 10;
+#X obj 40 15 inlet bang;
+#X obj 40 129 unpack 0 0;
+#X obj 40 53 t a a;
+#X obj 70 72 +;
+#X obj 70 91 / 2;
+#X obj 33 172 abs;
+#X obj 70 110 abs;
+#X obj 33 191 /;
+#X obj 33 153 commutator +;
+#X msg 40 34 1 3;
+#X text 216 9 This test verifies that 1+3=3+1;
+#X obj 33 210 t a a;
+#X obj 33 248 pack 0 0;
+#X obj 33 286 outlet;
+#X text 217 24 with tolerance 0;
+#X obj 33 229 <= 0;
+#X msg 33 267 list commutative1 \$1 \$2 -;
+#X connect 0 0 9 0;
+#X connect 1 0 8 0;
+#X connect 1 1 8 1;
+#X connect 2 0 1 0;
+#X connect 2 1 3 0;
+#X connect 3 0 4 0;
+#X connect 4 0 6 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 1;
+#X connect 7 0 11 0;
+#X connect 8 0 5 0;
+#X connect 9 0 2 0;
+#X connect 11 0 15 0;
+#X connect 11 1 12 1;
+#X connect 12 0 16 0;
+#X connect 15 0 12 0;
+#X connect 16 0 13 0;
diff --git a/generics/commutator.pd b/generics/commutator.pd
new file mode 100644
index 0000000..5dba66a
--- /dev/null
+++ b/generics/commutator.pd
@@ -0,0 +1,33 @@
+#N canvas 394 81 620 407 10;
+#X obj 18 84 \$1;
+#X obj 52 158 -;
+#X obj 68 115 \$1;
+#X obj 68 96 f;
+#X obj 18 19 inlet a;
+#X obj 84 32 inlet b;
+#X text 75 134 ba;
+#X text 33 103 ab;
+#X obj 18 38 t a b a;
+#X text 10 158 note: - is float-only;
+#X text 218 15 commutativity rule for operator \$1 is: a \$1 b = b
+\$1 a;
+#X text 218 32 which is also a \$1 b - b \$1 a = 0;
+#X text 218 48 the commutator is a \$1 b - b \$1 a;
+#X obj 52 177 outlet ab-ba;
+#X text 189 112 when \$1 = + this is also known as a "group commutator"
+;
+#X text 189 132 when \$1 = * this is also known as a "ring commutator"
+;
+#X text 190 153 however \, this thing i call commutator is more general
+;
+#X text 189 172 see commutative-test.pd;
+#X connect 0 0 1 0;
+#X connect 1 0 13 0;
+#X connect 2 0 1 1;
+#X connect 3 0 2 0;
+#X connect 4 0 8 0;
+#X connect 5 0 3 1;
+#X connect 5 0 0 1;
+#X connect 8 0 0 0;
+#X connect 8 1 3 0;
+#X connect 8 2 2 1;