Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't differentiate the constant basis function in Chebyshev()^2 #740

Closed
tobydriscoll opened this issue Apr 28, 2021 · 1 comment
Closed

Comments

@tobydriscoll
Copy link

I expected this to just return zero:

julia> X = Chebyshev()^2;

julia> f = Fun(X,[1.0]);

julia> D = Derivative(X,[1,0]);

julia> D*f
ERROR: BoundsError: attempt to access 0-element UnitRange{Int64} at index [0]
Stacktrace:
 [1] throw_boundserror(A::UnitRange{Int64}, I::Int64)
   @ Base ./abstractarray.jl:651
 [2] getindex
   @ ./range.jl:696 [inlined]
 [3] mul_coefficients(A::ApproxFunBase.SubOperator{Float64, KroneckerOperator{ApproxFunBase.ConcreteDerivative{Chebyshev{ChebyshevInterval{Float64}, Float64}, Int64, Float64}, ConstantOperator{Float64, Chebyshev{ChebyshevInterval{Float64}, Float64}}, TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, TensorSpace{Tuple{Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, ApproxFunBase.CachedIterator{Tuple{Int64, Int64}, ApproxFunBase.Tensorizer{Tuple{FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}}}, ApproxFunBase.CachedIterator{Tuple{Int64, Int64}, ApproxFunBase.Tensorizer{Tuple{FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}}}, Float64}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, Tuple{Int64, Int64}, Tuple{Int64, Int64}}, b::Vector{Float64})
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/BW4ev/src/PDE/KroneckerOperator.jl:421
 [4] mul_coefficients
   @ ~/.julia/packages/ApproxFunBase/BW4ev/src/Operators/general/algebra.jl:590 [inlined]
 [5] mul_coefficients(A::ApproxFunBase.DerivativeWrapper{KroneckerOperator{ApproxFunBase.ConcreteDerivative{Chebyshev{ChebyshevInterval{Float64}, Float64}, Int64, Float64}, ConstantOperator{Float64, Chebyshev{ChebyshevInterval{Float64}, Float64}}, TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, TensorSpace{Tuple{Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, ApproxFunBase.CachedIterator{Tuple{Int64, Int64}, ApproxFunBase.Tensorizer{Tuple{FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}}}, ApproxFunBase.CachedIterator{Tuple{Int64, Int64}, ApproxFunBase.Tensorizer{Tuple{FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}}}, Float64}, TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, Vector{Int64}, Float64}, b::Vector{Float64})
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/BW4ev/src/Operators/Operator.jl:490
 [6] *(A::ApproxFunBase.DerivativeWrapper{KroneckerOperator{ApproxFunBase.ConcreteDerivative{Chebyshev{ChebyshevInterval{Float64}, Float64}, Int64, Float64}, ConstantOperator{Float64, Chebyshev{ChebyshevInterval{Float64}, Float64}}, TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, TensorSpace{Tuple{Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, ApproxFunBase.CachedIterator{Tuple{Int64, Int64}, ApproxFunBase.Tensorizer{Tuple{FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}}}, ApproxFunBase.CachedIterator{Tuple{Int64, Int64}, ApproxFunBase.Tensorizer{Tuple{FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, FillArrays.Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}}}}, Float64}, TensorSpace{Tuple{Chebyshev{ChebyshevInterval{Float64}, Float64}, Chebyshev{ChebyshevInterval{Float64}, Float64}}, DomainSets.VcatDomain{2, Float64, (1, 1), Tuple{ChebyshevInterval{Float64}, ChebyshevInterval{Float64}}}, Float64}, Vector{Int64}, Float64}, b::Function)
   @ ApproxFunBase ~/.julia/packages/ApproxFunBase/BW4ev/src/Operators/general/algebra.jl:611
 [7] top-level scope

It works fine on Fun(X,[1.0,0]), so I figure this is a bug.

@dlfivefifty
Copy link
Member

Fixed on ApproxFunBase#master, I'll tag now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants