From 4c4eb1bd8f003b3b57707badd2dd089ed193a896 Mon Sep 17 00:00:00 2001 From: wukong Date: Fri, 10 Apr 2026 23:46:12 -0700 Subject: renamed fir window generators; minor edits to whitespace and comments for more consistent style; --- sterling_approx.awk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sterling_approx.awk') diff --git a/sterling_approx.awk b/sterling_approx.awk index cb5f563..4b0741e 100644 --- a/sterling_approx.awk +++ b/sterling_approx.awk @@ -1,21 +1,20 @@ #!/usr/bin/awk -f - +### sterling_approx.awk # https://en.wikipedia.org/wiki/Sterling_Approximation # An alternative approximation for the Gamma function stated by Srinivasa # Ramanujan (Ramanujan 1988) is -# Gamma(1+x) ~= sqrt(pi)((x/e)^x)(8x^3 + 4x^2 + x + 1/30)^(1/6) -# for x >= 0. The equivalent approximation for ln(n!) has an asymptotic error -# of 1/(1400*n^3) ... +# Gamma(1+x) ~= sqrt(pi)((x/e)^x)(8x^3 + 4x^2 + x + 1/30)^(1/6) +# for x >= 0. The equivalent approximation for ln(n!) has an asymptotic +# error of 1/(1400*n^3) ... -### sterling_approx.awk -# https://en.wikipedia.org/wiki/Stirling%27s_approximation function pwr(x, p) { return p ? exp(p*log(x)) : 1 } + BEGIN { ARGV[1] ? n = ARGV[1] : n = 0 ARGV[2] ? OFMT = "%." ARGV[2] "g" : OFMT = "%g" @@ -26,3 +25,4 @@ BEGIN { } printf(OFMT ORS, f) } + -- cgit v1.2.3