The Chebfun team is pleased to release Version 5.3, incorporating many speedups and other improvements and new capabilities. Here is a summary of some of the main items.


Fast discrete Legendre transforms (legcoeffs2legvals etc.)

For several years Chebfun has had codes leg2cheb and cheb2leg for fast conversion between Legendre and Chebyshev expansion coefficients. We now also have fast conversion between Legendre coefficients and values at Legendre points. In fact there is now a suite of 12 codes with names legcoeffs2legvals, legcoeffs2chebcoeffs, chebcoeffs2legvals, etc., all of which compute the corresponding transforms in close to linear time. For example, the following takes less than 1 second on a desktop machine and produces vectors x and x2 that differ by about 1e-11.

x = randn(1e4,1);
y = legcoeffs2chebvals(x);
x2 = chebvals2legcoeffs(y);

[Thanks to Nick Hale and Alex Townsend.]

New chopping algorithm, removal of epslevel, and `doublelength'

The Chebfun constructor has been redesigned (a paper is in preparation). Most users won't notice a difference, but one change is that the accuracy estimate epslevel, which wasn't as reliable as we had hoped, has been removed. To explore how Chebfun chops a Chebyshev series, try e.g.

f = chebfun('exp(x)','doublelength'); plotcoeffs(f,'.')

which constructs a chebfun with twice the usual number of coefficients, revealing a plateau of rounding errors. [Thanks to Jared Aurentz, Anthony Austin, Nick Hale, and Nick Trefethen.]

'turbo' for higher accuracy Chebyshev coefficients

Though most Chebfun computations remain limited to about 15 digits of accuracy relative to the scale of the function, you can construct certain Chebyshev coefficients beneath this level with the experimental new flag 'turbo', based on a very simple form of the complex contour integrals investigated by Bornemann, Huybrechs, and Wang. Try e.g.

f = chebfun('exp(x)','turbo'); plotcoeffs(f,'.')

[Thanks to Anthony Austin and Nick Trefethen.]

plotregion for ellipses and strips of analyticity

The command chebellipseplot used to plot the "Chebfun ellipse" of a chebfun, an estimate of its region of analyticity in the complex plane (see Chapter 8 of Approximation Theory and Approximation Practice). This is now deprecated in favor of a new command plotregion that will also plot a "Chebfun strip" of analyticity for a periodic chebfun. Try e.g.

f = chebfun('1./(1+25*x.^2)'); plotregion(f), axis equal


f = chebfun('exp(cos(5*pi*x))','trig'); plotregion(f), axis equal

[Thanks to Kuan Xu.]

explain for a movie describing a chebfun2

If f is a chebfun2, explain(f) shows a movie of how f is constructed and represented. Try e.g. explain(cheb.gallery2('smokering')), or add a second argument explain(...,4) to make it faster. [Thanks to Asgeir Birkisson and Alex Townsend.]

Differential equations

quiver for displaying the phase plane of a chebop

The new command quiver displays the phase plane for a chebop (help quiver). Try e.g. the simple harmonic oscillator

L = chebop(@(u) diff(u,2) + u,[0 1]);
quiver(L,[-1 1 -1 1])

or the Lotka-Volterra predator-prey system

N = chebop(@(t,u,v) [diff(u)-2*u+u*v; diff(v)+v-u*v],[0 10]);
quiver(N,[0 3 0 4],'normalize',true)

[Thanks to Asgeir Birkisson.]

Simpler format [u, v] for multiple outputs (both ODEs and PDEs)

In solving a system of differential equations, the output used to be a chebmatrix, from which one could extract components via the command deal (help chebmatrix/deal). This is no longer necessary. To find solutions $u,v,w$ for the Lorentz equations, for example, one can now execute

N = chebop(0,30);
N.op = @(t,u,v,w) [diff(u)-10*(v-u); ...
    diff(v)-u*(28-w)+v; diff(w)-u*v+(8/3)*w];
N.lbc = @(u,v,w) [u+15; v+15; w-20];
[u,v,w] = N\0;
plot(u,w), ylim([2 48])

A similar change has been made in pde15s for time-dependent PDEs. See help chebop/solvebvp or help chebop/solveivp and help chebfun/pde15s. [Thanks to Asgeir Birkisson.]

Simpler format [a; b] for specifying derivative BCs

Before, to specify $u=a$ and $u'=b$ at a left boundary, say, you had to write e.g. L.lbc = @(u) [u-a; diff(u)-b]. Now, for scalar problems, you can write L.lbc = [a; b]. See the boundary conditions section under help chebop. [Thanks to Asgeir Birkisson.]

New command deriv for evaluating derivatives

To evaluate the derivative of a chebfun, you used to have to write e.g. fp = diff(f); fp(0). Now you can also use deriv(f,0). This makes specification of internal "boundary" conditions for ODEs much more convenient. You used to have to write e.g. L.bc = @(x,u) feval(diff(u),0) - 1, but now you can write L.bc = @(x,u) deriv(u,0) - 1. See help chebfun/deriv. [Thanks to Asgeir Birkisson.]

followpath for pseudo-arclength continuation of ODE solutions

A new code followpath enables one to track solutions of ODEs as a parameter is varied. Type help followpath for syntax and examples. [Thanks to Asgeir Birkisson.]

Coefficients or values spectral options, both Chebyshev and Fourier

Chebfun uses spectral methods to solve ODE BVPs. The default is spectral collocation ("pseudospectral" methods), but coefficient-based methods are also available. On Chebyshev grids, this is the ultraspherical technology of Olver and Townsend. On Fourier grids, this is a new option based on classical Fourier expansions. The default, factory discretizations are equivalent to what you get with


and for the alternative discretizations you can specify


See help cheboppref. [Thanks to Hadrien Montanelli.]