LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Blogs > Bits and Pixels
User Name
Password

Notices

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

Quick and dirty plotting with Haskell: Supplement

Posted 01-14-2013 at 11:54 PM by hydraMax

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 h(x) is the tangent line for f(x) at -5.
Attached Images
File Type: png plotFuncs.png (49.5 KB, 4 views)
Posted in Uncategorized
Views 507 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 10:06 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration