Open-source project
chebfun/chebfun avatar
chebfun/chebfun

Chebfun: numerical computing where the variable is a function

Chebfun: numerical computing with functions.

680 stars161 forksMATLABNOASSERTION

At a glance

What is it?
Chebfun is a MATLAB system for computing with functions rather than arrays, built on piecewise polynomial interpolation and Chebyshev technology, and it adds continuous analogues of QR and singular value decomposition on top of differential and integral operators. It is a research-grade tool with a long release gap, so the version you install matters.
Who is it for?
Adopt Chebfun if your work is on functions rather than on sampled grids, in particular if you solve differential equations, do spectral operations, or need roots and extrema of a function to high accuracy, since the variable is manipulated symbolically in style while everything underneath stays numeric.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 122 days ago.
What is it written in?
Mainly MATLAB, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

The variable is a function, not a vector

Chebfun is an open-source software system for numerical computing with functions. The mathematical basis is piecewise polynomial interpolation implemented with what the project calls Chebyshev technology, and the foundations with Chebfun examples are described in the book Approximation Theory and Approximation Practice.

The programming model is the thing to understand first. Instead of a vector of samples, you create a chebfun, which is a function represented as a piecewise polynomial on a domain:

matlab
x = chebfun('x');

From there, the variable can be manipulated in a way that feels symbolic, although everything Chebfun does is numeric. The example the documentation gives is a short session:

matlab
f = sin(12*x).*exp(-x);         % A function on [-1, 1]
g = max(f, 1./(x+2));           % The max of f and 1./(x+2)
plot(g)                         % A function with discontinuous derivative
sum(g)                          % The integral of g
plot(diff(g))                   % The derivative of g
h = g + x - .8;                 % A function with several roots in [-1, 1]
rr = roots(h);                  % Compute the roots of h
plot(h, 'k', rr, h(rr), 'ro')   % Plot h and its roots

Read that as a sequence of operations on a function object. max of two functions, integral, derivative, roots. The g function is a function with a discontinuous derivative, which is the point: the representation handles the kink without the user having to say where it is, and the derivative and the integral are still well defined almost everywhere.

The result is a programming style that does not exist in the array world. In numpy you would have a grid, an interpolation scheme, a discontinuity would break the derivative, and finding roots would be a separate numerical method with its own tolerance. Here those are all operations on the same object.

Continuous operators instead of matrices

Chebfun has extensive capabilities for dealing with linear and nonlinear differential and integral operators, and it also includes continuous analogues of linear algebra notions like QR and singular value decomposition.

That phrase is the one that distinguishes the system from a numerical toolbox. A continuous SVD is not a matrix factorisation with a different name; it is a spectral decomposition of an operator acting on functions, where the singular values are the ones that describe how the operator amplifies or damps each direction of a function space, and where the vectors are functions rather than vectors. A continuous QR gives an orthogonal change of basis in function space, and the factors are functions you can evaluate and plot.

The mechanism underneath is the same in both cases. The operator is applied to a function, and the result is represented as a piecewise polynomial, and a matrix of coefficients arises as an artefact of the representation rather than as the object of study. A spectral method built this way can produce a solution that is a smooth function you can evaluate anywhere, instead of a grid you have to interpolate from.

The domain in the example is the interval from minus one to one, which is the default for a chebfun. The Chebyshev technology is the choice of basis for the polynomial pieces, and the pieces are adaptive: the representation is refined where the function needs it. The library structure visible in the repository listing shows the same idea at scale, with separate top level directories for the two-variable extension, the ball and sphere function types, the boundary function type, the operator types, the exponential integrator, the implicit ODE work, the separable approximation, the discrete disk function, the smooth and single function variants, and the operator and functional block machinery, with each area carrying a version suffix such as chebfun2v, chebfun3t and chebfun3v.

Installing it: a path entry and a version caveat

Chebfun is compatible with MATLAB 7.8, which is R2009a, and later. Installation is either a .zip download or a git clone, and the documentation notes that a call to clear classes is required if you had a previous version of Chebfun installed, which is the kind of instruction that only appears when a project has changed its class definitions between releases.

The .zip route downloads from the master archive, and after unzipping you add Chebfun to the MATLAB path, either by typing:

code
addpath(chebfunroot), savepath

where chebfunroot is the path to the unzipped directory, by selecting the chebfun directory with the pathtool command, or through the File, Set Path dialog from the MATLAB menubar.

The git route is a clone of the repository, followed by the same path step:

code
git clone https://github.com/chebfun/chebfun.git

The three path options are not equivalent in practice. savepath writes the change into your MATLAB path file, so it persists but is per user, which is the wrong place for a shared dependency on a cluster. pathtool lets you add a path and see what is shadowing what, which is useful when another toolbox provides a function of the same name. And the File, Set Path dialog is the option for a MATLAB installation you do not want to modify on disk, such as one where the preferences directory is read-only.

There is one more installation decision the documentation does not make for you, and it is the important one. Cloning the repository gives you master, which is the development line, and the tagged releases in the repository are v5.5.0 from 2016-07-01, v5.6.0 from 2016-12-16 and v5.7.0 from 2017-06-02. The last push to the repository was on 2026-06-23, so master is being worked on well after the last tag. Whether you want the tagged release, which is what other people tested, or master, which is what has the recent work, is a decision about reproducibility versus freshness that you have to make deliberately.

The Guide and a hundred examples are the documentation

Chebfun does not have API reference documentation in the conventional sense. What it has instead is a guide and an examples collection, and the project points at both as the way in.

