Skip to content

Commit f154db5

Browse files
authored
Move to ClassicalOrthogonalPolynomials.jl (#12)
* Move to ClassicalOrthogonalPolynomials.jl * updates * tests pass * R asymptotics for P^(1,1,1) * Update runtests.jl * v0.0.3
1 parent 457e897 commit f154db5

File tree

4 files changed

+44
-18
lines changed

4 files changed

+44
-18
lines changed

Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
name = "SemiclassicalOrthogonalPolynomials"
22
uuid = "291c01f3-23f6-4eb6-aeb0-063a639b53f2"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.0.2"
4+
version = "0.0.3"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
88
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
9+
ClassicalOrthogonalPolynomials = "b30e2e7b-c4ee-47da-9d5f-2c5c27239acd"
910
ContinuumArrays = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
1011
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1112
HypergeometricFunctions = "34004b35-14d8-5ef3-9330-4cdb6864b03a"
1213
InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
1314
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
1415
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
15-
OrthogonalPolynomialsQuasi = "aa41a628-2c43-45df-899b-83ab96621781"
1616
QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
1717
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
1818

1919
[compat]
2020
ArrayLayouts = "0.5.1"
2121
BandedMatrices = "0.16"
22-
ContinuumArrays = "0.4"
22+
ClassicalOrthogonalPolynomials = "0.1"
23+
ContinuumArrays = "0.5"
2324
FillArrays = "0.11"
2425
HypergeometricFunctions = "0.3.4"
2526
InfiniteArrays = "0.8, 0.9"
2627
LazyArrays = "0.20"
27-
OrthogonalPolynomialsQuasi = "0.4"
28-
QuasiArrays = "0.3.8"
28+
QuasiArrays = "0.4"
2929
SpecialFunctions = "0.10, 1.0"
3030
julia = "1.5"
3131

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A Julia repository for semiclassical orthogonal polynomials
77

88
This package implements `SemiclassicalJacobi`, a family of orthogonal
99
polynomials orthogonal with respect to the weight `x^a * (1-x)^b * (t-x)^c`.
10-
This builds on top of [OrthogonalPolynomialsQuasi.jl](https://github.com/JuliaApproximation/OrthogonalPolynomialsQuasi.jl) and usage is similar.
10+
This builds on top of [ClassicalOrthogonalPolynomials.jl](https://github.com/JuliaApproximation/ClassicalOrthogonalPolynomials.jl) and usage is similar.
1111

1212
For example, the following gives a half-range Chebyshev polynomial:
1313
```julia

src/SemiclassicalOrthogonalPolynomials.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module SemiclassicalOrthogonalPolynomials
2-
using OrthogonalPolynomialsQuasi, FillArrays, LazyArrays, ArrayLayouts, QuasiArrays, InfiniteArrays, ContinuumArrays, LinearAlgebra, BandedMatrices,
2+
using ClassicalOrthogonalPolynomials, FillArrays, LazyArrays, ArrayLayouts, QuasiArrays, InfiniteArrays, ContinuumArrays, LinearAlgebra, BandedMatrices,
33
SpecialFunctions, HypergeometricFunctions
44

55
import Base: getindex, axes, size, \, /, *, +, -, summary, ==, copy, sum, unsafe_getindex
66

77
import ArrayLayouts: MemoryLayout, ldiv
88
import BandedMatrices: bandwidths, _BandedMatrix, AbstractBandedMatrix, BandedLayout
99
import LazyArrays: resizedata!, paddeddata, CachedVector, CachedMatrix, LazyMatrix, LazyVector, arguments, ApplyLayout, colsupport, AbstractCachedVector
10-
import OrthogonalPolynomialsQuasi: OrthogonalPolynomial, recurrencecoefficients, jacobimatrix, normalize, _p0, UnitInterval, orthogonalityweight
10+
import ClassicalOrthogonalPolynomials: OrthogonalPolynomial, recurrencecoefficients, jacobimatrix, normalize, _p0, UnitInterval, orthogonalityweight
1111
import InfiniteArrays: OneToInf, InfUnitRange
1212
import ContinuumArrays: basis, Weight, @simplify
1313
import FillArrays: SquareEye
@@ -58,20 +58,19 @@ end
5858
5959
is a quasi-matrix for the orthogonal polynomials w.r.t. x^a * (1-x)^b * (t-x)^c on [0,1]
6060
"""
61-
struct SemiclassicalJacobi{T,PP<:LanczosPolynomial} <: OrthogonalPolynomial{T}
61+
struct SemiclassicalJacobi{T,PP} <: OrthogonalPolynomial{T}
6262
t::T
6363
a::T
6464
b::T
6565
c::T
6666
P::PP # We need to store the basic case where ã,b̃,c̃ = mod(a,-1),mod(b,-1),mod(c,-1)
6767
# in order to compute lowering operators, etc.
68-
SemiclassicalJacobi{T,PP}(t::T,a::T,b::T,c::T,P::PP) where {T,PP<:LanczosPolynomial} =
69-
new{T,PP}(t,a,b,c,P)
68+
SemiclassicalJacobi{T,PP}(t::T,a::T,b::T,c::T,P::PP) where {T,PP} = new{T,PP}(t,a,b,c,P)
7069
end
7170

7271
const WeightedSemiclassicalJacobi{T} = WeightedBasis{T,<:SemiclassicalJacobiWeight,<:SemiclassicalJacobi}
7372

74-
function SemiclassicalJacobi(t, a, b, c, P::LanczosPolynomial)
73+
function SemiclassicalJacobi(t, a, b, c, P::OrthogonalPolynomial)
7574
T = float(promote_type(typeof(t), typeof(a), typeof(b), typeof(c), eltype(P)))
7675
SemiclassicalJacobi{T,typeof(P)}(T(t), T(a), T(b), T(c), P)
7776
end
@@ -89,6 +88,14 @@ function SemiclassicalJacobi(t, a, b, c)
8988
SemiclassicalJacobi(t, a, b, c, LanczosPolynomial(@.(x^* (1-x)^* (t-x)^c̃), P))
9089
end
9190

91+
92+
function SemiclassicalJacobi(t, a::Int, b::Int, c::Int)
93+
T = promote_type(typeof(t), typeof(a), typeof(b), typeof(c))
94+
P = Normalized(legendre(UnitInterval{T}()))
95+
x = axes(P,1)
96+
SemiclassicalJacobi(t, a, b, c, P)
97+
end
98+
9299
copy(P::SemiclassicalJacobi) = P
93100
axes(P::SemiclassicalJacobi) = axes(P.P)
94101

test/runtests.jl

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using SemiclassicalOrthogonalPolynomials, OrthogonalPolynomialsQuasi, ContinuumArrays, BandedMatrices, QuasiArrays, Test, LazyArrays, LinearAlgebra
1+
using SemiclassicalOrthogonalPolynomials, ClassicalOrthogonalPolynomials, ContinuumArrays, BandedMatrices, QuasiArrays, Test, LazyArrays, LinearAlgebra
22
import BandedMatrices: _BandedMatrix
33
import SemiclassicalOrthogonalPolynomials: op_lowering
4-
import OrthogonalPolynomialsQuasi: recurrencecoefficients, orthogonalityweight
4+
import ClassicalOrthogonalPolynomials: recurrencecoefficients, orthogonalityweight
55

66
@testset "OrthogonalPolynomialRatio" begin
77
P = Legendre()
@@ -298,6 +298,17 @@ end
298298
end
299299
end
300300

301+
@testset "Legendre" begin
302+
t = 2
303+
P = SemiclassicalJacobi(t, 0, 0, 0)
304+
P¹¹ = SemiclassicalJacobi(t, 1, 1, 0)
305+
Q = SemiclassicalJacobi(t, 0, 0, 1)
306+
@test P[0.1,1:10] Normalized(legendre(0..1))[0.1,1:10]
307+
@test Normalized(P¹¹)[0.1,1:10] 2Normalized(jacobi(1,1,0..1))[0.1,1:10]
308+
x = axes(P,1)
309+
@test LanczosPolynomial(t .- x, legendre(0..1))[0.1,1:10] Normalized(Q)[0.1,1:10]
310+
end
311+
301312
@testset "Semiclassical operator asymptotics" begin
302313
t = 2.2
303314
P = SemiclassicalJacobi(t, 0, 0, 0)
@@ -337,10 +348,18 @@ end
337348
R = U \ T;
338349
@test R[n,n+1]/R[n,n] 1+c atol=1E-3
339350
@test R[n,n+2]/R[n,n] c atol=1E-3
340-
L =T \ (SemiclassicalJacobiWeight(2, 1, 0, 1) .* U)
341-
@test 2L[n+1,n] 1+c atol=1E-3
342-
@test 2L[n+2,n] c atol=1E-3
351+
L =T \ (SemiclassicalJacobiWeight(t, 1, 0, 1) .* U)
352+
@test L[n+1,n]/L[n,n] 1+c atol=1E-3
353+
@test L[n+2,n]/L[n,n] c atol=1E-3
354+
end
343355

344-
# x = z ->
356+
@testset "P,Q" begin
357+
Q = SemiclassicalJacobi(t, 1, 1, 1, P)
358+
R = Q \ P
359+
c = -1/(2*φ(2t-1))
360+
# (1 + c*z)*(1-z^2) == 1 + c*z - z^2 - c*z^2
361+
@test R[200,201]/R[200,200] c atol=1e-2
362+
@test R[200,202]/R[200,200] -1 atol=1e-2
363+
@test R[200,203]/R[200,200] -c atol=1e-2
345364
end
346365
end

0 commit comments

Comments
 (0)