mvpoly

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.

A Python module can be found on PyPI and the documentation at PythonHosted. It can be installed with

sudo pip install mvpoly

The package source can be found on the Github page.

mvpoly plot
A bi-variate polynomial, evaluated by mvpoly, plotted by matplotlib