Back to Joe's Java Index.
Math Tools Package
This library is provided as free software under the terms of the Lesser General Public License.
I have written a Java class package for completing a variety of useful
mathematical tasks. This package currently consists of the following:
- MathTools: A generic collection of small static methods that
accomplish a range of things including determining if a number is even
or odd, calculating the cube root of a number, the base 10 or base 2 logarithm
of a number, round a number to a specified decimal place, the greatest
common divisor between two numbers, the fractional part of a number, hyperbolic
sine, hyperbolic cosine, hyperbolic tangent and their inverses, natural
log of the gamma function, and methods for converting between binary and
decimal representations of numbers. And much, much more.
- Fraction: A class for representing a fraction in rational form.
A rational fraction is one that is represented as a ratio of whole numbers
numerator/denominator. It can also be represented as a whole number plus
a fractional part which is a numerator over a denominator. This class
provides methods for doing some simple arithmetic with rational fractions
and an elegant method for converting an arbitrary floating point number
to a rational fraction to a specified tolerance. For example, it will
convert the decimal fraction 0.3333333333 to the rational fraction
- Polynomial: A class that represents an arbitrary polynomial equation
of any degree. The coefficients of the polynomial may be either real
or complex. Includes a general zero or root finder, using the method
of Jenkins and Traub, that returns all the real and complex zeros of
the polynomial. Makes use of and depends on the Complex class found on
the Netlib Repository. The
Complex class from Netlib is included in this download for convenience.
- Roots and Evaluatable1D: A pair of classes used to find a root
to a specified and arbitrary 1D or ND equation. Two methods for finding 1D roots
are provided. The method that is chosen depends on whether or not your
function returns a derivative (slope) value or not. If it does not, then
the Van Wijngaarden-Dekker-Brent method (or Brent's method) is used. if
it does return a derivative value, then a generally faster converging Newton-Raphson
technique is used. In both cases, care is taken to avoid pathologies by
using root bracketing and simple bisection if convergence problems are encountered.
For n-dimensional functions, a globally convergent Newton's method with either a
Jacobian supplied by the user or one computed by differencing.
- Minimization: Provides methods that isolate the minimum/optimum to a 1D
or nD function. Brent's method (with or without derivatives) is used for 1D
function minimization. nD functions are minimized using Powell's method if
no derivatives are supplied or Polak-Reibiere's method if they are.
- Quadrature: Provides a collection of methods for numerically integrating
equations. Includes Simpson's Rule, Gauss-Legendre, and adaptive Gauss-Lobatto methods.
- TaylorSeries: A class that represents a Taylor series expansion
of an arbitrary function f(x) centered at x0. Includes a means of generating
a Taylor series for the trigonometric functions sine and cosine and the
exponential function e^x.
- Statistics: A collection of useful utility methods for calculating
statistical properties of sets of data. Includes min, max, range, sum,
mean, percentile, median, 1st and 3rd quartile, root mean square, variance,
standard deviation, skewness and kurtosis.
- LinAlg: A collection of useful utility methods for doing linear
algebra (matrix math). These are Java implementations of a few of the
famous Fortran BLAS (Basic Linear Algebra System) and LINPACK (Linear
Algebra Package) routines. I have been porting the BLAS/LINPACK algorithms
from Fortran as I've needed them for my own projects. To date, the following
routines have been ported: geco, gefa, gesl, axpy, dot, scal, iamax,
asum, mxpy, and the LINPACK benchmark. In most cases, both single and
double precision versions are available.
- Digital Filters: A set of classes that implement various digital
filter algorithms as used in control system modeling. Currently available
are an integrator, first-order lag, and a washout high pass filter.
- ModelData: A class used to create curve fits to measured data.
Can fit any functional relationship as long as a basis function is
provided. Currently there is only a polynomial curve fit basis function
- Ordinary Differential Equation (ODE) Integrators: A fix step
size 4th Order Runge-Kutta integrator and a variable step size 4th-5th Order
Runge-Kutta integrator are provided.
If you download my math package and use it. Let me know what you think
and especially let me know if there is something that should be corrected
or added to this package.
My math tools package, including documentation, can be downloaded by clicking here: jahuwaldt.tools.math.zip (466k), Version: April 3, 2014.
Change history .
Created: July 13, 2000
Modified: April 3, 2014