ApproxFun... relation to Chebfun?

My only knowledge of ApproxFun is from the brief documentation which states that it “is a package for approximating functions. It is in a similar vein to the Matlab package Chebfun”. I have dug up the ChebFun guide, as well as the books:

  • Trefethen, L.N. and Birkisson, Á and Driscoll, T.A. (2017). Exploring ODEs, SIAM.
  • Trefethen, L.N. (2020). Approximation Theory and Approximation Practice. Extended Edition, SIAM.

Questions:

  1. Is ApproxFun implemented in Julia, or is it linked to some Python or similar code?
  2. Does ApproxFun support the possibilities of ChebFun as described in Trefethen et al. (2017) and/or Trefethen (2017)? Or a subset of these? Or a superset of these?

Thanks for answers.

ApproxFun is implemented purely in Julia by @dlfivefifty and Alex Townsend (who originally worked on Chebfun). My understanding is that it provides similar functionality, but in some cases uses more modern (more efficient) algorithms and has enhanced capabilities especially for PDEs in more than 1 dimension.

6 Likes

Thanks for quick answer! Great; that means that I can use some examples in Trefethen et al. (2017) and Trefethen (2020) to play around with ApproxFun, in addition to possible notebooks.

1 Like

Hopefully you saw the links to the docs and examples. Have fun!

6 Likes

To expand a little bit, it uses a lot of fancy Julia types for structure matrices, like FillArrays and BandedMatrices, to make it a very efficient implementation (and all of these matrix types you can find separate in order to use in your own work!).

5 Likes

From some casual reading in Trefethen’s books, I get the impression that for initial value problems, Chenfun actually uses the MATLAB ode solvers “under the hood”, and that the key advantage of Chebfun for such problems is the systematic user interface. But I may be wrong; that would also be somewhat weird in that then I don’t quite see how Chebyshev polynomials would be used for that case. Anyway, if so, would ApproxFun use DifferentialEquations solvers?

Yes, and if you dig in it’s basically because of speed issues. Everything isn’t perfectly smooth with the two boundaries known, then collocation-based methods are the best tool for the job. So… they don’t work so well for IVP stuff, and they mention that somewhere in the Chebfun manual. However, they work great for smooth BVPs and you can probably find some weird IVPs where they do well, like highly oscillatory problems. So I wouldn’t just have it dispatch over to DiffEq, I would just leave ApproxFun as is and let people use it to solve ODEs if they please, and yes it won’t be good if it’s used inappropriately but :man_shrugging: there are appropriate scenarios for this.

3 Likes

Getting such a thing working requires quite a bit of hand tuning for error control, as both ApproxFun and DifferentialEquations.jl have adaptive error control and it’s necessary to make sure these work “right” to avoid resolving noise. Since Chebfun has mostly solved this it would be possible to copy their approach, but I don’t have time to do this. Would happily support a PR to make DiffEq + ApproxFun work better together (in fact we have a repository DiffEqApproxFun.jl to support this, though it’s not maintained)

3 Likes