Chapter 8. Math
Introduction
In recent years, Java has lost its reputation as a language suffering from serious performance problems. Although the debate still rages on and various benchmarks show conflicting results, improvements to the JVM, the compiler, and a more intelligent garbage collector have boosted performance to levels on par with C++. Java has never been the traditional language-of-choice for scientific computing, numerical methods, or high-performance computing, but, as performance improves, there are fewer reasons to avoid using Java for numerical computing. It is no longer inconceivable to consider Java when implementing systems involving complex mathematics, and Jakarta Commons contains two projects that provide some very basic math capabilities: Commons Lang and Commons Math.
The first four recipes in this chapter deal with math utilities found in Commons Lang. This includes a class that represents fractions, finding the minimum and maximum values in an array, representing a range of numbers, and convenient ways to retrieve different random variables. Commons Lang was introduced in Chapter 1, and instructions for downloading and installing Commons Lang can be found in Recipe 1.1. The remainder of this chapter deals with Jakarta Commons Math. Recipes involving Commons Math deal with complex numbers, the calculation of univariate statistics, solving a system of linear equations, and establishing a relationship between two independent variables. Instructions for downloading ...
Get Jakarta Commons Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.