|
1 | | -struct ChebyshevBasis{P} <: AbstractPolynomialVectorBasis{P, Vector{P}} |
| 1 | +abstract type AbstractChebyshevBasis{P} <: AbstractGegenbauerBasis{P} end |
| 2 | + |
| 3 | +polynomial_type(::Type{<:AbstractChebyshevBasis}, V::Type) = MP.polynomialtype(V, Float64) |
| 4 | + |
| 5 | +reccurence_first_coef(::Type{<:AbstractChebyshevBasis}, degree) = 2 |
| 6 | +reccurence_third_coef(::Type{<:AbstractChebyshevBasis}, degree) = -1 |
| 7 | +reccurence_deno_coef(::Type{<:AbstractChebyshevBasis}, degree) = 1 |
| 8 | + |
| 9 | +""" |
| 10 | + struct ChebyshevBasisFirstKind{P} <: AbstractChebyshevBasis{P} |
| 11 | + polynomials::Vector{P} |
| 12 | + end |
| 13 | +
|
| 14 | +Orthogonal polynomial with respect to the univariate weight function ``w(x) = \\frac{1}{\\sqrt{1 - x^2}}`` over the interval ``[-1, 1]``. |
| 15 | +""" |
| 16 | +struct ChebyshevBasisFirstKind{P} <: AbstractChebyshevBasis{P} |
2 | 17 | polynomials::Vector{P} |
3 | 18 | end |
4 | 19 |
|
5 | | -function chebyshev_polynomial_first_kind(variable::MP.AbstractVariable, degree::Integer) |
6 | | - @assert degree >= 0 |
7 | | - if degree == 0 |
8 | | - return [MA.@rewrite(0 * variable + 1)] |
9 | | - elseif degree == 1 |
10 | | - return push!(chebyshev_polynomial_first_kind(variable, 0), |
11 | | - MA.@rewrite(1 * variable + 0)) |
12 | | - else |
13 | | - previous = chebyshev_polynomial_first_kind(variable, degree - 1) |
14 | | - next = MA.@rewrite(2variable * previous[degree] - previous[degree - 1]) |
15 | | - push!(previous, next) |
16 | | - return previous |
| 20 | +const ChebyshevBasis{P} = ChebyshevBasisFirstKind{P} |
| 21 | + |
| 22 | +degree_one_univariate_polynomial(::Type{<:ChebyshevBasisFirstKind}, variable::MP.AbstractVariable) = MA.@rewrite(variable + 0) |
| 23 | + |
| 24 | +""" |
| 25 | + struct ChebyshevBasisSecondKind{P} <: AbstractChebyshevBasis{P} |
| 26 | + polynomials::Vector{P} |
17 | 27 | end |
18 | | -end |
19 | 28 |
|
20 | | -function maxdegree_basis(B::Type{ChebyshevBasis}, variables, maxdegree::Int) |
21 | | - univariate = [chebyshev_polynomial_first_kind(variable, maxdegree) for variable in variables] |
22 | | - return ChebyshevBasis([ |
23 | | - prod(i -> univariate[i][degree(mono, variables[i]) + 1], |
24 | | - eachindex(variables)) |
25 | | - for mono in MP.monomials(variables, 0:maxdegree)]) |
| 29 | +Orthogonal polynomial with respect to the univariate weight function ``w(x) = \\sqrt{1 - x^2}`` over the interval ``[-1, 1]``. |
| 30 | +""" |
| 31 | +struct ChebyshevBasisSecondKind{P} <: AbstractChebyshevBasis{P} |
| 32 | + polynomials::Vector{P} |
26 | 33 | end |
| 34 | + |
| 35 | +degree_one_univariate_polynomial(::Type{<:ChebyshevBasisSecondKind}, variable::MP.AbstractVariable) = MA.@rewrite(2variable + 0) |
0 commit comments