Skip to content

Commit 28eb4ea

Browse files
Implement calculus operations for ConstantSpace (#595)
* Implement calculus operations for ConstantSpace * Add test for integrate() on ConstantSpace * Infer domain space in integrate * Revert "Add test for integrate() on ConstantSpace" This reverts commit 0a1269a. * Add test for differentiate() * Version bump to v0.9.15
1 parent d50a4ce commit 28eb4ea

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.9.14"
3+
version = "0.9.15"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Spaces/ConstantSpace.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ choosedomainspace(M::ConcreteMultiplication{D,UnsetSpace},sp::Space) where {D<:C
254254
Base.isfinite(f::Fun{CS}) where {CS<:ConstantSpace} = isfinite(Number(f))
255255

256256

257+
## Calculus
257258

258-
259-
260-
259+
integrate(f::Fun{<:ConstantSpace{<:IntervalOrSegment}}) = Number(f) * Fun(domain(f))
260+
differentiate(f::Fun{<:ConstantSpace{<:IntervalOrSegment}}) = zero(f)

test/SpacesTest.jl

+1
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ using LinearAlgebra
309309
@test g > f
310310
@test g >= f
311311
@test 1 < f < 3
312+
@test differentiate(f) == Fun(0, ConstantSpace(0..1))
312313

313314
@test maxspace(ConstantSpace(Point(1)), ConstantSpace(Point(2))) == ConstantSpace(Point(1) Point(2))
314315
@test maxspace(ConstantSpace(Point(1)), ConstantSpace(AnyDomain())) == ConstantSpace(Point(1))

0 commit comments

Comments
 (0)