Skip to content

Instantly share code, notes, and snippets.

@cartazio
Created September 23, 2012 19:56
Show Gist options
  • Save cartazio/3772844 to your computer and use it in GitHub Desktop.
Save cartazio/3772844 to your computer and use it in GitHub Desktop.
golf
-- assumes hmatrix installed
module Main where
import Numeric.LinearAlgebra
import Graphics.Plot
x:: Vector Double
x = linspace 2000 (-10.0,10.0)
randomSeed= 7331 --because its funny, also because i don't want to break in some io for a simple example
rnorm :: Int -> Double -> Double -> Vector Double
rnorm size mean sd = flatten $ (gaussianSample randomSeed size $ constant mean 1 ) $ fromLists [[sd]]
y = scale 2 x + rnorm 2000 0.0 2.0
main = do
mplot [x,y]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment