F# for Visualization version 0.4.0.0 has just been released. This version includes a variety of enhancements.
Perhaps the most important enhancement is the introduction of dynamically typed functions scene and Typeset.math which try to build vector scenes and typeset mathematical layouts, respectively, from values of any type. The View function can be used to visualize any value of any type. For example, the following defines and then visualizes a matrix of rational numbers:
> let A = Matrix.Generic.of_seq [ for i in 0N..4N -> [ for j in 0N..4N -> 1N / (i + j + 1N) ] ];; val A : Matrix<BigNum> = matrix [[1N; 1/2N; 1/3N; 1/4N; 1/5N] [1/2N; 1/3N; 1/4N; 1/5N; 1/6N] [1/3N; 1/4N; 1/5N; 1/6N; 1/7N] [1/4N; 1/5N; 1/6N; 1/7N; 1/8N] [1/5N; 1/6N; 1/7N; 1/8N; 1/9N]] > View A;;
This makes it a lot easier to see what is going on during matrix computations!
Plots may now be augmented with an "epilog". For example, the following creates a graph of the sinc function:
let g = Plot([Function sinc], (-12., 12.), (-0.3, 1.1))
Accurately typeset axis labels may be added to create a professional-quality plot:
g.Labels <- (Char 'x', Row[Text "sinc"; math "(x)"])
Finally, the first positive root of this function may be highlighted by adding a single data point and a label describing the exact coordinate:
let pi = System.Math.PI g.Data <- [Function sinc; Data[pi, 0.]] g.Epilog <- Label(scene(Row[math "("; Greek.pi; math ", 0)"]), 0.003, Point(System.Math.PI, 0.), Vector(1.2, 1.2))
Axis and grid styles and the font sizes of ticks are now configurable.
Finally, the DLL is 30% smaller than before!