Skip to content

Commit e877844

Browse files
authored
Fix jacobi integral where one order needs shifting (#261)
* fix jacobi integral where one order needs shifting * version bump to v0.6.34
1 parent 2721a0d commit e877844

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunOrthogonalPolynomials"
22
uuid = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
3-
version = "0.6.33"
3+
version = "0.6.34"
44

55
[deps]
66
ApproxFunBase = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"

src/Spaces/Jacobi/Jacobi.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,18 @@ reverseorientation(f::Fun{<:Jacobi}) =
8888
# p_{n+1} = (A_n x + B_n)p_n - C_n p_{n-1}
8989
#####
9090
@inline function jacobirecA(::Type{T},α,β,k)::T where T
91-
k==0&&((α+β==0)||+β==-1)) ?+β)/2+one(T) : (2k+α+β+one(T))*(2k+α+β+2one(T))/(2*(k+one(T))*(k+α+β+one(T)))
91+
if k==0 && ((α+β==0)||+β==-1))
92+
+β)/2+one(T)
93+
else
94+
(2k+α+β+one(T))*(2k+α+β+2one(T))/(2*(k+one(T))*(k+α+β+one(T)))
95+
end
9296
end
9397
@inline function jacobirecB(::Type{T},α,β,k)::T where T
94-
k==0&&((α+β==0)||+β==-1)) ?-β)*one(T)/2 :-β)*+β)*(2k+α+β+one(T))/(2*(k+one(T))*(k+α+β+one(T))*(2one(T)*k+α+β))
98+
if k==0 && ((α+β==0)||+β==-1))
99+
-β)*one(T)/2
100+
else
101+
-β)*+β)*(2k+α+β+one(T))/(2*(k+one(T))*(k+α+β+one(T))*(2one(T)*k+α+β))
102+
end
95103
end
96104
@inline function jacobirecC(::Type{T},α,β,k)::T where T
97105
(one(T)*k+α)*(one(T)*k+β)*(2k+α+β+2one(T))/((k+one(T))*(k+α+β+one(T))*(2one(T)*k+α+β))

src/Spaces/Jacobi/JacobiOperators.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ end
5252
elseif J.a > 0 && J.b > 0 # we have a simple definition
5353
ConcreteIntegral(J,1)
5454
else # convert and then integrate
55-
a_max = maximum(J.a:1:(1 + (J.a > 1)))
56-
b_max = maximum(J.b:1:(1 + (J.b > 1)))
57-
sp=Jacobi(b_max,a_max,domain(J))
55+
abmin = min(J.a, J.b)
56+
nsteps = length(abmin:0)
57+
a = J.a + nsteps
58+
b = J.b + nsteps
59+
sp=Jacobi(b,a,domain(J))
5860
C=_conversion_shiftordersbyone(J,sp)
5961
Qconc=ConcreteIntegral(sp,1)
6062
IntegralWrapper(TimesOperator(Qconc,C),1,J,rangespace(Qconc))

test/JacobiTest.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,8 @@ include("testutils.jl")
743743
@inferred (() -> Integral(NormalizedLegendre()))()
744744
@inferred (() -> Integral(NormalizedJacobi(1,1)))()
745745
@inferred (() -> Integral(NormalizedJacobi(NormalizedUltraspherical(1))))()
746-
for sp in (Legendre(), Jacobi(1,1), Jacobi(Ultraspherical(1)))
746+
for sp in (Legendre(), Jacobi(1,1), Jacobi(Ultraspherical(1)),
747+
Jacobi(0,2), Jacobi(2,0), Jacobi(-0.5,0))
747748
@testset for _sp in (sp, NormalizedPolynomialSpace(sp))
748749
Ij = Integral(_sp, 1)
749750
@test !isdiag(Ij)

0 commit comments

Comments
 (0)