

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object HiRISE.HiPlan.Utilities.Numerical
public class Numerical
A collection of numerical analysis routines. The collection includes a few
pretty basic functions as well, like minimum(double[])
, maximum(double[])
, and
vectorLength(double[])
.
Field Summary  

static String 
ID
Class identification name with source code version and date. 
Method Summary  

static Point2D 
boxMuller()
Computes a pair of normally distributed random numbers using the BoxMuller polar algorithm. 
static double 
interpolate(double[] f,
double x)
Computes an interpolated value for the tabulated function f = f(x). 
static double[] 
interpolate(double[] f,
double[] x)
Computes a onedimensional array of linearly interpolated values for a tabulated function f = f(x). 
static void 
main(String[] args)
Performs simple tests of the numerical analysis functions. 
static double 
maximum(double[] values)
Finds the maximum value of an array of values. 
static double 
minimum(double[] values)
Finds the minimum value of an array of values. 
static double 
nearestElement(double[] array,
double value)
Finds the element of the input array nearest to the input value. 
static double 
newtonCotes(double[] x,
double[] y)
Integrates the tabulated function y = y(x) using a fivepoint NewtonCotes method. 
static double[] 
spline(double[] x,
double[] y)
Computes the second derivatives of the interpolating function for the tabulated function y = f(x). 
static double[] 
spline(double[] x,
double[] y,
double yp0,
double ypn_1)
Computes the second derivatives of the interpolating function for the tabulated function y = f(x). 
static double[] 
splint(double[] xa,
double[] ya,
double[] x)
Computes the cubicspline interpolated values at x for the tabulated function ya = f(xa). 
static double 
splint(double[] xa,
double[] ya,
double[] y2,
double x)
Computes the cubicspline interpolated value at x for the tabulated function ya = f(xa). 
static double[] 
splint(double[] xa,
double[] ya,
double yp0,
double ypn_1,
double[] x)
Computes the cubicspline interpolated values at x for the tabulated function ya = f(xa). 
static double 
vectorLength(double[] v)
Computes the length of a vector. 
static double 
vincentyInverse(double lon1,
double lat1,
double lon2,
double lat2)
Computes the distance between two points on Mars using the Vincenty inverse formula. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final String ID
Method Detail 

public static double[] spline(double[] x, double[] y, double yp0, double ypn_1)
If either yp0 or ypn_1 (the first derivative of the
interpolating function at point 0 and n  1, respectively)
is Double.MAX_VALUE
, the corresponding boundary condition is set for
a natural spline, with a second derivative of 0 on that boundary.
This function is adapted from the function spline in Numerical Recipes in C (1988).
x
 the points for which the tabulated function y has been
calculated.y
 the tabulated function for interpolation.yp0
 the first derivative of the interpolating function at point
0.ypn_1
 the first derivative of the interpolating function at point
n  1.
public static double[] spline(double[] x, double[] y)
This function is adapted from the function spline in Numerical Recipes in C (1988).
x
 the points for which the tabulated function y has been
calculated.y
 the tabulated function for interpolation.
spline(double[], double[], double, double)
public static double splint(double[] xa, double[] ya, double[] y2, double x)
This function requires the second derivatives of the interpolating function,
which may be computed via the spline
function.
This function is adapted from the function splint in Numerical Recipes in C (1988).
xa
 the points for which the tabulated function ya has been
calculated.ya
 the tabulated function for interpolation.y2
 the second derivatives of the interpolating function; may be
computed via the spline
function.x
 the point at which to compute the interpolated value.
public static double[] splint(double[] xa, double[] ya, double yp0, double ypn_1, double[] x)
The second derivatives of the interpolating function are computed via the
spline
function with the given first derivatives at point
0 and n  1. If either derivative is Double.MAX_VALUE
, the corresponding boundary condition is set for a natural
spline, with a second derivative of 0 on that boundary.
This function is adapted from the function splint in Numerical Recipes in C (1988).
xa
 the points for which the tabulated function ya has been
calculated.ya
 the tabulated function for interpolation.yp0
 the first derivative of the interpolating function at point
0.ypn_1
 the first derivative of the interpolating function at point
n  1.x
 the points at which to compute the interpolated values.
public static double[] splint(double[] xa, double[] ya, double[] x)
The second derivatives of the interpolating function are computed via the
spline
function. The boundary points 0 and n 
1 of the interpolating function are set for a natural spline, with a
second derivative of 0 at those boundaries.
This function is adapted from the function splint in Numerical Recipes in C (1988).
xa
 the points for which the tabulated function ya has been
calculated.ya
 the tabulated function for interpolation.x
 the points at which to compute the interpolated values.
public static double interpolate(double[] f, double x)
The function f is assumed to have been computed from a function f(x) at regular intervals from 0 to n  1, where n is the length of the array f. Thus, f[0] is f(0), f[1] is f(1), and so on.
The returned value is computed such if x is outside the range 0, n  1, it is set to the value of the nearest element of the array f. Otherwise it is linearly interpolated.
Example:
If f is {1.0, 2.0, 4.0}, then for x in {0.5, 0.5, 1.75, 2.5}, interpolate(f, x) returns 1.0, 1.5, 3.5, and 4.0.
f
 a onedimensional array of function values.x
 the point for interpolation.
public static double[] interpolate(double[] f, double[] x)
The function f is assumed to have been computed from a function f(x) at regular intervals from 0 to n  1, where n is the length of the array f. Thus, f[0] is f(0), f[1] is f(1), and so on.
The returned array of interpolated values is computed such that input values in the array x that are outside the range 0, n  1 are set to the value of the nearest element of the array f. All other values are linearly interpolated.
Example:
If f is {1.0, 2.0, 4.0} and x is {0.5, 0.5, 1.75, 2.5}, then interpolate(f, x) returns {1.0, 1.5, 3.5, 4.0}.
f
 a onedimensional array of function values.x
 a onedimensional array of points for interpolation.
public static double newtonCotes(double[] x, double[] y)
cubicspline interpolation
is used
in the integration to regrid the function into regularly gridded segments.
x
 the points for which the tabulated function y has been
calculated.y
 the tabulated function.
public static double vincentyInverse(double lon1, double lat1, double lon2, double lat2)
lon1
 the first point's longitude in radians.lat1
 the first point's latitude in radians.lon2
 the second point's longitude in radians.lat2
 the second point's latitude in radians.
public static double minimum(double[] values)
values
 the array of values.
public static double maximum(double[] values)
values
 the array of values.
public static double vectorLength(double[] v)
v
 the input vector.
public static double nearestElement(double[] array, double value)
abs(a_{i}  v)
where a is the input array and v is the input test value.
array
 the input array of values.value
 the test value.
public static Point2D boxMuller()
This function uses the builtin Random
object to generate the
uniform distribution to be sampled.
The BoxMuller algorithm uses two input values to derive two output values.
The two output values are contained in a single Point2D
object for
convenience.
public static void main(String[] args)
Compare the results of these tests with the equivalent calls of the IDL routines on which they're based.
Numerical
Commandline arguments are ignored.
args
 commandline arguments, ignored.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 