The Math class basically contains a large number of static functions to perform operations such as calculating sines, logarithms etc. It also contains two static members, E and PI, which respectively return the values of the mathematical constants e and p. The class is quite basic: it contains all the important mathematical functions, but not much more. There is at present no support for, for example complex numbers or vector or matrix operations. Also the function names will probably annoy many mathematicians since their names often don't follow normal usage as far as case is concerned.
We'll demonstrate the use of this class with a simple application, Math, which displays the values of e and p and also the sines of angles between 0 and 90 degrees. The code that we add to the constructor to the main form class looks like this
AddItem("e is " + Math.E);
AddItem("pi is " + Math.PI);
AddItem("");
AddItem("sines of angles from 0 to 90 degrees:");
// display sines. Note we must convert from degrees to radians.
for (double theta=0 ; theta<90.1 ; theta+=22.5)
AddItem("sin " + theta + " = " + Math.Sin(theta*Math.PI/180));
Note in this code that we need to convert degrees to radians by multiplying by (p/180) since all the math trigonometric functions work in radians.
This code produces this output:

The main mathematical functions include the following:

Note that these mathematical functions all take double as the parameter and return a double, apart from Abs, Max, Min and Sign, which returns 1, 0 or -1 - these functions make sense for any numeric type, for example it is equally valid to take the absolute value of an integer or a floating point value, and so Microsoft have provided overloaded functions that take different .NET numeric types.
Summary
In this chapter we've explained the concept of a namespace, and then gone on a quick tour of some of the functionality available via the .NET SDK base classes. Hopefully these examples will have shown you that the base classes make it very easy to carry out a lot of Windows tasks. Some of these tasks were previously only available via the Win32 SDK, which was not only conceptually harder to program with, but also made it difficult to carry out those tasks from any language other than C++. With the new base classes these tasks can be accomplished with ease from any .NET-aware or COM-aware language.