# Chebfun equivalent for differentiation matrices in Julia?

**URL:** https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042
**Category:** Specific Domains
**Tags:** scientific-computing, approxfun, juliamath
**Created:** [January 4, 2022, 4:00pm UTC](https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042 "2022-01-04T16:00:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![yewalenikhil65](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yewalenikhil65/32/26873_2.png) [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)
#### Post date: [January 4, 2022, 4:00pm UTC](https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042/1 "2022-01-04T16:00:33Z")

</div>

Is there yet a differentiation matrices calculating tool in some Julia package ? Something similar to [https://github.com/chebfun/chebfun/blob/master/diffmat.m](https://github.com/chebfun/chebfun/blob/master/diffmat.m)  
I have tried searching in [JuliaApproximation](https://github.com/JuliaApproximation) community but couldn’t find anything similar ! Would be glad to find anything similar here !

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 4, 2022, 4:25pm UTC](https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042/2 "2022-01-04T16:25:43Z")

</div>

My understanding is that ApproxFun moved away from the Chebfun-style differentiation matrices, in which you take a function in the basis of Chebyshev polynomials and represent the derivative in the _same_ basis. The problem is that this results in dense (mostly nonzero) differentiation matrices that don’t scale well to large problems.

Instead, they represent the function and its derivative in different bases (e.g. Chebyshev and ultraspherical polynomials, respectively), and this allows the resulting derivative matrix to be sparse (banded). See [these operators](http://juliaapproximation.github.io/ApproxFun.jl/latest/usage/operators/) and [this paper](https://doi.org/10.1137/120865458).

(But there’s probably a way to get the Chebfun-style matrices if you dig deep enough in the package.)

---

<div class="post-metadata">

### Author: ![yewalenikhil65](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yewalenikhil65/32/26873_2.png) [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)
#### Post date: [January 4, 2022, 5:14pm UTC](https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042/3 "2022-01-04T17:14:39Z")

</div>

Thanks @stevengj for the links ! I see now that ApproxFun has adopted banded matrices approach. Is there any difference really in the derivatives calculated using Chebfun styles vs ApproFun style ? (I mean there shouldn’t be , but who’s more accurate ?)

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [January 4, 2022, 6:01pm UTC](https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042/4 "2022-01-04T18:01:56Z")

</div>

> [@yewalenikhil65](#):
>
> Is there any difference really in the derivatives calculated using Chebfun styles vs ApproFun style ? (I mean there shouldn’t be , but who’s more accurate ?)

They should be almost exactly equivalent (for the same polynomial degrees).

---

<div class="post-metadata">

### Author: ![yewalenikhil65](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yewalenikhil65/32/26873_2.png) [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)
#### Post date: [January 4, 2022, 6:04pm UTC](https://discourse.julialang.org/t/chebfun-equivalent-for-differentiation-matrices-in-julia/74042/5 "2022-01-04T18:04:12Z")

</div>

I see ! I drifted towards chebstyle matrices thinking i should create package that calculates chebstyle differentiaion matrices, but ApproxFun.jl has already done a better job here ! 😅
