Skip to content

Commit 29c08f2

Browse files
Fix #57
1 parent a80acce commit 29c08f2

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/specialfunctions.jl

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,14 @@ Compute Jacobi expansion coefficients in ``P_n^{(\\alpha+1,\\alpha+1)}(x)`` give
539539
function incrementαβ!(c::AbstractVector,α,β)
540540
@assert α == β
541541
N = length(c)
542-
N > 2 && (c[1] -=+2)/(4α+10)*c[3])
543-
@inbounds for i=2:N-2 c[i] = (2α+i)*(2α+i+1)/(2α+2i-1)/(2α+2i)*c[i] -+i+1)/(4α+4i+6)*c[i+2] end
544-
N > 1 && (c[N-1] *= (2α+N-1)*(2α+N)/(2α+2N-3)/(2α+2N-2))
545-
N > 0 && (c[N] *= (2α+N)*(2α+N+1)/(2α+2N-1)/(2α+2N))
542+
if N == 2
543+
c[2] *= (2α+2)/(2α+4)
544+
elseif N > 2
545+
c[1] -=+2)/(4α+10)*c[3]
546+
@inbounds for i=2:N-2 c[i] = (2α+i)*(2α+i+1)/(2α+2i-1)/(2α+2i)*c[i] -+i+1)/(4α+4i+6)*c[i+2] end
547+
c[N-1] *= (2α+N-1)*(2α+N)/(2α+2N-3)/(2α+2N-2)
548+
c[N] *= (2α+N)*(2α+N+1)/(2α+2N-1)/(2α+2N)
549+
end
546550
c
547551
end
548552

@@ -574,10 +578,14 @@ Compute Jacobi expansion coefficients in ``P_n^{(\\alpha-1,\\alpha-1)}(x)`` give
574578
function decrementαβ!(c::AbstractVector,α,β)
575579
@assert α == β
576580
N = length(c)
577-
N > 0 && (c[N] *= (2α+2N-3)*(2α+2N-2)/(2α+N-2)/(2α+N-1))
578-
N > 1 && (c[N-1] *= (2α+2N-5)*(2α+2N-4)/(2α+N-3)/(2α+N-2))
579-
@inbounds for i=N-2:-1:2 c[i] = (2α+2i-3)*(2α+2i-2)/(2α+i-2)/(2α+i-1)*(c[i] ++i)/(4α+4i+2)*c[i+2]) end
580-
N > 2 && (c[1] +=+1)/(4α+6)*c[3])
581+
if N == 2
582+
c[2] *= (2α+2)/(2α)
583+
elseif N > 2
584+
c[N] *= (2α+2N-3)*(2α+2N-2)/(2α+N-2)/(2α+N-1)
585+
c[N-1] *= (2α+2N-5)*(2α+2N-4)/(2α+N-3)/(2α+N-2)
586+
@inbounds for i=N-2:-1:2 c[i] = (2α+2i-3)*(2α+2i-2)/(2α+i-2)/(2α+i-1)*(c[i] ++i)/(4α+4i+2)*c[i+2]) end
587+
c[1] +=+1)/(4α+6)*c[3]
588+
end
581589
c
582590
end
583591

0 commit comments

Comments
 (0)