Questions tagged [mathnet-numerics]

Math.NET Numerics is an opensource numerical library for .Net, Silverlight and Mono.

Math.NET Numerics is the numerical foundation of the Math.NET project, aiming to provide methods and algorithms for numerical computations in science, engineering and every day use. Covered topics include special functions, linear algebra, probability models, random numbers, statistics, interpolation, integration, curve fitting, integral transforms (FFT) and more.

In addition to the core .NET package (which is written entirely in C#), Numerics specifically supports F# 3.0 with idiomatic extension modules and maintains mathematical data structures like BigRational that originated in the F# PowerPack. If a performance boost is needed, the managed-code provider backing its linear algebra routines and decompositions can be exchanged with wrappers for optimized native implementations such as Intel MKL.

Supports Mono and .NET 4.0 on Linux, Mac and Windows, the portable version also Silverlight 5, WindowsPhone 8 and .NET for Windows Store apps.

Source: GitHub: Math.NET Numerics ReadMe file

230 questions
4
votes
1 answer

Random Number Generator using Geometric Distribution

I need a random number generator using a geometric distribution http://en.wikipedia.org/wiki/Geometric_Distribution. I tried MathNet.Numerics.Distributions: public void GeometricTest() { var geometric = new Geometric(0.1); int back =…
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
4
votes
2 answers

Confidence Intervals Using MathNET

I have a IEnumerable data sample. I want to compute the 90% confidence interval for the signal/data. I have MathNET library at my disposal, but I am confused as to how to correctly work with the library. Given my data, the idea is to return…
MoonKnight
  • 23,214
  • 40
  • 145
  • 277
4
votes
1 answer

get minimum & maximum value of dense matrix elements

Using MathNet.numerics for C# , I have created dense matrix of doubles. I wish to find the minimum & maximum element-value of a matrix. Is there an accessor to get the maximum/minimum value of the dense matrix elements? Actually I do this var…
LeMoussel
  • 5,290
  • 12
  • 69
  • 122
3
votes
2 answers

Can I use Math.NET runtimes with a .NET 2.0 or .NET 3.5 application?

I just downloaded the latest version of Math.NET and I'm running into some trouble when I use it. Could it be that the library was meant to run on a .NET 4.0 project? Update: The compiled dlls are within a "Net40" folder, does that mean I cannot…
Jonas
  • 1,365
  • 3
  • 21
  • 39
3
votes
1 answer

Math.NET Numerics Poor Performance and Low CPU Usage

I want to be able to solve large sparse systems of linear equations in C# (dim = 1,000,000). For this I'm using Math.NET Numerics with the MKL provider. I created the following test program to check the performance of Math.NET Numerics, however,…
Carlos
  • 586
  • 1
  • 9
  • 19
3
votes
0 answers

Performance of F# libraries

Has anyone investigated a performance comparison between Math.NET Numerics vs Extreme Optimization numerical libraries using F#? Specifically I would be interested in an actual comparison (computational time) for: matrix multiplication MCMC…
3
votes
2 answers

Fitting an Akima Spline curve

I'm trying to fit an Akima Spline curve in C# using the same method as this tool: https://www.mycurvefit.com/share/4ab90a5f-af5e-435e-9ce4-652c95c3d9a7 This curve gives me the exact shape I'm after (the curve line peaking at X = 30M, the highest…
FBryant87
  • 4,273
  • 2
  • 44
  • 72
3
votes
1 answer

Memory exception from Math.NET when generating 100 x 100 data points

When I try to generate 100 x 100 data point using F# and Math.NET using the following code: let theta0_vals = Generate.LinearSpaced(100, -10.0, 10.0) let theta1_vals = Generate.LinearSpaced(100, -1.0, 4.0) let fct a b = 2.0 * a * b let points =…
carstenj
  • 693
  • 5
  • 13
3
votes
1 answer

Problems adding extension to DenseVector type

I am trying to add a method to the DenseVector class to be able to difference the vector n times. The following doesn't seem to work as type inference complains that the type Vector is not compatible with the type DenseVector: open System open…
3
votes
1 answer

Parse Tanh in Math.NET Symbolics

Does the MathNet.Symbolics.Infix parser have a way of identifying more complicated trig functions such as tanh? I have tried the following in F# but it is not recognised (I get an undefined expression). When I replace 'tanh' with 'cos' it works just…
3
votes
3 answers

How to refactor code to make it functional style?

Playing with F#, I'm trying to think of code in a more functional way. A large part of my work happens to be numerical in nature so I'm thinking whether this re-education makes sense. Is writing numerical code in a functional way like trying to fit…
3
votes
1 answer

How can I find maximum matrix element in MathNet?

What is the best (readable and fast) way to find maximum matrix element using MathNet in C#? This is my way: int size = 4; var matrix = Matrix.Build.Dense(size, size, Matrix.One); matrix[3, 3] = 3; var max = matrix.ReduceRows((v1, v2) =>…
3
votes
1 answer

Infix.ParseOrUndefined sequence order

I am using MathNet and trying to parse 2x^2 + x to epression using Infix.Print(Infix.ParseOrUndefined("2x^2 + x")); but it returns x + 2x^2. I want to keep the order of the source because I am going to convert it in LaTex using LaTeX.Print. How can…
3
votes
2 answers

Matlab equivalent functions using mathdotnet

How can we implement below matlab function in C# using math.net library. Multivariate normal random distribution- http://in.mathworks.com/help/stats/mvnrnd.html r = mvnrnd(MU,SIGMA,cases) Also below math.net function not returning any results. I've…
malkam
  • 2,337
  • 1
  • 14
  • 17
3
votes
1 answer

How to simplify formula with MathNet.Symbolics?

I'm using the MathNet.Symbolics library to simplify an algebraic formulas like string f = Infix.Print(Infix.ParseOrThrow("L+H+L+H")) And I correctly get f="2*L+2*H" My problem arise when I need to subtract two of these formulas: string f =…
Michele mpp Marostica
  • 2,445
  • 4
  • 29
  • 45
1
2
3
15 16