8.5. Obtaining Commons Math

Problem

You need to use Jakarta Commons Math to work with complex numbers, matrices, statistics, or linear equations.

Solution

Download Jakarta Commons Math and put the necessary JAR files in your classpath. Because Commons Math has not yet been released, you will need to download the latest nightly snapshot of Commons Math from http://cvs.apache.org/builds/jakarta-commons/nightly/commons-math/. Once you have downloaded the latest nightly build, uncompress the distribution, and place the commons-math-1.0-RC1.jar file in your classpath.

Discussion

Jakarta Commons Math was created to provide some more advanced mathematical capabilities under an Apache-style license. Commons Math provides classes to work with complex numbers, utilities to calculate statistics, a matrix implementation, special functions, continued fractions, root-finding, interpolation, and bivariate regression. Commons Math depends on Commons Collections 3.0, Commons Lang 2.0, and Commons Logging 1.0.3. To obtain these dependencies, see Recipe 1.1, Recipe 5.1, and Recipe 7.9.

Warning

By the time this book is published, Commons Math 1.0 may be released. Make sure you look at the Commons Math project page (http://jakarta.apache.org/commons/math) and check for a release before downloading.

While the previous four recipes demonstrated classes and utilities available in Jakarta Commons Lang, the next five recipes demonstrate classes and utilities from Jakarta Commons Math. Simpler math utilities, which ...

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.