|
1 | 1 | # RecurrenceRelationshipArrays.jl |
2 | 2 | A Julia package for caching solutions to recurrence relationships |
| 3 | + |
| 4 | + |
| 5 | +This package implements arrays associated with recurrence relationships |
| 6 | +as implemented in [RecurrenceRelationships.jl](https://github.com/JuliaApproximation/RecurrenceRelationships.jl). |
| 7 | + |
| 8 | +# Matrix-valued Clenshaw |
| 9 | + |
| 10 | +We can |
| 11 | +construct multiplication matrices associated with orthogonal polynomials using `Clenshaw`. The follow represents multiplication by $U_0(x) + 2U_1(x) + 3U_2(x)$ acting on a Chebyshev-U expansion: |
| 12 | +```julia |
| 13 | +julia> using RecurrenceRelationshipArrays, FillArrays, InfiniteArrays |
| 14 | + |
| 15 | +julia> X = SymTridiagonal(Fill(0.0,∞), Fill(1/2,∞)) # Jacobi matrix associated with Chebyshev U |
| 16 | +ℵ₀×ℵ₀ SymTridiagonal{Float64, Fill{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf()×OneToInf(): |
| 17 | + 0.0 0.5 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … |
| 18 | + 0.5 0.0 0.5 ⋅ ⋅ ⋅ ⋅ ⋅ |
| 19 | + ⋅ 0.5 0.0 0.5 ⋅ ⋅ ⋅ ⋅ |
| 20 | + ⋅ ⋅ 0.5 0.0 0.5 ⋅ ⋅ ⋅ |
| 21 | + ⋅ ⋅ ⋅ 0.5 0.0 0.5 ⋅ ⋅ |
| 22 | + ⋅ ⋅ ⋅ ⋅ 0.5 0.0 0.5 ⋅ … |
| 23 | + ⋅ ⋅ ⋅ ⋅ ⋅ 0.5 0.0 0.5 |
| 24 | + ⋮ ⋮ ⋱ |
| 25 | + |
| 26 | +julia> rec_U = Fill(2,∞), Zeros{Int}(∞), Ones{Int}(∞); # recurrence coefficients for Chebyshev U |
| 27 | + |
| 28 | +julia> Clenshaw([1,2,3], rec_U..., X) |
| 29 | +ℵ₀×ℵ₀ Clenshaw{Float64} with 3 degree polynomial: |
| 30 | + 1.0 2.0 3.0 ⋅ ⋅ ⋅ ⋅ ⋅ … |
| 31 | + 2.0 4.0 2.0 3.0 ⋅ ⋅ ⋅ ⋅ |
| 32 | + 3.0 2.0 4.0 2.0 3.0 ⋅ ⋅ ⋅ |
| 33 | + ⋅ 3.0 2.0 4.0 2.0 3.0 ⋅ ⋅ |
| 34 | + ⋅ ⋅ 3.0 2.0 4.0 2.0 3.0 ⋅ |
| 35 | + ⋅ ⋅ ⋅ 3.0 2.0 4.0 2.0 3.0 … |
| 36 | + ⋅ ⋅ ⋅ ⋅ 3.0 2.0 4.0 2.0 |
| 37 | + ⋮ ⋮ ⋱ |
| 38 | +``` |
| 39 | + |
| 40 | + |
| 41 | +# Minimal solutions to 3-term recurrences |
| 42 | + |
| 43 | +The type `RecurrenceArray` allows us to represent a minimal solution |
| 44 | +of a recurrence relationship, i.e., the Stieltjes transform of the orthogonal polynomials. |
| 45 | +This automatically combines forward and backward recurrence, and so will also will work on the support of the measure. Here is a simple example: |
| 46 | +```julia |
| 47 | +julia> z = 1.0001; # point close to the support |
| 48 | + |
| 49 | +julia> ξ = inv(z + sign(z)sqrt(z^2-1)); # exact formula for Stieltjes transform of sqrt(1-x^2). The next term is ξ^2. |
| 50 | + |
| 51 | +julia> r = RecurrenceArray(z, rec_U, [ξ,ξ^2]) |
| 52 | +ℵ₀-element RecurrenceArray{Float64, 1, Float64, Fill{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, Zeros{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf(): |
| 53 | + 0.9859575108273005 |
| 54 | + 0.9721122131567664 |
| 55 | + 0.9584613379288637 |
| 56 | + 0.9450021549685467 |
| 57 | + 0.9317319724392233 |
| 58 | + 0.9186481363043878 |
| 59 | + 0.9057480297968131 |
| 60 | + ⋮ |
| 61 | + |
| 62 | +julia> z = [0.1+0im, 1.0001, 10.0]; # can evaluate at multiple points |
| 63 | + |
| 64 | +julia> ξ = @. inv(z + sign(z)sqrt(z^2-1)); |
| 65 | + |
| 66 | +julia> RecurrenceArray(z, rec_U, [ξ'; ξ'.^2]) |
| 67 | +ℵ₀×3 RecurrenceArray{ComplexF64, 2, Vector{ComplexF64}, Fill{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, Zeros{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}, Ones{Int64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}}} with indices OneToInf()×Base.OneTo(3): |
| 68 | + 0.1+0.994987im 0.985958+0.0im 0.0501256+0.0im |
| 69 | + -0.98+0.198997im 0.972112+0.0im 0.00251258+0.0im |
| 70 | + -0.296-0.955188im 0.958461+0.0im 0.000125945-0.0im |
| 71 | + 0.9208-0.390035im 0.945002+0.0im 6.31305e-6-0.0im |
| 72 | + 0.48016+0.877181im 0.931732+0.0im 3.16446e-7+0.0im |
| 73 | + -0.824768+0.565471im 0.918648+0.0im 1.5862e-8-0.0im |
| 74 | + -0.645114-0.764087im 0.905748+0.0im 7.95095e-10-0.0im |
| 75 | + ⋮ |
| 76 | +``` |
0 commit comments