You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 05_swap.html
+32-13Lines changed: 32 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -210,7 +210,7 @@ <h3>Relative and absolute efficiency</h3>
210
210
I still program in C++ because as far as I could ascertain it’s the only language which allows me
211
211
generality and absolute efficiency.
212
212
I can program as general as I like.
213
-
I can talk about things like <ahref="https://en.wikipedia.org/wiki/Monoid">monoids</a> and <ahref="https://en.wikipedia.org/wiki/Semigroup">semi-groups</a>.
213
+
I can talk about things like <ahref="https://en.wikipedia.org/wiki/Monoid">monoids</a> and <ahref="https://en.wikipedia.org/wiki/Semigroup">semi-groups</a><supid="fnref:1"><ahref="#fn:1" rel="footnote">1</a></sup>.
214
214
When it compiles I could look at assembly code and see it is good.
215
215
It is absolutely efficient.</p>
216
216
@@ -275,7 +275,7 @@ <h2>Swap</h2>
275
275
sequence, you swap.
276
276
So it is very important practically.
277
277
But it also happens to be very important
278
-
theoretically, because a long time ago when people were starting group theory<supid="fnref:1"><ahref="#fn:1" rel="footnote">1</a></sup>
278
+
theoretically, because a long time ago when people were starting <ahref="https://en.wikipedia.org/wiki/Group_theory">group theory</a>
279
279
they discovered that any permutation of a sequence could be generated out of swap<supid="fnref:2"><ahref="#fn:2" rel="footnote">2</a></sup>.
The key idea is that many mathematical structures behave similarly.
488
-
You can add and subtract numbers, you can add and subtract vectors and matrices.
489
-
Can we study all structures which can add and subtract all together?
490
-
It turns out you can, and one such structure is a group.</p>
491
-
492
-
<p>Alex’s ideas about generic programming are inspired
493
-
by abstract algebra.</p><ahref="#fnref:1" rev="footnote">↩</a></li>
485
+
<p>Groups, monoids, and rings are a few of the subjects of abstract algebra,
486
+
a field which studies the fundamental properties of mathematical structures.
487
+
The key idea is that many different mathematical objects appear to function similarly.
488
+
Vectors and matrices can be “added” and “subtracted” just like integers.
489
+
In what ways are they fundamentally the same?
490
+
One explanation is that all of them form a group.
491
+
Below is a formal definition:</p>
492
+
493
+
<p>A <strong>group</strong> is a set <code>G</code> with a binary operation <code>* : G x G -> G</code> such that:</p>
494
+
495
+
<ol>
496
+
<li><code>G</code> contains an identity element <code>e</code> in <code>G</code> such that <code>e * x = x * e = x</code> for all <code>x</code> in <code>G</code>.</li>
497
+
<li>The operation <code>*</code> is associative. So <code>((x * y) * z) = (x * (y * z))</code> for all <code>x, y, z</code> in <code>G</code>.</li>
498
+
<li>Every element <code>x</code> in <code>G</code> has an inverse element <code>y</code> such that x * y = y * x = e.</li>
499
+
</ol>
500
+
501
+
502
+
<p>For example integers are a group with the operation of addition and the identity element 0.</p>
0 commit comments