gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat
-rw-r--r--Makefile 2
-rw-r--r--demo-init.lua 2
-rw-r--r--demos/sf.lua (renamed from examples/hermite.lua)33
3 files changed, 22 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 2e85fc89..ef36bb79 100644
--- a/Makefile
+++ b/Makefile
@@ -53,7 +53,7 @@ endif
LUA_BASE_FILES = bspline.lua fft-init.lua integ-init.lua template.lua check.lua graph-init.lua rng.lua rnd.lua iter.lua time.lua gsl-check.lua linfit.lua roots.lua contour.lua gsl.lua matrix.lua strict.lua csv.lua gslext.lua num.lua demo-init.lua import.lua plot3d.lua sf.lua
-DEMOS_LIST = bspline fft plot wave-particle fractals ode nlinfit integ anim linfit contour svg graphics
+DEMOS_LIST = bspline fft plot wave-particle fractals ode nlinfit integ anim linfit contour svg graphics sf
LUA_TEMPLATES = gauss-kronrod-x-wgs qag rk8pd lmfit qng rkf45 ode-defs rk4 sf-defs
LUA_BASE_FILES += $(DEMOS_LIST:%=demos/%.lua)
diff --git a/demo-init.lua b/demo-init.lua
index 9e2002f3..4c897a16 100644
--- a/demo-init.lua
+++ b/demo-init.lua
@@ -16,7 +16,7 @@ local function load_demo(name)
end
local demo_files = {
- 'fft', 'bspline', 'wave-particle', 'plot', 'fractals', 'ode', 'nlinfit', 'integ', 'anim', 'linfit', 'contour', 'svg', 'graphics'}
+ 'fft', 'bspline', 'wave-particle', 'plot', 'fractals', 'ode', 'nlinfit', 'integ', 'anim', 'linfit', 'contour', 'svg', 'graphics', 'sf'}
for i, name in ipairs(demo_files) do
load_demo(name)
diff --git a/examples/hermite.lua b/demos/sf.lua
index 9c8f77f9..1cbfb296 100644
--- a/examples/hermite.lua
+++ b/demos/sf.lua
@@ -1,13 +1,12 @@
+use 'math'
+use 'graph'
+use 'sf'
-local function hermiteLp(n,x)
+local function hermiteLp(n,x)
return 1/sqrt(fact(n) *2^n*sqrt(pi)) * exp(-x*x/2) * (-4)^(n/2) * fact(n/2) * laguerre(n/2, -1/2, x^2)
end
-local function hermiteU(n,x)
- return 1/sqrt(fact(n) *2^n*sqrt(pi)) * exp(-x*x/2) * 2^n * hypergU((1-n)/2, 3/2, x^2)
-end
-
-local function hermiteFp(n,x)
+local function hermiteFp(n,x)
return 1/sqrt(fact(n) *2^n*sqrt(pi)) * exp(-x*x/2) * (-1)^(n/2) * fact(n)/fact(n/2) * hyperg1F1(-n/2, 1/2, x^2)
end
@@ -27,10 +26,18 @@ local function demo_gen(hermiteFF)
w:attach(p, '3')
end
-demo1 = || demo_gen(hermiteLp)
-demo2 = || demo_gen(hermiteFp)
-demo3 = || demo_gen(hermiteU)
-
-echo 'demo1() - hermite function using Laguerre polynomials'
-echo 'demo2() - hermite function using Hypergeometric 1F1 function'
-echo 'demo3() - hermite function using Hypergeometric U function (broken)'
+demo1 = function() demo_gen(hermiteLp) end
+demo2 = function() demo_gen(hermiteFp) end
+
+return {'Special Functions', {
+ {
+ name = 'sf1',
+ f = demo1,
+ description = 'Hermite function using Laguerre polynomials'
+ },
+ {
+ name = 'sf2',
+ f = demo2,
+ description = 'Hermite function using Hypergeometric 1F1 function'
+ },
+}}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月15日 18:06:57 +0000

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