Concerning free software, programming, and whatever else I find interesting. Also the blog for my Web site, frigidcode.com.
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:
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.
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)]
Total Comments 0