The Chebfun Guide is described as an in-depth tour of Chebfun's mathematical capabilities. The Examples collection, which numbers well over one hundred, illustrates everything from rootfinding to optimization to nonlinear differential equations and vector calculus. And the project notes that many users use the Examples as templates for their own problems.

That last point is the one to take seriously. The examples are not a gallery of what the library can do, they are the working pattern for how to structure a problem for Chebfun. A function-first problem statement, a representation of the function as a chebfun, an operator applied to it, and a spectral decomposition to extract the answer, is a shape you have to learn once and then reuse, and the examples are where that shape is demonstrated against real problems rather than abstract ones.

The repository layout backs this up. The +cheb/ directory holds the core, and around it sit the domain-specific function types and operator types, each in its own directory with a version suffix where a newer variant exists alongside an older one. There are also @chebop/ and @chebop2/ for the operator algebras, @linop/ and @imex/ for linear and implicit differential operators, @expinteg/ for exponential integrators, @coeffsDiscretization/ and @opDiscretization/ for the discretisation machinery that turns operators into the coefficient representations the spectral methods work with, and @bndfun/ for boundary value problems. The @chebgui/ family, with its controller and its separate exporters for BVP, EIG, IVP and PDE, is the graphical front end, and @chebfunpref/ and @chebfun3t/ indicate the preference system and the third generation of the core.

The presence of several versioned variants in one tree is a maintenance fact worth noting: chebfun, chebfun2 and chebfun3 coexist, so a directory listing of this repository is not a map of the current API.

Where Chebfun is the wrong tool

The first limitation is the input shape. Chebfun is at its best when the problem is naturally a function: a differential equation posed on a continuum, an operator, a spectral quantity. If your data is a sampled array of a million points and your task is a filter or a regression, you are in the wrong place. The overhead of representing a function as a piecewise polynomial with adaptive refinement is not repaid by an array library that already does exactly what you asked.

The second limitation is the platform. The compatibility statement is MATLAB 7.8 and later, which in one sense means almost any current MATLAB, and in another sense means the whole thing is unavailable to the Python and Julia ecosystems. There are ports and reimplementations in other languages, and a project in this space that needs to share code with a Python machine learning pipeline is going to have to decide which side of that line to live on, and Chebfun is on the MATLAB side.

The third limitation is the release story, and it is the one that most affects a decision today. The tagged releases in the repository stop at v5.7.0 from 2017-06-02, while the last push was on 2026-06-23. A project with over nine years between its newest tag and its newest commit is either being maintained in a way that does not produce tags, or it is maintained in a way that produces a different artefact, and either way you cannot pin a version from this repository alone. The licence is also custom in the sense that GitHub cannot classify it, and the documentation defers to LICENSE.txt for the terms, so the legal question of what you may do with a modified copy is answered in a file rather than in the README.

The real alternative, and it is not a poor one, is a general-purpose spectral method implemented in an environment you already run. MATLAB's own Chebyshev coefficient tools, or a spectral method in Python with the linear algebra you already depend on, will do the same job for a well-posed problem, with a matrix you can inspect rather than an operator you have to trust. The difference in approach is that Chebfun gives you the operator algebra and the continuous linear algebra as first class objects, so an eigenfunction or a singular value of a differential operator is something you ask for rather than something you approximate by discretising and hoping the discretisation converges. For a class of problems, that is the whole value and no general toolkit replicates it. For a one-off spectral solve, it is a large dependency with a 2017 tag.

Editorial conclusion

Adopt Chebfun if your work is on functions rather than on sampled grids, in particular if you solve differential equations, do spectral operations, or need roots and extrema of a function to high accuracy, since the variable is manipulated symbolically in style while everything underneath stays numeric. Do not adopt it if your problem is naturally a large sampled array, if you need a maintained release cadence, or if you are working outside MATLAB, because the compatibility statement is MATLAB 7.8 and later. Before you plan around it, check which release you can actually get, since the newest tagged version in the repository is v5.7.0 from 2017 while the last push was on 2026-06-23, and read the Guide and the Examples collection, which the project points to as the intended way in.

Frequently asked questions

What is Chebfun?

Chebfun is an open-source MATLAB system for numerical computing with functions, based on piecewise polynomial interpolation implemented with Chebyshev technology. It handles linear and nonlinear differential and integral operators and includes continuous analogues of linear algebra notions like QR and singular value decomposition, with the Chebfun2 extension covering functions of two variables on a rectangle.

How do I install Chebfun?

Download the .zip from the master archive or clone the repository with git, then add the chebfun directory to the MATLAB path, either by typing addpath(chebfunroot), savepath, by using the pathtool command, or through the File, Set Path dialog. A call to clear classes is required if you had a previous version of Chebfun installed.

What MATLAB versions does Chebfun support?

The documentation states that Chebfun is compatible with MATLAB 7.8, which is R2009a, and later. The project is distributed under a custom licence that GitHub cannot classify, with the terms given in LICENSE.txt.

How do I learn to use Chebfun?

The project points at two resources: the Chebfun Guide, an in-depth tour of its mathematical capabilities, and an Examples collection numbering well over one hundred, covering rootfinding, optimization, nonlinear differential equations and vector calculus. Many users use the Examples as templates for their own problems.

Official sources

  1. chebfun/chebfun on GitHub
  2. Issues
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/chebfun-chebfun.svg)](https://hysenlabs.com/projects/chebfun-chebfun)

Was this useful?