randist example plot added - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2010年08月08日 01:00:37 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2010年08月08日 01:00:37 +0200
commit7d88772e03a982b3e55982f39d7e8ddaf454654b (patch)
tree091b9d22e08e17f51dcf408c8baad00cd46748e3
parentedd594b48a302145178679af1719d1a85454dee4 (diff)
downloadgsl-shell-7d88772e03a982b3e55982f39d7e8ddaf454654b.tar.gz
randist example plot added
Diffstat
-rw-r--r--examples/randist.lua 19
1 files changed, 12 insertions, 7 deletions
diff --git a/examples/randist.lua b/examples/randist.lua
index 8ef626d4..b89b998c 100644
--- a/examples/randist.lua
+++ b/examples/randist.lua
@@ -1,12 +1,17 @@
-pdf_test =
+demo1 =
function()
- local a, sig, n = 0.5, 2.44, 40
+ local a, sig, n = 2, 2.44, 40
local idx = |k| a + (k-1)*5*sig/n -- sampling function
local pdf = |x| pdf.gaussian_tail(x, a, sig)
- local fs = {pdf,
- |x| cdf.gaussian_tail(x, a, sig),
- |x| integ {f= pdf, points= {a, x}}
- }
- return new(32, 3, |k,j| fs[j](idx(k)))
+ local cdf = |x| cdf.gaussian_tail(x, a, sig)
+ local cdftest = |x| integ {f= pdf, points= {a, x}}
+ local p = plot 'Gaussian tail pdf / cdf'
+ p:addline(fxline(pdf, a, 5*sig))
+ p:addline(fxline(cdf, a, 5*sig), 'blue')
+ p:addline(fxline(cdftest, a, 5*sig), 'green', {{'dash', 5, 5}})
+ p:show()
+ return p
end
+
+print 'demo1() - gaussian tail distribution pdf and cdf plot'
generated by cgit v1.2.3 (git 2.46.0) at 2025年09月30日 23:23:39 +0000

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