![]() |
![]() |
| Products | F# for Visualization |
2D function plots
F# for Visualization can be loaded with only one lines of code: > #r "FSharpForVisualization.dll";; The definitions required for 2D function plotting are in the following modules: > open FlyingFrog.Graphics;; > open FlyingFrog.Graphics.Typeset;; A simple 2D function plot may be spawned from the F# interactive session using the > Plot([Function id], (-1e30, 1e30), (-1e30, 1e30));; To give:
Note how the large numbers on the ticks are automatically typeset in conventional scientific notation. The vertical range and labels are optional arguments to the > let labels = Row[math "x"], Row[Super(math "x", math 3); math "-x-1"];; val labels : math * math > Plot([Function(fun x -> pown x 3 - x - 1.0)], (-3., 3.), (-3., 4.), Labels=labels);;
Note the typeset label. Typeset mathematics can include a wide variety of constructs including square roots and even integrals with limits. For a more advanced example, consider the 1D Mexican hat wavelet written in terms of the second Hermite polynomial > let wavelet t =
let pi = System.Math.PI
let c = 1.0 / sqrt(2.0 ** -3.5 * sqrt pi * 3.0)
let h2 x = 4.0 * x * x - 2.0
0.25 * c * h2(t / 2.0) * exp(-t*t / 4.0);;
val wavelet : float -> float
> let labels = Row[math "t"], Row[Sub(Greek.Psi, math 2); math "(t)"];;
val labels : math * math
> Plot([Function wavelet], (-8., 8.), (-0.9, 0.5), Labels=labels);;
This functionality of F# for Visualization can be used to plot any function of one variable.
(Note: We are not VAT registered and, therefore, cannot provide VAT receipts)
|
| � Flying Frog Consultancy Ltd., 2007 | Contact the webmaster |