Skip to content

Commit

Permalink
dlmf notation
Browse files Browse the repository at this point in the history
  • Loading branch information
daanhb committed Oct 14, 2024
1 parent 513bb62 commit 8ffc457
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/bases/poly/chebyshev/ChebyshevT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ jacobi_α(b::ChebyshevT{T}) where T = -one(T)/2
jacobi_β(b::ChebyshevT{T}) where T = -one(T)/2

# Recurrence relation
rec_An(b::ChebyshevT{T}, n::Int) where T = chebyshev_1st_rec_An(n, T)
rec_Bn(b::ChebyshevT{T}, n::Int) where T = chebyshev_1st_rec_Bn(n, T)
rec_Cn(b::ChebyshevT{T}, n::Int) where T = chebyshev_1st_rec_Cn(n, T)
rec_An(b::ChebyshevT{T}, n::Int) where T = chebyshevt_rec_An(n, T)
rec_Bn(b::ChebyshevT{T}, n::Int) where T = chebyshevt_rec_Bn(n, T)
rec_Cn(b::ChebyshevT{T}, n::Int) where T = chebyshevt_rec_Cn(n, T)

# We can define this O(1) evaluation method, but only for points that are
# real and lie in [-1,1]
Expand Down Expand Up @@ -118,7 +118,7 @@ function dict_innerproduct_native(b1::ChebyshevT, i::PolynomialDegree,
end

innerproduct_chebyshev_full(i, j, T) =
i == j ? chebyshev_1st_hn(value(i), T) : zero(T)
i == j ? chebyshevt_hn(value(i), T) : zero(T)

function dict_innerproduct_native(b1::ChebyshevT, i::PolynomialDegree,
b2::ChebyshevT, j::PolynomialDegree, measure::Union{LegendreWeight,Lebesgue}; options...)
Expand Down
8 changes: 4 additions & 4 deletions src/bases/poly/chebyshev/ChebyshevU.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ hasmeasure(::ChebyshevU) = true
function dict_innerproduct_native(b1::ChebyshevU, i::PolynomialDegree,
b2::ChebyshevU, j::PolynomialDegree, m::ChebyshevUWeight; options...)
T = promote_type(domaintype(b1), domaintype(b2))
i == j ? chebyshev_2nd_hn(value(i), T) : zero(T)
i == j ? chebyshevu_hn(value(i), T) : zero(T)
end


Expand All @@ -43,9 +43,9 @@ jacobi_β(b::ChebyshevU{T}) where T = one(T)/2


# Recurrence relation
rec_An(b::ChebyshevU{T}, n::Int) where T = chebyshev_2nd_rec_An(n, T)
rec_Bn(b::ChebyshevU{T}, n::Int) where T = chebyshev_2nd_rec_Bn(n, T)
rec_Cn(b::ChebyshevU{T}, n::Int) where T = chebyshev_2nd_rec_Cn(n, T)
rec_An(b::ChebyshevU{T}, n::Int) where T = chebyshevu_rec_An(n, T)
rec_Bn(b::ChebyshevU{T}, n::Int) where T = chebyshevu_rec_Bn(n, T)
rec_Cn(b::ChebyshevU{T}, n::Int) where T = chebyshevu_rec_Cn(n, T)


"A Chebyshev polynomial of the second kind"
Expand Down
36 changes: 18 additions & 18 deletions src/bases/poly/ops/dlmf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ jacobi_kn(n::Int, α, β) = pochhammer(n+α+β+1, n) / (2^n * factorial(n))
ultraspherical_hn(n::Int, λ::T) where T = 2^(1-2λ)*T(π)*gamma(n+2λ) / ((n+λ)*gamma(λ)^2*factorial(n))
ultraspherical_kn(n::Int, λ) = 2^n*pochhammer(λ, n) / factorial(n)

chebyshev_1st_hn(n::Int, ::Type{T} = Float64) where T = n == 0 ? T(π) : T(π)/2
chebyshev_1st_kn(n::Int, ::Type{T} = Float64) where T = n == 0 ? one(T) : T(2)^(n-1)
chebyshevt_hn(n::Int, ::Type{T} = Float64) where T = n == 0 ? T(π) : T(π)/2
chebyshevt_kn(n::Int, ::Type{T} = Float64) where T = n == 0 ? one(T) : T(2)^(n-1)

chebyshev_2nd_hn(n::Int, ::Type{T} = Float64) where T = T(π)/2
chebyshev_2nd_kn(n::Int, ::Type{T} = Float64) where T = T(2)^n
chebyshevu_hn(n::Int, ::Type{T} = Float64) where T = T(π)/2
chebyshevu_kn(n::Int, ::Type{T} = Float64) where T = T(2)^n

chebyshev_3rd_hn(n::Int, ::Type{T} = Float64) where T = T(π)
chebyshev_3rd_kn(n::Int, ::Type{T} = Float64) where T = T(2)^n
chebyshevv_hn(n::Int, ::Type{T} = Float64) where T = T(π)
chebyshevv_kn(n::Int, ::Type{T} = Float64) where T = T(2)^n

chebyshev_4rd_hn(n::Int, ::Type{T} = Float64) where T = T(π)
chebyshev_4rd_kn(n::Int, ::Type{T} = Float64) where T = T(2)^n
chebyshevw_hn(n::Int, ::Type{T} = Float64) where T = T(π)
chebyshevw_kn(n::Int, ::Type{T} = Float64) where T = T(2)^n

legendre_hn(n::Int, ::Type{T} = Float64) where T = 2 / T(2n+1)
legendre_kn(n::Int, ::Type{T} = Float64) where T = 2^n*pochhammer(one(T)/2, n) / factorial(n)
Expand Down Expand Up @@ -106,12 +106,12 @@ ultraspherical_rec_Bn(n::Int, λ) = zero(λ)
ultraspherical_rec_Cn(n::Int, λ) = (n+2λ-1) / (n+1)

# Chebyshev
chebyshev_1st_rec_An(n::Int, ::Type{T} = Float64) where T = n == 0 ? one(T) : T(2)
chebyshev_1st_rec_Bn(n::Int, ::Type{T} = Float64) where T = zero(T)
chebyshev_1st_rec_Cn(n::Int, ::Type{T} = Float64) where T = one(T)
chebyshev_2nd_rec_An(n::Int, ::Type{T} = Float64) where T = T(2)
chebyshev_2nd_rec_Bn(n::Int, ::Type{T} = Float64) where T = zero(T)
chebyshev_2nd_rec_Cn(n::Int, ::Type{T} = Float64) where T = one(T)
chebyshevt_rec_An(n::Int, ::Type{T} = Float64) where T = n == 0 ? one(T) : T(2)
chebyshevt_rec_Bn(n::Int, ::Type{T} = Float64) where T = zero(T)
chebyshevt_rec_Cn(n::Int, ::Type{T} = Float64) where T = one(T)
chebyshevu_rec_An(n::Int, ::Type{T} = Float64) where T = T(2)
chebyshevu_rec_Bn(n::Int, ::Type{T} = Float64) where T = zero(T)
chebyshevu_rec_Cn(n::Int, ::Type{T} = Float64) where T = one(T)

# Laguerre
laguerre_rec_An(n::Int, α::T) where T = -one(T)/(n+1)
Expand All @@ -131,15 +131,15 @@ hermite_rec_Cn(n::Int, ::Type{T} = Float64) where T = T(2n)
# https://dlmf.nist.gov/18.7
##############################

"DLMF formula (18.7.1)."
"DLMF equation 18.7.1 (https://dlmf.nist.gov/18.7#E1)"
ultraspherical_to_jacobi(n::Int, λ) = pochhammer(2λ, n) / pochhammer+one(λ)/2, n)
"DLMF formula (18.7.2)."
"DLMF equation 18.7.2 (https://dlmf.nist.gov/18.7#E2)"
jacobi_to_ultraspherical_(n::Int, α) = pochhammer+1, n) / pochhammer(2α+1, n)

"DLMF formula (18.7.3)."
"DLMF equation 18.7.3 (https://dlmf.nist.gov/18.7#E3)"
chebyshevt_to_jacobi(n::Int, ::Type{T} = Float64) where T =
1 / jacobi_eval(n, one(T), -one(T)/2, -one(T)/2)

"DLMF formula (18.7.4)."
"DLMF equation 18.7.4 (https://dlmf.nist.gov/18.7#E4)"
chebyshevu_to_jacobi(n::Int, ::Type{T} = Float64) where T =
(n+1_) / jacobi_eval(n, one(T), one(T)/2, one(T)/2)

0 comments on commit 8ffc457

Please sign in to comment.