Author Topic: scientists, engineers, mathematical modelers: chebfun = awesome  (Read 2065 times)

0 Members and 1 Guest are viewing this topic.

Offline jacobolus

  • Thread Starter
  • Posts: 3670
  • Location: San Francisco, CA
This project – http://www.chebfun.org – is perhaps the most impressive and important new scientific computing tool in the last 30 years. It’s super fun to play with for anyone trying to compute things with functions.

Typically, when you have a complicated function that you want to integrate, or stick in a differential equations problem, or find the roots for, or compose with another function, computations are done at single points, or sometimes the function is chopped up into tiny pieces (discretized) and those problems are solved numerically using matrices. Sometimes functions are approximated with a piecewise polynomial or rational spline, basically a bunch of tiny pieces each one of which is a cubic or quintic polynomial.

Chebfun is a new paradigm. The idea is to approximate functions by high-degree polynomials, as high a degree as required to fit the function to within machine precision (about 15 digits). This team at Oxford have dug out of the literature or invented, and then implemented, a whole variety of algorithms which operate on those polynomial approximations very efficiently. Even when the degree of the polynomial gets into the thousands or higher, it’s very quick to compose functions, take integrals or derivatives, find roots, and so on.

Previously many people had the impression that polynomial approximations were either inefficient or not numerically stable. This is true when dealing with polynomials in the monomial basis (like the {a, b, c, d} in a + bx + cx^2 + dx^3), or with polynomial interpolation at equally spaced data points. Instead, Chebfun is based on interpolation at the Chebyshev points, which are crowded near the ends of an interval. Chebyshev polynomial approximations are numerically stable and very nice to work with.

For those from a signal processing, audio, or electronics background, Chebyshev approximations are the interval equivalent of Fourier series approximations to functions on the complex unit circle. As such, you can use a fast Fourier transform (FFT) to translate between values of a function at Chebyshev points and coefficients of Chebyshev polynomials, in the same way you’d use the FFT to translate between values at equispaced points and trigonometric function coefficients for approximations of periodic functions.

Anyway, I highly urge anyone in science or engineering type fields to check it out. It’s fabulous work, and I’m convinced that this will be a standard set of tools that every engineering undergraduate is required to learn in 20–30 years. The Chebfun team has a nice user guide up, and a number of nice papers, and Trefethen, the leader of the group working on the project, published a readable book about the subject in 2013, “Approximation in Theory and Practice” of which the first 6 chapters are available online: http://www.chebfun.org/ATAP/

In general most of their work should be pretty accessible to upper division undergraduates in science/engineering fields, even those without an approximation theory background.

Here are a couple of lecture videos:

« Last Edit: Wed, 10 June 2015, 03:22:11 by jacobolus »

Offline 1o57

  • Posts: 41
  • Location: East Coast USA
  • %10000100001
Re: scientists, engineers, mathematical modelers: chebfun = awesome
« Reply #1 on: Wed, 10 June 2015, 01:36:33 »
Thank you for sharing this.  I'm always looking for new ways to sharpen my FFT foo :)


Offline dorkvader

  • Posts: 6289
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: scientists, engineers, mathematical modelers: chebfun = awesome
« Reply #2 on: Tue, 16 June 2015, 13:41:14 »
Sometimes functions are approximated with a piecewise polynomial

Chebfun is a new paradigm. The idea is to approximate functions by high-degree polynomials, as high a degree as required to fit the function to within machine precision (about 15 digits). This team at Oxford have dug out of the literature or invented, and then implemented, a whole variety of algorithms which operate on those polynomial approximations very efficiently. Even when the degree of the polynomial gets into the thousands or higher, it�s very quick to compose functions, take integrals or derivatives, find roots, and so on.

Previously many people had the impression that polynomial approximations were either inefficient or not numerically stable. This is true when dealing with polynomials in the monomial basis (like the {a, b, c, d} in a + bx + cx^2 + dx^3), or with polynomial interpolation at equally spaced data points. Instead, Chebfun is based on interpolation at the Chebyshev points, which are crowded near the ends of an interval. Chebyshev polynomial approximations are numerically stable and very nice to work with.

Piecewise polynomial fitting is really nothing new, we used it all the time back in college. For one project junior year, we had to implement a basic finite element analysis program for computing the vorticity (lift) over an airfoil.  I didn't know about Chebyshev points at the time, but I quickly realized the program became significantly more efficient with inequally-spaced polynomial control points. I no longer have the code, but I believe I computed the "rate-of-complexity-change" of the airfoil curve and used that to better allocate my points.

Now, from what I'm reading in your post here, I would say that the truly innovative piece must be either the use of Chebyshev points (which I dont know about) or the (re)discovery of polynomial algorithms.

For people doubtful that this is a new paradigm, consider that "back in the day" people used to calculate splines with pieces of wood. Actual physical splines! And this was considered cutting edge. Even before the advent of the computer age, new methods for approximating functions were extremely important. Nowadays, with the raw amount of computing "work" that has to be done, this is still the case, as even a few percentage points in efficiency gain yield massive improvements for the design process in general.

But what do I know, I wasn't smart enough for college and dropped out.

That, and I subscribe to Kuhnian paradigms as the model for scientific progress.

Thanks for posting, and I wish the youtube video you linked were still there.

Offline jacobolus

  • Thread Starter
  • Posts: 3670
  • Location: San Francisco, CA
Re: scientists, engineers, mathematical modelers: chebfun = awesome
« Reply #3 on: Wed, 17 June 2015, 03:41:30 »
Piecewise polynomial fitting is really nothing new, we used it all the time back in college. [...] Now, from what I'm reading in your post here, I would say that the truly innovative piece must be either the use of Chebyshev points (which I dont know about) or the (re)discovery of polynomial algorithms.

Oh, the basic idea here is like 200 years old.

The key bits that make it exciting now date from the last few decades though (and some are even under current development): the barycentric formula for evaluation, nice algorithms for numerical integration and root finding, using a fast Fourier transform to convert between Chebyshev polynomial coefficients and values at the Chebyshev points, new algorithms for convolutions and for converting between Chebyshev and Legendre polynomials, better ways to compute rational interpolants, several neat tools related to solving ODEs and PDEs, some really clever analogs of matrix decompositions used to decompose bivariate functions into a product of “quasimatrices” which make it possible to do some really efficient computations for solving 2d problems, etc. To read about the new bits that the chebfun team themselves invented, see their list of publications: http://www.chebfun.org/publications/

Even more important than that though, IMO, is bringing all these tools together into a nice implementation which makes actually writing code to do various sorts of computations very short and readable. In other words, the best part is solving user interface problems.

Quote
For people doubtful that this is a new paradigm, consider that "back in the day" people used to calculate splines with pieces of wood. Actual physical splines!
A physical spline can be idealized by a “minimum energy curve”. And yeah, splines are really neat! For anyone interested in splines and typography, I recommend Raph Levien’s Ph.D thesis: http://www.levien.com/phd/phd.html

Quote
Thanks for posting, and I wish the youtube video you linked were still there.
Works fine for me... here’s the link again: https://www.youtube.com/watch?v=cQp-kB9EOQs

Quote
But what do I know, I wasn't smart enough for college
Yeah that’s total nonsense, don’t sell yourself short.
« Last Edit: Wed, 17 June 2015, 04:03:23 by jacobolus »