First, let me say, I don't know if there is code to do exactly what you want but here are my thoughts.
It sounds to me like you're asking for Lagrange polynomial fitting routines. Googling for "lagrange polynomial python" does return some code here: <http://www.stanford.edu/~sturdza/akimamod/akimamod.py>
Another possibility is the spline fitting routines in Scipy (scipy.interpolate). These may be appropriate if what you're really after is just a way to fit smooth functions through points. I've used the splrep and splev functions there successfully to fit spline functions through points. When I was looking for curve fitting routines recently, I also came across some more generalized curve fitting modules for Python but I can't recall where I think they were SWIG wrappers for a C library.
Also, look at this:
----- Original Message -----
From: Jean-Baptiste Cazier <Jean-Baptiste.cazier@...15...>
Date: Fri, 19 Mar 2004 11:49:21 +0000
To: "Gary Ruben" <gazzar@...25...>, jdhunter@...8...
Subject: Re: [Matplotlib-users] Polyfit
Thanks to both of you. It worked just fine
I will push my luck and ask if any of you knows of a module to fit a piecewise polynomial to a list of (X,Y) points.
would return [[A0,B0,C0],[A1,B1,C1}[A2,B2,C2},[A3,B3,C3]}, coefficients for the 4 polynoms
This is a classic and I expect the code to be written somewhere, eventhough I could not find it even when I "Feel lucky" with Google.