Please don't fall into the trap of believing that I am terribly dogmatical about [the go to statement]. I have the uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a single trick, by a simple form of coding discipline!
A library for numerical calculations with multivariate polynomials. This Python script confirms Euler’s four-square identity (in 0.02 seconds):
import time from mvpoly.dict import * t0 = time.time() a1, a2, a3, a4, b1, b2, b3, b4 = MVPolyDict.variables(8) p = (a1**2 + a2**2 + a3**2 + a4**2) * (b1**2 + b2**2 + b3**2 + b4**2) q = (a1*b1 - a2*b2 - a3*b3 - a4*b4)**2 + \ (a1*b2 + a2*b1 + a3*b4 - a4*b3)**2 + \ (a1*b3 - a2*b4 + a3*b1 + a4*b2)**2 + \ (a1*b4 + a2*b3 - a3*b2 + a4*b1)**2 assert p == q, "failed Euler-Goldbach" t1 = time.time() print("%8.6f" % (t1 - t0))
The Octave package can be installed using the command
sudo octave --eval "pkg install mvpoly-octave-0.97.5.tar.gz"
For the Matlab package, see the included README for installation instructions.
sudo pip install mvpoly
The package source can be found on the Github page.