You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
broadcasted(::LazyQuasiArrayStyle{1}, ::typeof(Base.literal_pow), ::Base.RefValue{typeof(^)}, w::AbstractJacobiWeight, ::Base.RefValue{Val{k}}) where k =
22
22
JacobiWeight(k * w.a, k * w.b)
23
23
24
+
"""
25
+
JacobiWeight{T}(a,b)
26
+
JacobiWeight(a,b)
27
+
28
+
The quasi-vector representing the Jacobi weight function ``(1-x)^a (1+x)^b`` on ``[-1,1]``. See also [`jacobiweight`](@ref) and [`Jacobi`](@ref).
29
+
# Examples
30
+
```jldoctest
31
+
julia> J=JacobiWeight(1.0,1.0)
32
+
(1-x)^1.0 * (1+x)^1.0 on -1..1
33
+
34
+
julia> J[0.5]
35
+
0.75
36
+
37
+
julia> axes(J)
38
+
(Inclusion(-1.0 .. 1.0 (Chebyshev)),)
39
+
```
40
+
"""
24
41
struct JacobiWeight{T} <:AbstractJacobiWeight{T}
25
42
a::T
26
43
b::T
27
44
JacobiWeight{T}(a, b) where T =new{T}(convert(T,a), convert(T,b))
28
45
end
29
46
30
47
JacobiWeight(a::V, b::T) where {T,V} =JacobiWeight{promote_type(T,V)}(a,b)
48
+
49
+
"""
50
+
jacobiweight(a,b, d::AbstractInterval)
51
+
52
+
The [`JacobiWeight`](@ref) affine-mapped to interval `d`.
53
+
54
+
# Examples
55
+
```jldoctest
56
+
julia> J = jacobiweight(1, 1, 0..1)
57
+
(1-x)^1 * (1+x)^1 on -1..1 affine mapped to 0 .. 1
58
+
59
+
julia> axes(J)
60
+
(Inclusion(0 .. 1),)
61
+
62
+
julia> J[0.5]
63
+
1.0
64
+
```
65
+
"""
31
66
jacobiweight(a,b, d::AbstractInterval{T}) where T =JacobiWeight(a,b)[affine(d,ChebyshevInterval{T}())]
32
67
33
68
AbstractQuasiArray{T}(w::JacobiWeight) where T =JacobiWeight{T}(w.a, w.b)
@@ -92,7 +127,41 @@ include("legendre.jl")
92
127
singularitiesbroadcast(::typeof(*), ::LegendreWeight, b::AbstractJacobiWeight) = b
93
128
singularitiesbroadcast(::typeof(*), a::AbstractJacobiWeight, ::LegendreWeight) = a
94
129
95
-
130
+
"""
131
+
Jacobi{T}(a,b)
132
+
Jacobi(a,b)
133
+
134
+
The quasi-matrix representing Jacobi polynomials, where the first axes represents the interval and the second axes represents the polynomial index (starting from 1). See also [`jacobi`](@ref), [`jacobip`](@ref) and [`JacobiWeight`](@ref).
135
+
136
+
The eltype, when not specified, will be converted to a floating point data type.
137
+
# Examples
138
+
```jldoctest
139
+
julia> J=Jacobi(0,0) # The eltype will be converted to float
140
+
Jacobi(0.0, 0.0)
141
+
142
+
julia> axes(J)
143
+
(Inclusion(-1.0 .. 1.0 (Chebyshev)), OneToInf())
144
+
145
+
julia> J[0,:] # Values of polynomials at x=0
146
+
ℵ₀-element view(::Jacobi{Float64}, 0.0, :) with eltype Float64 with indices OneToInf():
147
+
1.0
148
+
0.0
149
+
-0.5
150
+
-0.0
151
+
0.375
152
+
0.0
153
+
-0.3125
154
+
-0.0
155
+
0.2734375
156
+
0.0
157
+
⋮
158
+
159
+
julia> J0=J[:,1]; # J0 is the first Jacobi polynomial which is constant.
160
+
161
+
julia> J0[0],J0[0.5]
162
+
(1.0, 1.0)
163
+
```
164
+
"""
96
165
struct Jacobi{T} <:AbstractJacobi{T}
97
166
a::T
98
167
b::T
@@ -104,7 +173,34 @@ Jacobi(a::V, b::T) where {T,V} = Jacobi{float(promote_type(T,V))}(a, b)
104
173
AbstractQuasiArray{T}(w::Jacobi) where T =Jacobi{T}(w.a, w.b)
105
174
AbstractQuasiMatrix{T}(w::Jacobi) where T =Jacobi{T}(w.a, w.b)
106
175
107
-
176
+
"""
177
+
jacobi(a,b, d::AbstractInterval)
178
+
179
+
The [`Jacobi`](@ref) polynomials affine-mapped to interval `d`.
180
+
181
+
# Examples
182
+
```jldoctest
183
+
julia> J = jacobi(1, 1, 0..1)
184
+
Jacobi(1.0, 1.0) affine mapped to 0 .. 1
185
+
186
+
julia> axes(J)
187
+
(Inclusion(0 .. 1), OneToInf())
188
+
189
+
julia> J[0,:]
190
+
ℵ₀-element view(::Jacobi{Float64}, -1.0, :) with eltype Float64 with indices OneToInf():
191
+
1.0
192
+
-2.0
193
+
3.0
194
+
-4.0
195
+
5.0
196
+
-6.0
197
+
7.0
198
+
-8.0
199
+
9.0
200
+
-10.0
201
+
⋮
202
+
```
203
+
"""
108
204
jacobi(a,b) =Jacobi(a,b)
109
205
jacobi(a,b, d::AbstractInterval{T}) where T =Jacobi{float(promote_type(eltype(a),eltype(b),T))}(a,b)[affine(d,ChebyshevInterval{T}()), :]
The quasi-matrix representing Legendre polynomials, where the first axes represents the interval and the second axes represents the polynomial index (starting from 1). See also [`legendre`](@ref), [`legendrep`](@ref), [`LegendreWeight`](@ref) and [`Jacobi`](@ref).
88
+
# Examples
89
+
```jldoctest
90
+
julia> P = Legendre()
91
+
Legendre()
92
+
93
+
julia> typeof(P) # default eltype
94
+
Legendre{Float64}
95
+
96
+
julia> axes(P)
97
+
(Inclusion(-1.0 .. 1.0 (Chebyshev)), OneToInf())
98
+
99
+
julia> P[0,:] # Values of polynomials at x=0
100
+
ℵ₀-element view(::Legendre{Float64}, 0.0, :) with eltype Float64 with indices OneToInf():
101
+
1.0
102
+
0.0
103
+
-0.5
104
+
-0.0
105
+
0.375
106
+
0.0
107
+
-0.3125
108
+
-0.0
109
+
0.2734375
110
+
0.0
111
+
⋮
112
+
113
+
julia> P₀=P[:,1]; # P₀ is the first Legendre polynomial which is constant.
114
+
115
+
julia> P₀[0],P₀[0.5]
116
+
(1.0, 1.0)
117
+
```
118
+
"""
49
119
struct Legendre{T} <:AbstractJacobi{T}end
50
120
Legendre() =Legendre{Float64}()
51
121
@@ -57,6 +127,34 @@ weighted(P::Normalized{<:Any,<:Legendre}) = P
57
127
weighted(P::SubQuasiArray{<:Any,2,<:Legendre}) = P
58
128
weighted(P::SubQuasiArray{<:Any,2,<:Normalized{<:Any,<:Legendre}}) = P
59
129
130
+
"""
131
+
legendre(d::AbstractInterval)
132
+
133
+
The [`Legendre`](@ref) polynomials affine-mapped to interval `d`.
134
+
135
+
# Examples
136
+
```jldoctest
137
+
julia> P = legendre(0..1)
138
+
Legendre() affine mapped to 0 .. 1
139
+
140
+
julia> axes(P)
141
+
(Inclusion(0 .. 1), OneToInf())
142
+
143
+
julia> P[0.5,:]
144
+
ℵ₀-element view(::Legendre{Float64}, 0.0, :) with eltype Float64 with indices OneToInf():
145
+
1.0
146
+
0.0
147
+
-0.5
148
+
-0.0
149
+
0.375
150
+
0.0
151
+
-0.3125
152
+
-0.0
153
+
0.2734375
154
+
0.0
155
+
⋮
156
+
```
157
+
"""
60
158
legendre() =Legendre()
61
159
legendre(d::AbstractInterval{T}) where T =Legendre{float(T)}()[affine(d,ChebyshevInterval{T}()), :]
62
160
legendre(d::ChebyshevInterval{T}) where T =Legendre{float(T)}()
0 commit comments