BCL Math

12/12/2005 2:19:20 AM

BCL Math

When I met with the .NET BCL team last February, one of the PMs mentioned potential enhancements to the Math class in the base class library of the .NET Framework. Katy King from the team also blogged about the new Math additions in Orcas. Features included complex numbers, permutations, arbitrary precision numbers, and vector math.

There is a strong need for better support in this arena. Currently, the .NET Framework is poorly suited for mathematical computing. Framework provide basic mathematical functions, and the .NET execution engine doesn’t take advantage of floating point hardware. I believe Java is ahead, if only because it supports big numbers, BigInteger and BigDecimal; however, these types still suffer from the overhead of being a reference type.

With Avalon, new mathematical types were introduced to support 3D such as matrix, vectors, and quaternions—not to mention 2D transforms. These types are hidden under System.Windows.Media.Media3D. They are so generally useful that the Framework team should probably have included them under a namespace System.Numerics and located them in a more appropriate assembly to encourage reuse and avoid unnecessary duplication. On the other hand, the Media3D classes are rather lightweight and could be tuned for 3D presentation.

Advanced mathematics will probably be increasingly used as software becomes smarter and development tools improve over time. This is especially true if constraint logic programming is introduced as Microsoft Research, Todd Proebstring, suggests in his presentation on Disruptive Programming Languages, (and which Chris Sells was worked up by). Solving equations and optimizing inequalities requires an array of different techniques.

While browsing lecture notes from a Machine Learning course archived at MIT Open Courseware Project, I noted how similar many techniques in AI were to those used in management science and operations research from multiple regression, markov models, bayesian techniques, and so on. As we make computers smarter, they begin to utilize the same tools we do.

In the course of trying to build my own “smart” software, I repeatedly found myself lamenting the poor library support in .NET. For example, I needed to use linear regression. One-variable regression was simple enough to write in a single function. However, multiple regression requires linear algebra and exotic technique to make it consume little memory and perform quickly—meaning more classes, rather than methods, and non-trivial testing.

 

Comments

 

Navigation

Categories

About

Net Undocumented is a blog about the internals of .NET including Xamarin implementations. Other topics include managed and web languages (C#, C++, Javascript), computer science theory, software engineering and software entrepreneurship.

Social Media