Hacker News new | ask | show | jobs
by aleph_minus_one 6 days ago
> But... what is a ring? What is a formal variable? What is a vector space? What does "algebra over the ring" mean?

All these terms were taught to computer science (and of course math, physics, ...) students as part of getting their degree in computer science, because these concepts are important for many algorithms.

2 comments

Having studied CS and maths to post-grad, I think you exaggerate. Although a CS course might use these tools, they didn't in my experience go into explaining or defining them. The only use of linear algebra I can remember was in analysis of recurrence relations for algorithms, and for some graph theory. And I had one CS course on multivariate generating functions (formal variables) but most CS students would have been terrified of that. Abstract algebra is also used in combinatorial or search algorithms, but they would never use terminology like "ring".
> Having studied CS and maths to post-grad, I think you exaggerate. Although a CS course might use these tools, they didn't in my experience go into explaining or defining them.

I studied computer science (and mathematics) in Germany. I am very certain that this was taught to computer science students, even though (compared to the lectures for math students) the lecturer did not get very deep into these topics.

> most CS students would have been terrified of that.

This is a feature, not a bug. :-)

Seriously: In Germany, the "math for ..." lectures often are intended to be "weed-out lectures" so that students who simply are not qualified for their major get to quit their degree course fast (either by realizing that the degree course is too hard for them, or by (typically) failing math exams so that they get exmatriculated), so that they don't waste many semesters on a degree course which they simply are not suited for.

Do you think weed-out courses are a good thing? If these courses are so important, they should be taught in a way that students can understand. If they made it to college, and can program, they're clearly smart and motivated.
> If they made it to college, and can program, they're clearly smart and motivated.

You clearly write from the perspective of the US-American university system.

In Germany, basically everybody can enroll into a computer science program at a university, assuming the person has a Abitur (Allgemeine Hochschulreife) certificate (these terms are difficult to translate into English) from the grammar school [1]. So, "have it made to college" is like "not having been a complete failure in school". [2]

So, making it to the university is no achievement in Germany, and also no sign of motivation either.

> If these courses are so important, they should be taught in a way that students can understand.

These courses are taught in a way that students can understand, but not in a way where you can afford to slack off.

It is basically a consensus in Germany that a university is clearly a wrong place for you if you are incapable of closing knowledge gaps on your own (for example by reading books from the library), and you don't have the self-motivation to sit over the lecture material for hours to finally understand it.

So yes, I would say that among the possible options, weed-out courses in mathematics are in my opinion likely the least bad one.

---

[1] In years where there was an insane demand for places at the university to study computer science such as during the dot-com bubble, there were some restrictions (numerus clausus), but for computer science, this was always the exception to the rule.

