JuliaApproximation / JuliaApproximation/ApproxFunBase.jl

3+ dim calculus operator do not work and Syntax proposal

Open
#389 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
13
Forks
13
Avg merge
10h 33m
Merged PRs (30d)
16

Description

Currently,

julia> Derivative(Chebyshev()^2, [1,0])
DerivativeWrapper : Chebyshev() ⊗ Chebyshev() → Ultraspherical(1) ⊗ Chebyshev()
 0.0  0.0  1.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ⋯
 0.0  0.0  0.0  0.0  1.0  0.0  0.0  0.0  0.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  2.0  0.0  0.0  0.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  1.0  0.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  2.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  3.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ⋱
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  ⋱
  ⋮    ⋱    ⋱    ⋱    ⋱    ⋱    ⋱    ⋱    ⋱    ⋱   ⋱

julia> Integral(Chebyshev()^2, [1,0])
ERROR: Implement Integral(Chebyshev() ⊗ Chebyshev(),[1, 0])
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] DefaultIntegral(sp::TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.FixedIntervalProduct{2, Float64, ChebyshevInterval{Float64}}, Float64}, k::Vector{Int64})
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/VD9Rj/src/Operators/banded/CalculusOperator.jl:41
 [3] Integral(::TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.FixedIntervalProduct{2, Float64, ChebyshevInterval{Float64}}, Float64}, ::Vararg{Any})
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/VD9Rj/src/Operators/banded/CalculusOperator.jl:53
 [4] top-level scope
   @ REPL[94]:1

Integral(Chebyshev()) ⊗ I
KroneckerOperator : Chebyshev() ⊗ ApproxFunBase.UnsetSpace() → Chebyshev() ⊗ ApproxFunBase.UnsetSpace()

It would be nice to have a Syntax for Integral(Chebyshev()^2, [1,0]) for integration over the first variable as well as for DefiniteIntegral.

Furthermore, currently the following throws an error:

julia> Op = Integral(Chebyshev()) ⊗ I ⊗ I 
KroneckerOperator : Chebyshev() ⊗ ApproxFunBase.UnsetSpace() ⊗ ApproxFunBase.UnsetSpace() → Chebyshev() ⊗ ApproxFunBase.UnsetSpace() ⊗ ApproxFunBase.UnsetSpace()

julia> f3 = Fun(Chebyshev()^3, rand(20));

julia> Op * f3
ERROR: Implement Conversion from Chebyshev{ChebyshevInterval{Float64}, Float64} to TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, ApproxFunBase.UnsetSpace}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, DomainSets.FullSpace{Float64}}}, Union{}}
Stacktrace:

as well as the same for the Derivative.

Maybe I am misusing the package for something it is not intended to be, but I want to use it for implementing closed form integration, marginalization, and derivatives of SOS polynomials and therefore would need this operations for higher dimensions.

@jishnub Do you have an advice for me where I have to start for implementing this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Integral and Derivative entry points and the DefaultIntegral implementation in Operators/banded/CalculusOperator.jl, which appears in the stack trace. Reproduce the tensor-space and three-dimensional examples, then trace the conversion and Kronecker-operator application failures. Done should include higher-dimensional integration and differentiation, including the requested variable-selection syntax and matching behavior for DefiniteIntegral.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.