iMPaCT try f#‎ > ‎

plottingDerivatives-1

for try-f# http://tinyurl.com/impact-fsharp (opens in another window or tab)

open Impact
let redLine(a, b ,m, xlen) = 
    let mutable x = a-xlen
    let mutable xend = a+xlen
    let mutable y = b-xlen*m
    while (x < xend) do
        dot(x,y) red
        x <- x + 0.5
        y <- y + m*0.5
    dot(a,b) black
let redline = redLine

clear()

//let f(x) = sin(x/30.0) * 100.0
//let f(x) = 100.0/((2.0**(-(x-40.0)/4.0)) + 1.0) - 45.0
// let f(x) = (-25.0) + (0.2 *x) + 100.*(2.**(-(((x-100.)/50.)**2.)) - (2.*(2.**(-(((x-100.)/25.)**2.)))))
//let f(x) = x*x/100.0
let f(x) = 2.0*x-80.0

Comments