@@ -37,7 +37,13 @@ rdiffbc(d::MaybeNormalized{<:Union{Chebyshev, Ultraspherical, Jacobi}},k) = Eval
3737
3838# # Integral
3939
40- function Integral (J:: Jacobi ,k:: Number )
40+ @static if VERSION >= v " 1.8"
41+ Base. @constprop :aggressive Integral (J:: Jacobi , k:: Number ) = _Integral (J, k)
42+ else
43+ Integral (J:: Jacobi , k:: Number ) = _Integral (J, k)
44+ end
45+
46+ @inline function _Integral (J:: Jacobi ,k:: Number )
4147 assert_integer (k)
4248 @assert k > 0 " order of integral must be > 0"
4349 if k > 1
@@ -46,10 +52,12 @@ function Integral(J::Jacobi,k::Number)
4652 elseif J. a > 0 && J. b > 0 # we have a simple definition
4753 ConcreteIntegral (J,1 )
4854 else # convert and then integrate
49- sp= Jacobi (J. b+ 1 ,J. a+ 1 ,domain (J))
50- C= Conversion (J,sp)
51- Q= Integral (sp,1 )
52- IntegralWrapper (TimesOperator (Q,C),1 ,J)
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))
58+ C= _conversion_shiftordersbyone (J,sp)
59+ Qconc= ConcreteIntegral (sp,1 )
60+ IntegralWrapper (TimesOperator (Qconc,C),1 ,J,rangespace (Qconc))
5361 end
5462end
5563
@@ -124,7 +132,19 @@ for (Func,Len,Sum) in ((:DefiniteIntegral,:complexlength,:sum),(:DefiniteLineInt
124132 end
125133end
126134
127-
135+ function _conversion_shiftordersbyone (L:: Jacobi , M:: Jacobi )
136+ dl= domain (L)
137+ dm= domain (M)
138+ # We split this into steps where a and b are changed by 1:
139+ # Define the intermediate space J = Jacobi(M.b, L.a, dm)
140+ # Conversion(L, M) == Conversion(J, M) * Conversion(L, J)
141+ # Conversion(L, J) = Conversion(Jacobi(L.b, L.a, dm), Jacobi(M.b, L.a, dm))
142+ # Conversion(J, M) = Conversion(Jacobi(M.b, L.a, dm), Jacobi(M.b, M.a, dm))
143+ CLJ = [ConcreteConversion (Jacobi (b- 1 ,L. a,dm), Jacobi (b, L. a, dm)) for b in M. b: - 1 : L. b+ 1 ]
144+ CJM = [ConcreteConversion (Jacobi (M. b,a- 1 ,dm), Jacobi (M. b, a, dm)) for a in M. a: - 1 : L. a+ 1 ]
145+ C = [CJM; CLJ]
146+ return ConversionWrapper (TimesOperator (C))
147+ end
128148
129149# # Conversion
130150# We can only increment by a or b by one, so the following
@@ -153,15 +173,7 @@ function Conversion(L::Jacobi,M::Jacobi)
153173 elseif L. a ≈ L. b && M. a ≈ M. b
154174 return Conversion (L,Ultraspherical (L),Ultraspherical (M),M)
155175 else
156- # We split this into steps where a and b are changed by 1:
157- # Define the intermediate space J = Jacobi(M.b, L.a, dm)
158- # Conversion(L, M) == Conversion(J, M) * Conversion(L, J)
159- # Conversion(L, J) = Conversion(Jacobi(L.b, L.a, dm), Jacobi(M.b, L.a, dm))
160- # Conversion(J, M) = Conversion(Jacobi(M.b, L.a, dm), Jacobi(M.b, M.a, dm))
161- CLJ = [ConcreteConversion (Jacobi (b- 1 ,L. a,dm), Jacobi (b, L. a, dm)) for b in decreasingunitsteprange (M. b, L. b+ 1 )]
162- CJM = [ConcreteConversion (Jacobi (M. b,a- 1 ,dm), Jacobi (M. b, a, dm)) for a in decreasingunitsteprange (M. a, L. a+ 1 )]
163- C = [CJM; CLJ]
164- return ConversionWrapper (TimesOperator (C))
176+ return _conversion_shiftordersbyone (L, M)
165177 end
166178 elseif isapproxinteger_addhalf (L. a - M. a) && isapproxinteger_addhalf (L. b - M. b)
167179 if L. a ≈ L. b && M. a ≈ M. b && isapproxminhalf (M. a)
0 commit comments