diff --git a/docs/content/IFsharpNotebook.fsx b/docs/content/IFsharpNotebook.fsx new file mode 100644 index 00000000..351d02ae --- /dev/null +++ b/docs/content/IFsharpNotebook.fsx @@ -0,0 +1,90 @@ +(** +IF# Notebook +============ + +[iPython](http://ipython.org/) provides a rich browser-based interactive notebook with support for code, text, mathematical expressions, +inline plots and other rich media. [IfSharp](https://github.com/BayardRock/IfSharp), developed by Bayard Rock, is an F# profile +for iPython with IntelliSense and embedded FSharp.Charting. Thanks to its NuGet support it can load other packages like Math.NET Numerics on demand. + +![Screenshot](img/IfSharp-GenerateIS.png) + + +Installing IF# Notebook +----------------------- + +Follow the instructions at [IfSharp/Installation](http://bayardrock.github.io/IfSharp/installation.html). + +Essentially: + +1. Install [Anaconda](http://continuum.io/downloads) +2. In a shell, run + + conda update conda + conda update ipython + +3. Install [IfSharp](https://github.com/BayardRock/IfSharp/releases). + +*Note that while IfSharp does have support for custom display printers in the repository, +the v2.0-Beta release does not include this yet. Until a newer release is available you may have to compile +IfSharp yourself from [master](https://github.com/BayardRock/IfSharp) and replace the installed binaries.* + + +Display Printers for Matrices and Vectors +----------------------------------------- + +By itself IfSharp does not know how to display matrices and vectors in a nice way, but we can tell it how to do so by providing our own display printers for them. + +![Screenshot](img/IfSharp-MatrixVector.png) + +Run the following snipped once within a notebook to render matrices and vectors with LaTeX/MathJax, and adapt it to your needs e.g. if you want it to show more rows. +Alternatively you can add it to an Includes.fsx file within the IfSharp installation to make it always available. + + open MathNet.Numerics.LinearAlgebra + + let inline (|Float|_|) (v:obj) = + if v :? float then Some(v :?> float) else None + let inline (|Float32|_|) (v:obj) = + if v :? float32 then Some(v :?> float32) else None + let inline (|PositiveInfinity|_|) (v: ^T) = + if (^T : (static member IsPositiveInfinity: 'T -> bool) (v)) + then Some PositiveInfinity else None + let inline (|NegativeInfinity|_|) (v: ^T) = + if (^T : (static member IsNegativeInfinity: 'T -> bool) (v)) + then Some NegativeInfinity else None + let inline (|NaN|_|) (v: ^T) = + if (^T : (static member IsNaN: 'T -> bool) (v)) + then Some NaN else None + + let inline formatMathValue (floatFormat:string) = function + | PositiveInfinity -> "\\infty" + | NegativeInfinity -> "-\\infty" + | NaN -> "\\times" + | Float v -> v.ToString(floatFormat) + | Float32 v -> v.ToString(floatFormat) + | v -> v.ToString() + + let inline formatMatrix (matrix: Matrix<'T>) = + String.concat Environment.NewLine + [ "\\begin{bmatrix}" + matrix.ToMatrixString(10,4,7,2,"\\cdots","\\vdots","\\ddots", + " & ", "\\\\ " + Environment.NewLine, (fun x -> formatMathValue "G4" x)) + "\\end{bmatrix}" ] + + let inline formatVector (vector: Vector<'T>) = + String.concat Environment.NewLine + [ "\\begin{bmatrix}" + vector.ToVectorString(12, 80, "\\vdots", " & ", "\\\\ " + Environment.NewLine, + (fun x -> formatMathValue "G4" x)) + "\\end{bmatrix}" ] + + App.AddDisplayPrinter (fun (x:Matrix) -> + { ContentType = "text/latex"; Data = formatMatrix x }) + App.AddDisplayPrinter (fun (x:Matrix) -> + { ContentType = "text/latex"; Data = formatMatrix x }) + App.AddDisplayPrinter (fun (x:Vector) -> + { ContentType = "text/latex"; Data = formatVector x }) + App.AddDisplayPrinter (fun (x:Vector) -> + { ContentType = "text/latex"; Data = formatVector x }) + + +*) diff --git a/docs/content/Users.fsx b/docs/content/Users.fsx index 08ebecba..dc57f27e 100644 --- a/docs/content/Users.fsx +++ b/docs/content/Users.fsx @@ -6,6 +6,7 @@ Who is using Math.NET Numerics? Open Source ----------- + * [MyMediaLite Recommender System Library](http://www.ismll.uni-hildesheim.de/mymedialite/) * [FermiSim, studying potential solutions to the Fermi paradox via computational simulation of models for space colonisation](https://launchpad.net/fermisim) * [Three-Dimensional Model Shape Description and Retrieval Based on LightField Descriptors](https://code.google.com/p/lightfieldretrieval/) @@ -24,7 +25,8 @@ Open Source * [Math.NET Symbolics](http://symbolics.mathdotnet.com) and other [Math.NET](http://www.mathdotnet.com) projects. Closed Source ----------- +------------- + * [Instarange Simulation](http://instarange.com) by Instarange (Pty) Ltd * [SpectraFox](http://www.spectrafox.com/) STM / AFM spectroscopy analysis * [Colymp](http://colymp.com/) Color Management Software diff --git a/docs/files/img/IfSharp-GenerateIS.png b/docs/files/img/IfSharp-GenerateIS.png new file mode 100644 index 00000000..a4219dd0 Binary files /dev/null and b/docs/files/img/IfSharp-GenerateIS.png differ diff --git a/docs/files/img/IfSharp-MatrixVector.png b/docs/files/img/IfSharp-MatrixVector.png new file mode 100644 index 00000000..c842748f Binary files /dev/null and b/docs/files/img/IfSharp-MatrixVector.png differ diff --git a/docs/tools/templates/template.cshtml b/docs/tools/templates/template.cshtml index 1dee7b15..0fb731c0 100644 --- a/docs/tools/templates/template.cshtml +++ b/docs/tools/templates/template.cshtml @@ -100,6 +100,7 @@
  • Delimited Text Files (CSV)
  • NIST MatrixMarket
  • MATLAB
  • +
  • IF# Notebook
  • FsLab & Deedle
  • Microsoft Excel
  • numl.net machine learning