-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhermite.jl
60 lines (51 loc) · 1.86 KB
/
hermite.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
abstract type AbstractHermite <: AbstractMultipleOrthogonal end
_promote_coef(::Type{T}, ::Type{<:AbstractHermite}) where {T} = _float(T)
even_odd_separated(::Type{<:AbstractHermite}) = true
reccurence_second_coef(::Type{<:AbstractHermite}, degree) = 0
reccurence_deno_coef(::Type{<:AbstractHermite}, degree) = 1
"""
struct ProbabilistsHermiteBasis{P} <: AbstractHermiteBasis{P}
polynomials::Vector{P}
end
Orthogonal polynomial with respect to the univariate weight function ``w(x) = \\exp(-x^2/2)`` over the interval ``[-\\infty, \\infty]``.
"""
struct ProbabilistsHermite <: AbstractHermite end
reccurence_first_coef(::Type{ProbabilistsHermite}, degree) = 1
function reccurence_third_coef(::Type{ProbabilistsHermite}, degree)
return -(degree - 1)
end
function degree_one_univariate_polynomial(::Type{ProbabilistsHermite}, variable)
MA.@rewrite(1variable)
end
function _scalar_product_function(::Type{ProbabilistsHermite}, i::Int)
if i == 0
return √(2 * π)
elseif isodd(i)
return 0
else
n = div(i, 2)
return (√(2 * π) / (2^n)) * prod(n+1:2*n)
end
end
"""
struct PhysicistsHermite{P} <: AbstractHermite{P}
polynomials::Vector{P}
end
Orthogonal polynomial with respect to the univariate weight function ``w(x) = \\exp(-x^2)`` over the interval ``[-\\infty, \\infty]``.
"""
struct PhysicistsHermite <: AbstractHermite end
reccurence_first_coef(::Type{PhysicistsHermite}, degree) = 2
reccurence_third_coef(::Type{PhysicistsHermite}, degree) = -2(degree - 1)
function degree_one_univariate_polynomial(::Type{PhysicistsHermite}, variable)
MA.@rewrite(2variable)
end
function _scalar_product_function(::Type{PhysicistsHermite}, i::Int)
if i == 0
return √(π)
elseif isodd(i)
return 0
else
n = div(i, 2)
return (√(π) / (2^i)) * prod(n+1:i)
end
end