gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/examples/zernike.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/zernike.lua')
-rw-r--r--examples/zernike.lua 43
1 files changed, 0 insertions, 43 deletions
diff --git a/examples/zernike.lua b/examples/zernike.lua
deleted file mode 100644
index 0fb3e71a..00000000
--- a/examples/zernike.lua
+++ /dev/null
@@ -1,43 +0,0 @@
-
-local invf = |n| n >= 0 and 1/fact(n) or 0
-
-function zerR(n, m, p)
- local ip, im = (n+m)/2, (n-m)/2
- local z = 0
- for k=0, im do
- local f = fact(n-k) * (invf(k) * invf(ip-k) * invf(im-k))
- if f > 0 then z = z + (-1)^k * f * p^(n-2*k) end
- end
- return z
-end
-
--- function bfact(n, k)
--- return (k < 0 or k > n) and 0 or choose(n,k)
--- end
-
--- function zerR(n, m, p)
--- local im = (n-m)/2
--- local z = 0
--- for k=0, im do
--- z = z + (-1)^k * bfact(n-k, k) * bfact(n-2*k, im-k) * p^(n-2*k)
--- end
--- return z
--- end
-
-function zernicke(n, m, p, phi, even)
- local pf = even and cos(m*phi) or sin(-m*phi)
- return zerR(n, m, p) * pf
-end
-
-local Nlev = 15
-local levels = ilist(|k| (k - Nlev)/Nlev, 0, 2*Nlev)
-local N, M = 8, 2
-local Rcut = 0.9
-
-require 'contour'
-local p = polar_contour(|x,y| zernicke(N, M, sqrt(x^2+y^2), atan2(y,x)), Rcut, {gridx= 81, gridy= 81, levels= 10})
-p:addline(circle(0, 0, Rcut), 'gray')
-p.title = string.format('Zernike polynomial (N=%i, M=%i)', N, M)
-
-
--- contour(|x,y| zernicke(N, M, sqrt(x^2+y^2), atan2(y,x)), -1, -1, 1, 1, {gridx= 61, gridy= 61, levels= levels})
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月21日 08:06:51 +0000

AltStyle によって変換されたページ (->オリジナル) /