Meta.Numerics defines its own Complex type to represent a complex number. The following code snippet shows how to instantiate and use a complex number.
Complex x = new Complex(1.0, 1.0);
Complex y = 2.0 * x.Conjugate + 1.0;
Complex z = x / y;
Note that the Complex type supports all the usual arithmetic operations, including mixed operations with other arithmetic types.
Just as the .NET Base Class Library's
Math class offers static methods to perform basic operations on the basic .NET numeric types, Meta.Numerics's ComplexMath class offers state methods to perform basic operations on complex numbers:
Complex z = ComplexMath.I;
Complex sz = ComplexMath.Sqrt(z);
Complex ez = ComplexMath.Exp(Math.PI * z);
Additionally, the AdvancedComplexMath class allows you to compute some special functions with complex arguments, such as the Gamma function and error function.
Complex gz = AdvancedComplexMath.Gamma(z);
Version 4.0 of the .NET Framework introduced its own Complex structure. The Meta.Numerics Complex structure still is a different, independent type. This allows even programs compiled against version 3.5 of the .NET Framework to use complex numbers by using Meta.Numerics.