MathLib is a library of assorted mathematical routines commonly used in the creation of CSERD models. These might be better organized some day, or put together as part of a package.

public static final double log10Constant = Math.log(10.0);

public static double niceNumber ( double x, boolean round) Given a number, find the nearest nice looking number. I'll have to find the original source for the algorithm.

Given a number, find the nearest nice looking number. I'll have to find the original source for the algorithm.

public static double log10(double x)

public static double [] niceLabels (int nLabel, double minLabel, double maxLabel) Create an array of nice numbers. Useful for creating plot labels.

Create an array of nice numbers. Useful for creating plot labels.

public static double [] niceLogLabels(int nLabel, double minLabel, double maxLabel) Create an array of nice numbers with a logarithmic scale. Useful for creating plot labels.

Create an array of nice numbers with a logarithmic scale. Useful for creating plot labels.

public static double cartesianToR(double x, double y, double z)

public static double cartesianToPhi(double r, double z)

public static double cartesianToPhi(double x, double y, double z)

public static double cartesianToTheta(double x, double y)

public static double [] linearGrid(int n, double min, double max) Returns a reference to a linearly spaced array of doubles.

Returns a reference to a linearly spaced array of doubles.

public static int factorial (int n)

public static int doubleFactorial(int l) Returns n!! = n * (n-2) * (n-4) * ...

Returns n!! = n * (n-2) * (n-4) * ...