Spectral differentiation and interpolation methods under various bases (Chebyshev, Hermite, Laguerre, Legendre, Fourier, Sinc) in Julia. This suite of functionality was originally proposed and implemented in Matlab by, J. A. Weideman and S. C. Reddy [1].
For information on spectral methods one could consult, Spectral Methods in Matlab (by L.N. Trefethen) for a more practical introduction, and/or Spectral Methods: Fundamentals in Single Domains (by C. Canuto, M.Y. Hussaini, A. Quarteroni, T.A. Zang) for a more theoretical treatment.
DMSuite does not depend on a specific FFT implementation, instead it is built against the abstract interface AbstractFFTs.jl. Therefore to use a method such as chebdifft
, one must install and load an FFT implementation such as FFTW.jl or FastTransforms.jl.
Solve the BVP:
using FastTransforms
using DMSuite
using Plots
N = 16
M = 2
x,DM = chebdif(N+1,M)
D2 = DM[2:N,2:N,2] # impose boundary conditions
f = exp.(4 .* x[2:N]) # impose boundary conditions
u = D2 \ f # solve
u = [0;u;0] # set boundary values
xx = -1:0.01:1
uu = chebint(u,xx)
plot(xx,uu)
An alternative to DMSuite, at a higher level of abstraction and with a wider feature set, is ApproxFun.jl
- J. A. Weideman and S. C. Reddy. 2000. A MATLAB differentiation matrix suite. ACM Trans. Math. Softw. 26, 4 (Dec. 2000), 465–519. https://doi.org/10.1145/365723.365727
- W. S. Don and A. Solomonoff. 1995. Accuracy and Speed in Computing the Chebyshev Collocation Derivative. SIAM J. Sci. Comput. 16, 6 (Nov. 1995), 1253–1268. https://doi.org/10.1137/0916073
- R. Baltensperger and M. R. Trummer. 2003. Spectral Differencing with a Twist. SIAM J. Sci. Comput. 24, 5 (Jan. 2003), 1465–1487. https://doi.org/10.1137/S1064827501388182
- P. Henrici. Essentials of Numerical Analysis. 1982. Wiley. (barycentric formula see page 252)
- P. Henrici. Applied & Computational Complex Analysis III. 1986. Wiley. (barycentric formula see page 46)