I implemented Buchberger’s algorithm in Maxima.

I love them both.

Here’s the algorithm:

Input: A finite set F of polynomials
Output: A finite Gröbner basis G equivalent to F

\(
G := F\\
M := G \times G\\
\ \ while\ M\neq\emptyset\ do\\
\ \ \ \ Choose\ a\ pair\ (f,g)\ from\ M\\
\ \ \ \ M := M \setminus \{(f,g)\}\\
\ \ \ \ h := \mathrm{RED}(\mathrm{SPOL}(f,g),G)\\
\ \ \ \ if\ h\neq0\ then\\
\ \ \ \ \ M := M \cup (G \times \{h\})\\
\ \ \ \ \ G := G \cup \{h\}\\
return G\\
\)
And here’s my code – with test inputs:

Example output:

\(
\mbox{}\\F\,= {{{w}^{5}}-x,{{w}^{10}}-y,{{w}^{25}}-z} \mbox{}\\G\,= {{{w}^{5}}-x,y-{{x}^{2}},z-x\,{{y}^{2}},xz-{{y}^{3}},{{z}^{2}}-{{y}^{5}}} \mbox{}\\CHECK: [{{w}^{5}}-x,y-{{x}^{2}},x\,{{y}^{2}}-z,{{y}^{3}}-xz,{{z}^{2}}-{{y}^{5}}]
\)