MathLib - assorted numerical routines

Shodor > CSERD > Resources > Libraries > MathLib - assorted numerical routines

Download Source Code  •  Documentation  •  View License Agreement

Mathlib class documentation

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.

Languages:

• Java

Member variables

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

Methods

``` ```
• ```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. ```
• ```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. ```
• ```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. ```
• ```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. ```
• ```public static int factorial (int n) ```
• ```public static int doubleFactorial(int l) Returns n!! = n * (n-2) * (n-4) * ... ```

• ©1994-2018 Shodor