You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
t = GAMMA_ONE_SIXTH(Float64) * GAMMA_FIVE_SIXTHS(Float64) / 4
510
-
a = 4*xsqr*x
511
-
for i in 0:iter
512
-
out += t
513
-
t *= -3*(i + one(T)/6) * (i + T(5)/6) / (a*(i + one(T)))
514
-
end
515
-
return out * exp(-a / 6) / (sqrt(T(π)^3) * sqrt(xsqr))
516
-
end
517
-
function airy_large_arg_b(x::T, iter = 40) where T
518
-
S = eltype(x)
519
-
MaxIter = 3000
520
-
xsqr = sqrt(x)
521
-
522
-
out = zero(S)
523
-
t = GAMMA_ONE_SIXTH(Float64) * GAMMA_FIVE_SIXTHS(Float64) / 4
524
-
a = 4*xsqr*x
525
-
for i in 0:iter
526
-
out += t
527
-
t *= 3*(i + one(T)/6) * (i + T(5)/6) / (a*(i + one(T)))
528
-
end
529
-
return out * exp(a / 6) / (sqrt(T(π)^3) * sqrt(xsqr))
530
-
end
531
-
532
-
533
-
@inline levin_scale(B, n, k) = -(B + n) * (B + n + k)^(k - 1.0) / (B + n + k + 1.0)^k
534
-
535
-
@generated function levin_transform(s::NTuple{N, T}) where {N, T}
536
-
len = N-1
537
-
len2 = N-2
538
-
:(
539
-
begin
540
-
@nexprs $len i -> b_{i} = 1 / (s[i + 1] - s[i])
541
-
@nexprs $len i -> a_{i} = s[i] * b_{i}
542
-
@nexprs $len2 k -> (@nexprs ($len-k) i -> (a_{i}, b_{i}) = (muladd(a_{i}, levin_scale(1.0, i, k-1), a_{i+1}), muladd(b_{i}, levin_scale(1.0, i, k-1), b_{i+1})))
543
-
return a_1 / b_1
544
-
end
545
-
)
546
-
end
547
-
548
-
function airy_levin(x)
549
-
N = 50
550
-
sequence = tuple([airy_large_arg_a(BigFloat(real(x)) + im*BigFloat(imag(x)), iter) for iter in 1:N]...);
551
-
levin_transform(sequence[1:N-10])
552
-
end
553
-
554
-
555
-
function airy_levin2(x)
556
-
N = 40
557
-
sequence = tuple([airy_large_arg_a(BigFloat(real(x)) + im*BigFloat(imag(x)), iter) + im*airy_large_arg_b(BigFloat(real(x)) + im*BigFloat(imag(x)), iter) for iter in 1:N]...);
0 commit comments