# ApproxFun: Derivative: Set vs. Unset space

**URL:** https://discourse.julialang.org/t/approxfun-derivative-set-vs-unset-space/124601
**Category:** Numerics
**Tags:** question, package, approxfun
**Created:** [January 9, 2025, 5:50pm UTC](https://discourse.julialang.org/t/approxfun-derivative-set-vs-unset-space/124601 "2025-01-09T17:50:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)
#### Post date: [January 9, 2025, 5:50pm UTC](https://discourse.julialang.org/t/approxfun-derivative-set-vs-unset-space/124601/1 "2025-01-09T17:50:07Z")

</div>

Regarding ApproxFun.jl (likely more general): what is the rationale (guideline or rule of thumb) for setting or unsetting the space for the Derivative function?

---

<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 9, 2025, 6:07pm UTC](https://discourse.julialang.org/t/approxfun-derivative-set-vs-unset-space/124601/2 "2025-01-09T18:07:47Z")

</div>

I think it’s analogous to the identity operator `I` in [LinearAlgebra](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/) — when you act `I*x` on a vector (or matrix), it infers the correct dimension of the identity from `x`, analogous to `UnsetSpace` in ApproxFun. But occasionally it’s nice to have an explicit identity matrix, e.g. via `I(n)` to get an n \times n `Diagonal` matrix.

---

<div class="post-metadata">

### Author: ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)
#### Post date: [January 10, 2025, 5:34am UTC](https://discourse.julialang.org/t/approxfun-derivative-set-vs-unset-space/124601/3 "2025-01-10T05:34:25Z")

</div>

From a practical perspective, it’s almost always better to not specify the spaces for operators, and have these be inferred automatically.

---

<div class="post-metadata">

### Author: ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)
#### Post date: [January 10, 2025, 7:30am UTC](https://discourse.julialang.org/t/approxfun-derivative-set-vs-unset-space/124601/4 "2025-01-10T07:30:45Z")

</div>

Hurray for automatism.

Hurray for an explanation of what and how the automatism does.

Hurray for a switch allowing to turn off the automatism allowing user to experiment.

Thx.
