summaryrefslogtreecommitdiff
path: root/packages/hmatrix/examples/plot.hs
diff options
context:
space:
mode:
Diffstat (limited to 'packages/hmatrix/examples/plot.hs')
-rw-r--r--packages/hmatrix/examples/plot.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/hmatrix/examples/plot.hs b/packages/hmatrix/examples/plot.hs
new file mode 100644
index 0000000..f950aa5
--- /dev/null
+++ b/packages/hmatrix/examples/plot.hs
@@ -0,0 +1,20 @@
1import Numeric.LinearAlgebra
2import Graphics.Plot
3import Numeric.GSL.Special(erf_Z, erf)
4
5sombrero n = f x y where
6 (x,y) = meshdom range range
7 range = linspace n (-2,2)
8 f x y = exp (-r2) * cos (2*r2) where
9 r2 = x*x+y*y
10
11f x = sin x + 0.5 * sin (5*x)
12
13gaussianPDF = erf_Z
14cumdist x = 0.5 * (1+ erf (x/sqrt 2))
15
16main = do
17 let x = linspace 1000 (-4,4)
18 mplot [f x]
19 mplot [x, mapVector cumdist x, mapVector gaussianPDF x]
20 mesh (sombrero 40) \ No newline at end of file