@@ -404,8 +404,8 @@ function _₂F₁maclaurin(a::Number, b::Number, c::Number, z::Number)
404
404
T = float (promote_type (typeof (a), typeof (b), typeof (c), typeof (z)))
405
405
S₀, S₁, j = one (T), one (T)+ a* b* z/ c, 1
406
406
while errcheck (S₀, S₁, 10 eps (real (T)))
407
- rⱼ = (a+ j)/ (j+ 1 )* (b+ j)/ (c+ j)
408
- S₀, S₁ = S₁, S₁+ (S₁- S₀)* rⱼ* z
407
+ rⱼ = (a+ j)* z / (j+ 1 )* (b+ j)/ (c+ j)
408
+ S₀, S₁ = S₁, S₁+ (S₁- S₀)* rⱼ
409
409
j += 1
410
410
end
411
411
return S₁
@@ -500,27 +500,27 @@ function _₁F₁maclaurin(a::Number, b::Number, z::Number)
500
500
T = float (promote_type (typeof (a), typeof (b), typeof (z)))
501
501
S₀, S₁, j = one (T), one (T)+ a* z/ b, 1
502
502
while errcheck (S₀, S₁, 10 eps (real (T)))
503
- rⱼ = (a+ j)/ ((b+ j)* (j+ 1 ))
504
- S₀, S₁ = S₁, S₁+ (S₁- S₀)* rⱼ* z
503
+ rⱼ = (a+ j)* z / ((b+ j)* (j+ 1 ))
504
+ S₀, S₁ = S₁, S₁+ (S₁- S₀)* rⱼ
505
505
j += 1
506
506
end
507
507
return S₁
508
508
end
509
509
510
510
function pFqmaclaurin (α:: NTuple{p, Any} , β:: NTuple{q, Any} , z; kwds... ) where {p, q}
511
- T1 = mapreduce (typeof, promote_type, α)
512
- T2 = mapreduce (typeof, promote_type, β)
511
+ T1 = isempty (α) ? Any : mapreduce (typeof, promote_type, α)
512
+ T2 = isempty (β) ? Any : mapreduce (typeof, promote_type, β)
513
513
pFqmaclaurin (T1 .(α), T2 .(β), z; kwds... )
514
514
end
515
515
516
516
function pFqmaclaurin (a:: NTuple{p, S} , b:: NTuple{q, U} , z:: V ) where {p, q, S, U, V}
517
517
T = float (promote_type (eltype (a), eltype (b), V))
518
518
S₀, S₁, j = one (T), one (T)+ prod (a)* z/ prod (b), 1
519
519
while errcheck (S₀, S₁, 10 eps (real (T)))
520
- rⱼ = inv (j+ one (T))
520
+ rⱼ = z / (j+ one (T))
521
521
for i= 1 : p rⱼ *= a[i]+ j end
522
522
for i= 1 : q rⱼ /= b[i]+ j end
523
- S₀, S₁ = S₁, S₁+ (S₁- S₀)* rⱼ* z
523
+ S₀, S₁ = S₁, S₁+ (S₁- S₀)* rⱼ
524
524
j += 1
525
525
end
526
526
return S₁
0 commit comments