This is a package which introduces the concept of a C2Function, which is a function which which returns its value and first two derivatives. The package provides utilities for creating composed (nested) functions and binary functions of functions. It also provides support for cubic splines of tabulated data. It allows extremely efficient numerical integration (10th order convergence) and root finding using the exact derivatives, along with the ability to transparently handle ratio functions with 0/0 points in them.
Using function composition, one can very efficiently represent very 'stiff' functions, such as the sine of a something with a slowly-varying phase error. One only need tabulate the phase error into an InterpolatingFunction (cubic spline), and then create the composed function C2sin(f) where f is the interpolating function. This composition isn't evaluated numerically until it is needed, so no huge table of what might be millions of cycles of sin(something) is ever created.
Note: because this is evolving rapidly, make sure you take adavntage of the up-to-date tarball on http://pythonlabtools.sourceforge.net to get a recent version.
Log in to post a comment.