@@ -17,7 +17,8 @@ import ClassicalOrthogonalPolynomials: OrthogonalPolynomial, recurrencecoefficie
1717import  InfiniteArrays:  OneToInf, InfUnitRange
1818import  ContinuumArrays:  basis, Weight, @simplify , AbstractBasisLayout, BasisLayout, MappedBasisLayout, grid, plotgrid, equals_layout, ExpansionLayout
1919import  FillArrays:  SquareEye
20- import  HypergeometricFunctions:  _₂F₁general2
20+ import  HypergeometricFunctions:  _₂F₁general2, _₂F₁
21+ import  SpecialFunctions:  beta
2122
2223export  LanczosPolynomial, Legendre, Normalized, normalize, SemiclassicalJacobi, SemiclassicalJacobiWeight, WeightedSemiclassicalJacobi, OrthogonalPolynomialRatio
2324
@@ -129,6 +130,17 @@ SemiclassicalJacobi{T}(t, a, b, c) where T = SemiclassicalJacobi(convert(T,t), c
129130
130131WeightedSemiclassicalJacobi {T} (t, a, b, c, P... ) where  T =  SemiclassicalJacobiWeight {T} (convert (T,t), convert (T,a), convert (T,b), convert (T,c)) .*  SemiclassicalJacobi {T} (convert (T,t), convert (T,a), convert (T,b), convert (T,c), P... )
131132
133+ #  Returns α, β such that P1(x) = β(x-α)
134+ function  _linear_coefficients (t, a, b, c)
135+     #  beta(a + 1, b + 1) * t^c * _₂F₁(a + 1, -c, a + b + 2, 1/t) is the integral ∫₀¹ wᵗ⁽ᵃᵇᶜ⁾(x) dx 
136+     Γᵃ =  beta (a +  1 , b +  1 ) *  _₂F₁ (a +  1 , - c, a +  b +  2 , 1 / t)
137+     Γᵃ⁺¹ =  beta (a +  2 , b +  1 ) *  _₂F₁ (a +  2 , - c, a +  b +  3 , 1 / t)
138+     Γᵃ⁺² =  beta (a +  3 , b +  1 ) *  _₂F₁ (a +  3 , - c, a +  b +  4 , 1 / t)
139+     α =  Γᵃ⁺¹/ Γᵃ
140+     β =  sqrt (Γᵃ /  (Γᵃ⁺² -  2 α* Γᵃ⁺¹ +  α^ 2 * Γᵃ))
141+     return  α, β
142+ end 
143+ 
132144function  semiclassical_jacobimatrix (t, a, b, c)
133145    T =  float (promote_type (typeof (t), typeof (a), typeof (b), typeof (c)))
134146    if  iszero (a) &&  iszero (b) &&  c ==  - one (T)
@@ -471,13 +483,13 @@ function \(w_A::WeightedSemiclassicalJacobi{T}, w_B::WeightedSemiclassicalJacobi
471483        wP =  Weighted (P) 
472484        wQ =  Weighted (Q)
473485        R22 =  wP \  wQ
474-         r11  =  A . t  -   1   
475-         qw0  =  SemiclassicalJacobiWeight (Q . t, Q . a,  zero (Q . b), Q . c) 
476-         pw0  =  SemiclassicalJacobiWeight (P . t, P . a,  zero (P . b), P . c) 
477-         r21  =  wP[:,  1 : 2 ]  \  (qw0  .-  r11  .*  pw0 )
478-         d0 =  Vcat (r11 , R22[band (0 )])
479-         d1 =  Vcat (r21[ begin ] , R22[band (- 1 )])
480-         d2 =  Vcat (r21[ begin + 1 ] , R22[band (- 2 )])
486+         α, β  =   _linear_coefficients (P . t, P . a, P . b, P . c) 
487+         ℓ₁  =  A . t  -   1   
488+         ℓ₂  =  1   +  α  -  A . t  
489+         ℓ₃  =  inv (β )
490+         d0 =  Vcat (ℓ₁ , R22[band (0 )])
491+         d1 =  Vcat (ℓ₂ , R22[band (- 1 )])
492+         d2 =  Vcat (ℓ₃ , R22[band (- 2 )])
481493        data =  Hcat (d0, d1, d2)
482494        return  _BandedMatrix (data' , 1 : ∞, 2 , 0 )
483495    elseif  (wA. a ==  A. a) &&  (wA. b ==  A. b) &&  (wA. c ==  A. c) &&  (wB. a ==  B. a) &&  (wB. b ==  B. b) &&  (wB. c ==  B. c) &&  isinteger (A. a) &&  isinteger (A. b) &&  isinteger (A. c) &&  isinteger (B. a) &&  isinteger (B. b) &&  isinteger (B. c)
0 commit comments