[2] There exist good reasons for puns like "Abitur: nichts gerafft und doch geschafft" (Abitur: Didn't get a thing, yet still passed) or "A-bier-tur" (a portmenteau of "Abitur" and "beer", which suggests that even pupils who are more into drinking than learning typically get their Abitur certificate).

I studied a lot of abstract algebra in college and grad school and I’m surprised that rings and algebras would come up in a CS degree. What algorithms topics used those concepts? Something about polynomials?
Algebra is useful because graphs are algebraic objects, and a lot of CS is about graphs, in particular search/planning. But no, I never saw rings mentioned except for generating functions, which are used for analysing recurrence relations.

For example in search algorithms where you want to search a space without visiting state nodes twice. Each state in the search space is produced by the sequence (a product of) of operators from the start state: elements of a monoid (or group if actions are invertible) which define the primitive steps. Trivial example being generating all permutations of a list. More interesting, enumerate all graphs with some property with pathwidth at most k, by adding one edge or vertex at a time. So now you want to know the structure of this group so you know which sequences of elements simplify and don't need to be tried, and you want to canonicalise each state to throw out duplicates.

And you can think in terms of orbits: if there are some symmetries then you might want to factor by the symmetry group and only visit one node in each orbit, grouping states into orbits with a single representative state. See eg. Pochter, Zohar and Rosenschein, Exploiting Problem Symmetries in State-Based Planners.

You are talking about (abstract) algebraic structures, and not about rings and algebras (over a ring or field)

> https://en.wikipedia.org/w/index.php?title=Algebra_over_a_fi...

> https://en.wikipedia.org/w/index.php?title=Algebra_over_a_fi...

> https://en.wikipedia.org/w/index.php?title=Associative_algeb...

The latter is what aground asked for in https://news.ycombinator.com/user?id=agrounds

> I’m surprised that rings and algebras would come up in a CS degree. What algorithms topics used those concepts?

Thanks for the reply, this is very illuminating. I never got to this depth in algorithms. I’m but a humble programmer with a math background, but no CS degree.
Rings:

* Determinant calculation:

- The Samuelson–Berkowitz algorithm is best understood in terms of general rings

- The Faddeev–LeVerrier algorithm and determinant calculation using Gaussian elimination work on rings with specific properties (for the Faddeev–LeVerrier algorithm the restriction is on the characteristic of the ring, for Gaussian elimination the ring must be an integral domain (ideally a field)).

* Ring-learning with errors (for post-quantum cryptography and homomorphic cryptography). Here, a specific ring is the central object.

* Number-Theoretic Transform (NTT): Basically a generalization of the Fourier Transform to the ring Z_n. Important for arbitrary-precision integer arithmetic

* Chinese Remainder Theorem. Often only formulated for the ring Z, but it can be generalized to larger classes of rings. Used for example in Shamir’s scheme for secret sharing (cryptography)

* The theory of BCH and Reed-Solomon codes uses a specific ring

* The AKS Primality Test (a really deep result in computational number theory) uses the ring Z_n[X]/(x^r-1).

---

Algebras:

Very often, a ring is constructed from another ring. Examples:

* the polynomial ring R[X_1, ..., X_n]

* The ring of (square) matrices over a ring R

So, using algebras in algorithms often means: "we want to make use use of this additional structure that our (more sophisticated) ring has)". (Associative) R-algebras formalize this concept of "ring with additional structure".

To just give one algorithm for polynomials:

* Buchberger algorithm for computing a Gröbner basis

Other examples:

* Clifford algebras for a lot of geometric problems (special case: quaternions (a 4-dimensional \mathbb{R}-algebra) for rotations in \mathbb{R}^3).

* If you are willing to also consider semi-rings (in this case: tropical semi-rings): the Floyd-Warshall algorithm for finding shortest paths and the Viterbi algorithm for finding the most likely sequence of states in a Hidden-Markov Model (HMM) can very elegantly formulated using the matrix semiring over the tropical semiring.

> The tropical semiring has various applications (see tropical analysis), and forms the basis of tropical geometry. The name tropical is a reference to the Hungarian-born computer scientist Imre Simon, so named because he lived and worked in Brazil.[1]

I'm convinced half the reason people find CS terminology more accessible and Math terminology less so, is that CS terminology tends to be named after stuff, and Math terminology tends to be named after people, and ... sometimes whether the place they lived is a tropical place.

> I'm convinced half the reason people find CS terminology more accessible and Math terminology less so, is that CS terminology tends to be named after stuff, and Math terminology tends to be named after people, and ... sometimes whether the place they lived is a tropical place.

In my opinion: a lot of math terminology is much older than computer science terminology, so the origin of the names of many concepts in math is much more obscure for today's people than CS terminology currently is (and least if you are not into history of science/math).

On the other hand, in my observation a lot more terms in computer science are based on obscure (often pop-cultural) puns. I guess in 50-100 years these CS terminology might seem even more obscure for then-contemporary people than math terminology is today.

(At least some) error-correcting codes are based on polynomials over finite fields. I couldn't say much more, but it's at least intuitively plausible since e.g. an nth degree polynomial is defined by any n+1 points, so if you know say n+1+p ("p" for "parity") points, you can lose up to p and still recover the polynomial.