views:

192

answers:

5

Excluding everything that's in System.Math.

I think that System.Math is woefully inadequate. For example, in several official .Net frameworks, I can count 3 different implementations of matrices. Same goes for vectors. One implementation of a complex number; several different implementations of arbitrary rational numbers, and so on.

So, what would you like to see in a hypothetical System.Mathematics namespace?

+2  A: 

I rarely need anything outside of basic 'accounting math'.

Craig
A: 

Expression evaluation like that in Flee or Dotmath (see here and here)

John Sheehan
+1  A: 

Generics support (since C# 3.0 doesn't allow use of generics and operators), like here.

Marc Gravell
I actually made a library to do that. It creates an expression tree for each type, which adds the two inputs together, and compiles that to a delegate; it caches that delegate and then calls it. I made it an extension method of object, so you can do something like var z = x.Add(y);.
TraumaPony
Yes, me too ;-p It sits in Jon's MiscUtil library, courtesy of the Operator class.
Marc Gravell
+4  A: 

Here is what I use:

  • Numerical integrals
  • Numerical derivatives
  • FFTs
  • Matrices
  • Vectors
  • Complex numbers
  • Geometric types such as polygons, spheres, toroids, etc
  • Gaussian distributions
  • Navier-Stokes equations
  • DSP filters
  • Symbolic algebra
  • Quaternions
  • Optimisation
  • Ordinary Differential Equations and ODE solvers
  • Likewise for PDEs
TraumaPony
How many programmers would use advanced maths like this day to day?
Jonathan Webb
Well, complex numbers/matrices/vectors/Gaussian distributions aren't exactly 'advanced'...
TraumaPony
They are pretty advanced for most applications, and once they are used they should be very high performant. Every bank I've worked at have implemented their own maths library since the quantitative analysts want "their own" algorithm.
Mats Fredriksson
Yes, some are pretty advanced... But you could argue that for CodeDOM or Reflection.Emit. Microsoft already has implemented a lot of these several times; they should be implemented once and for all in a dedicated namespace.
TraumaPony
Oh my God, FFT, DSP filters and Quaternions! I barely scratch the surface of those topics -- You gotta love math!
Camilo Martin
A: 

Check http://msdn.microsoft.com/en-us/vcsharp/aa336740.aspx

Under the Math there are some links to some libraries for C#

João Augusto