Skip to content

Commit 8347296

Browse files
authored
Update docstrings of calculus operators (#244)
1 parent 1c6463a commit 8347296

File tree

1 file changed

+77
-15
lines changed

1 file changed

+77
-15
lines changed

src/Operators/banded/CalculusOperator.jl

Lines changed: 77 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,69 +243,131 @@ end
243243

244244

245245
"""
246-
`Derivative(sp::Space,k::Int)` represents the `k`-th derivative on `sp`.
246+
Derivative(sp::Space, k::Int)
247+
248+
Return the `k`-th derivative operator on the space `sp`.
249+
250+
# Examples
251+
```jldoctest
252+
julia> Derivative(Chebyshev(), 2) * Fun(x->x^4) ≈ Fun(x->12x^2)
253+
true
254+
```
247255
"""
248256
Derivative(::Space,::Int)
249257

250258
"""
251-
`Derivative(sp::Space,k::Vector{Int})` represents a partial derivative on a multivariate space.
252-
For example,
259+
Derivative(sp::Space, k::AbstractVector{Int})
260+
261+
Return a partial derivative operator on a multivariate space. For example,
253262
```julia
254263
Dx = Derivative(Chebyshev()^2,[1,0]) # ∂/∂x
255264
Dy = Derivative(Chebyshev()^2,[0,1]) # ∂/∂y
256265
```
266+
267+
!!! tip
268+
Using a static vector as the second argument would help with type-stability.
269+
270+
# Examples
271+
```jldoctest
272+
julia> ∂y = Derivative(Chebyshev()^2, [0,1]);
273+
274+
julia> ∂y * Fun((x,y)->x^2 + y^2) ≈ Fun((x,y)->2y)
275+
true
276+
```
257277
"""
258-
Derivative(::Space,::Vector{Int})
278+
Derivative(::Space, ::AbstractVector{Int})
259279

260280
"""
261-
`Derivative(sp::Space)` represents the first derivative `Derivative(sp,1)`.
281+
Derivative(sp::Space)
282+
283+
Return the first derivative operator, equivalent to `Derivative(sp,1)`.
284+
285+
# Examples
286+
```jldoctest
287+
julia> Derivative(Chebyshev()) * Fun(x->x^2) ≈ Fun(x->2x)
288+
true
289+
```
262290
"""
263291
Derivative(::Space)
264292

265293
"""
266-
`Derivative(k)` represents the `k`-th derivative, acting on an unset space.
294+
Derivative(k)
295+
296+
Return the `k`-th derivative, acting on an unset space.
267297
Spaces will be inferred when applying or manipulating the operator.
298+
If `k` is an `Int`, this returns a derivative in an univariate space.
299+
If `k` is an `AbstractVector{Int}`, this returns a partial derivative
300+
in a multivariate space.
301+
302+
# Examples
303+
```jldoctest
304+
julia> Derivative(1) * Fun(x->x^2) ≈ Fun(x->2x)
305+
true
306+
307+
julia> Derivative([0,1]) * Fun((x,y)->x^2+y^2) ≈ Fun((x,y)->2y)
308+
true
309+
```
268310
"""
269311
Derivative(k)
270312

271313
"""
272-
`Derivative()` represents the first derivative on an unset space.
314+
Derivative()
315+
316+
Return the first derivative on an unset space.
273317
Spaces will be inferred when applying or manipulating the operator.
318+
319+
# Examples
320+
```jldoctest
321+
julia> Derivative() * Fun(x->x^2) ≈ Fun(x->2x)
322+
true
323+
```
274324
"""
275325
Derivative()
276326

277327

278328
"""
279-
`Integral(sp::Space,k::Int)` represents a `k`-th integral on `sp`.
329+
Integral(sp::Space, k::Int)
330+
331+
Return the `k`-th integral operator on `sp`.
280332
There is no guarantee on normalization.
281333
"""
282-
Integral(::Space,::Int)
334+
Integral(::Space, ::Int)
283335

284336

285337
"""
286-
`Integral(sp::Space)` represents the first integral `Integral(sp,1)`.
338+
Integral(sp::Space)
339+
340+
Return the first integral operator, equivalent to `Integral(sp,1)`.
287341
"""
288342
Integral(::Space)
289343

290344
"""
291-
`Integral(k)` represents the `k`-th integral, acting on an unset space.
345+
Integral(k::Int)
346+
347+
Return the `k`-th integral operator, acting on an unset space.
292348
Spaces will be inferred when applying or manipulating the operator.
293349
"""
294-
Integral(k)
350+
Integral(k::Int)
295351

296352
"""
297-
`Intergral()` represents the first integral on an unset space.
353+
Intergral()
354+
355+
Return the first integral operator on an unset space.
298356
Spaces will be inferred when applying or manipulating the operator.
299357
"""
300358
Integral()
301359

302360
"""
303-
`Laplacian(sp::Space)` represents the laplacian on space `sp`.
361+
Laplacian(sp::Space)
362+
363+
Return the laplacian operator on space `sp`.
304364
"""
305365
Laplacian(::Space)
306366

307367
"""
308-
`Laplacian()` represents the laplacian on an unset space.
368+
Laplacian()
369+
370+
Return the laplacian operator on an unset space.
309371
Spaces will be inferred when applying or manipulating the operator.
310372
"""
311373
Laplacian()

0 commit comments

Comments
 (0)