Skip to content

Commit 902aae1

Browse files
authored
Support Jacobi(-1,0)\Ultraspherical(-1/2) and Jacobi(0,-1) (#245)
* Support Jacobi(-1,0)\Ultraspherical(-1/2) * Fix slash * Add Jacobi(0,-1) * Clarify
1 parent 15d5f64 commit 902aae1

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ClassicalOrthogonalPolynomials"
22
uuid = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.15.3"
4+
version = "0.15.4"
55

66

77
[deps]

src/classical/ultraspherical.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,19 @@ function \(A::Ultraspherical, B::Jacobi)
199199
Diagonal(Ã[1,:]./A[1,:]) * (Ã\B)
200200
end
201201
function \(A::Jacobi, B::Ultraspherical)
202-
= Jacobi(B)
203-
(A\B̃)*Diagonal(B[1,:]./B̃[1,:])
202+
if B == Ultraspherical(-1/2) && (A == Jacobi(-1, 0) || A == Jacobi(0, -1))
203+
# In this case, Jacobi(-1, -1) is (currently) undefined, so the conversion via B̃ = Jacobi(B) leads to NaNs
204+
# from evaluating in B̃[1, :]
205+
T = promote_type(eltype(A), eltype(B))
206+
n = -2one(T) ./ (2 .* (2:∞) .- one(T))
207+
sgn = A == Jacobi(-1, 0) ? one(T) : -one(T)
208+
dv = Vcat(one(T), -2one(T), n)
209+
ev = Vcat(-sgn, sgn .* n)
210+
LazyBandedMatrices.Bidiagonal(dv, ev, :U)
211+
else
212+
= Jacobi(B)
213+
(A\B̃)*Diagonal(B[1,:]./B̃[1,:])
214+
end
204215
end
205216

206217
function \(wA::Weighted{<:Any,<:Ultraspherical}, wB::Weighted{<:Any,<:Jacobi})

test/test_ultraspherical.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,15 @@ using ClassicalOrthogonalPolynomials: grammatrix
207207
@testset "ChebyshevInterval constructior" begin
208208
@test ultraspherical(2,ChebyshevInterval()) Ultraspherical(2)
209209
end
210+
end
211+
212+
@testset "Jacobi(-1, 0) \\ Ultraspherical(-1/2) and Jacobi(0, -1) \\ Ultraspherical(-1/2)" begin
213+
for A in (Jacobi(-1,0),Jacobi(0,-1))
214+
B = Ultraspherical(-1/2)
215+
R = A \ B
216+
AR = A * R
217+
lhs = AR[0.3918, 1:100]
218+
rhs = B[0.3918, 1:100]
219+
@test lhs rhs
220+
end
210221
end

0 commit comments

Comments
 (0)