Using the matrix equations found on Wikipedia I wrote some Python code to compute the Savitsky-Golay coefficients for $m$ data-points, using a polynomial of degree $k$. Here it is:
from numpy import *
from numpy.linalg import *
k = 4 # Degree of polynomial to use for regression
m = 25 # Window size, that is, the number of points. Must be an odd number.
z = range(-(m-1)/2, (m-1)/2+1) # z is the distance from the central point.
jacobian, b = [], []
for i in z:
for j in range(k+1):
b.append(i**j)
jacobian.append(b)
b=[]
J = matrix(jacobian)
C = (J.T*J).I*J.T
I do realize that this code is in no way optimized and it could've been done in a much cleaner way, however I'm not a (professional) programmer nor a mathematician and would be really happy if I could get it to work at all.
My problem is that the coefficients computed become rather small, using the parameters above ($k=4$, $m=25$) on the order of $\pm 10^{-6}$. If I "go one step back" and multiply with the determinant I get really huge numbers ($\pm 10^{22}$).
I tried finding the greatest common divisor of these but got the result 2048 which leaves me with huge numbers (and it can't be right, result of numerical errors due to small/huge numbers or something?). I would like to have the coefficients in the form they're usually found in tables, with a normalization constant for each derivative, and an integer coefficient for each data point. Since I'm interested in the point of maximum curvature in a data series I want to calculate its 3rd derivative, I've been unable to find a table with these coefficients.