LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Concerning free software, programming, and whatever else I find interesting. Also the blog for my Web site, frigidcode.com.
Old

Quick and dirty plotting with Haskell: Supplement

Posted 01-14-2013 at 11:54 PM by hydraMax (Bits and Pixels)

I just wanted to add a brief note to my previous post: It is also quite simple to do a plot with multiple functions. The following code gives the graph seen in the attached PNG:

Code:
h> import Graphics.Gnuplot.Simple
h> let f x = 3 - 2*x + 4*x**2
h> let g x = 8*x - 2
h> let h a x = g a * (x - a) + f a
h> plotFuncs [] (linearScale 1000 (-10,10)) [f, g, h (-5)]
f(x) is a function, g(x) is the derivative of f(x), and...
Attached Images
File Type: png plotFuncs.png (49.5 KB, 4 views)
Member
Posted in Uncategorized
Views 868 Comments 0 hydraMax is offline
Old

Installed Nix

Posted 01-09-2013 at 01:49 PM by hydraMax (Bits and Pixels)
Tags nix

I recently installed the Nix package manager on my system:

https://nixos.org/nix/

Nix is an intriguing idea: a purely functional and deterministic package management system. Nix allows you to install, upgrade, and remove packages on your system without ever having to worry about breaking the dependencies of other packages already installed on your system. This is impossible, by design. Likewise, after installing new packages, you are free to roll back those changes...
Member
Posted in Uncategorized
Views 838 Comments 0 hydraMax is offline
Old

haskell: get lines and handle end of file

Posted 01-01-2013 at 02:23 AM by hydraMax (Bits and Pixels)
Updated 01-01-2013 at 02:27 AM by hydraMax
Tags haskell

I thought I'd post this convenience function, since I didn't see an obvious one in base:

Code:
import Prelude hiding (catch)
import Control.Exception
import System.IO.Error hiding (catch)

readl f = catch (getLine >>= return . Just)
                (\e -> if (isEOFErrorType . ioeGetErrorType) e
                         then return Nothing
                         else ioError e)
          >>= \a -> case a of
...
Member
Posted in Uncategorized
Views 1466 Comments 0 hydraMax is offline
Old

Quick and dirty plotting with Haskell + Gnuplot

Posted 12-28-2012 at 05:13 PM by hydraMax (Bits and Pixels)
Updated 12-28-2012 at 05:17 PM by hydraMax
Tags haskell

Assuming you are a Haskeller, you can get a simply x-y plot up very quickly with the gnuplot interface module. This is useful for getting a rough graphical view of some function. Simply...

1. install Gnuplot (through your package manager)
2. cabal install gnuplot
3. use ghci:

Code:
$ ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ...
...
Attached Images
File Type: png image3023.png (29.8 KB, 3 views)
Member
Posted in Uncategorized
Views 7328 Comments 0 hydraMax is offline
Old

Dorito Thief Strikes Again!

Posted 12-27-2012 at 11:25 PM by hydraMax (Bits and Pixels)
Tags humor

http://youtu.be/Kqy9hxhUxK0
Member
Posted in Uncategorized
Views 1122 Comments 0 hydraMax is offline

  



All times are GMT -5. The time now is 01:12 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration