hmi.math
Class NumMath

java.lang.Object
  extended by hmi.math.NumMath

public final class NumMath
extends Object

Numerical functions on data lists

Author:
Herwin van Welbergen

Constructor Summary
private NumMath()
           
 
Method Summary
static void diff(double[] dst, double[] x, double h)
          Differentiates the values x in the array, assumes equidistant data in x, with distance h assumes dst.length >= x.length-1 dst[0]=(x[1]-x[0])/h dst[i]=(x[i+1]-x[i-1])/2*h
static void diff(double[] dst, double[] x, double h, int width)
          Differentiates the values x in the array, assumes equidistant data in x, with distance h assumes dst.length >= x.length-1 dst[0]=(x[1]-x[0])/h dst[i]=(x[i+1]-x[i-1])/2*h Assumes the data is aligned in blocks of width, differentiates the block elements seperately
static double diff(double xPrev, double xNext, double h)
          Numerical differentiation of x(t) diff = (x(t+h)-x(t-h))/h
static void diff(float[] dst, float[] x, float h, int width)
          Differentiates the values x in the array, assumes equidistant data in x, with distance h assumes dst.length >= x.length-1 dst[0]=(x[1]-x[0])/h dst[i]=(x[i+1]-x[i-1])/2*h Assumes the data is aligned in blocks of width, differentiates the block elements seperately
static float diff(float xPrev, float xNext, float h)
          Numerical differentiation of x(t) diff = (x(t+h)-x(t-h))/h
static void diff2(double[] dst, double[] x, double h)
          Differentiates the values x in the array twice, assumes equidistant data in x with distance h assumes dst.length >= x.length-1 dst[i]= (x[i+1]-2*x[i]+x[i-1])/(2*h*h), for 1 <= i <= x.length-1 dst[0] does not contain a valid value for the 2nd derivative
static void diff2(double[] dst, double[] x, double h, int width)
          Differentiates the values x in the array twice, assumes equidistant data in x with distance h assumes dst.length >= x.length-1 dst[i]= (x[i+1]-2*x[i]+x[i-1])/(h*h), for 1 <= i <= x.length-1 dst[0]=dst[1] Assumes the data is aligned in blocks of width, differentiates the block elements seperately
static double diff2(double xPrev, double xCurr, double xNext, double h)
          differerentiates x twice diff2 = (x(t+h)-2*x(t)+x(t-h))/(h*h)
static void diff2(float[] dst, float[] x, float h, int width)
          Differentiates the values x in the array twice, assumes equidistant data in x with distance h assumes dst.length >= x.length-1 dst[i]= (x[i+1]-2*x[i]+x[i-1])/(h*h), for 1 <= i <= x.length-1 dst[0]=dst[1] Assumes the data is aligned in blocks of width, differentiates the block elements seperately
static float diff2(float xPrev, float xCurr, float xNext, float h)
          differerentiates x twice diff2 = (x(t+h)-2*x(t)+x(t-h))/(h*h)
static void interpolate(double[] dst, double[] x, double h, double t)
          Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t
static double interpolate(double[] x, double h, double t)
          Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t
static void interpolate(float[] dst, float[] x, float h, float t)
          Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t
static float interpolate(float[] x, float h, float t)
          Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumMath

private NumMath()
Method Detail

diff

public static void diff(double[] dst,
                        double[] x,
                        double h)
Differentiates the values x in the array, assumes equidistant data in x, with distance h assumes dst.length >= x.length-1 dst[0]=(x[1]-x[0])/h dst[i]=(x[i+1]-x[i-1])/2*h


diff2

public static void diff2(double[] dst,
                         double[] x,
                         double h)
Differentiates the values x in the array twice, assumes equidistant data in x with distance h assumes dst.length >= x.length-1 dst[i]= (x[i+1]-2*x[i]+x[i-1])/(2*h*h), for 1 <= i <= x.length-1 dst[0] does not contain a valid value for the 2nd derivative


diff

public static float diff(float xPrev,
                         float xNext,
                         float h)
Numerical differentiation of x(t) diff = (x(t+h)-x(t-h))/h

Parameters:
xPrev - x(t-h)
xNext - x(t+h)
h - distance
Returns:
dx/dt

diff

public static double diff(double xPrev,
                          double xNext,
                          double h)
Numerical differentiation of x(t) diff = (x(t+h)-x(t-h))/h

Parameters:
xPrev - x(t-h)
xNext - x(t+h)
h - distance
Returns:
dx/dt

diff2

public static float diff2(float xPrev,
                          float xCurr,
                          float xNext,
                          float h)
differerentiates x twice diff2 = (x(t+h)-2*x(t)+x(t-h))/(h*h)

Parameters:
xPrev - x(t-h)
xCurr - x(t)
xNext - x(t+h)
h - distance
Returns:
d2x/dt2

diff2

public static double diff2(double xPrev,
                           double xCurr,
                           double xNext,
                           double h)
differerentiates x twice diff2 = (x(t+h)-2*x(t)+x(t-h))/(h*h)

Parameters:
xPrev - x(t-h)
xCurr - x(t)
xNext - x(t+h)
h - distance
Returns:
d2x/dt2

diff

public static void diff(double[] dst,
                        double[] x,
                        double h,
                        int width)
Differentiates the values x in the array, assumes equidistant data in x, with distance h assumes dst.length >= x.length-1 dst[0]=(x[1]-x[0])/h dst[i]=(x[i+1]-x[i-1])/2*h Assumes the data is aligned in blocks of width, differentiates the block elements seperately


diff

public static void diff(float[] dst,
                        float[] x,
                        float h,
                        int width)
Differentiates the values x in the array, assumes equidistant data in x, with distance h assumes dst.length >= x.length-1 dst[0]=(x[1]-x[0])/h dst[i]=(x[i+1]-x[i-1])/2*h Assumes the data is aligned in blocks of width, differentiates the block elements seperately


diff2

public static void diff2(double[] dst,
                         double[] x,
                         double h,
                         int width)
Differentiates the values x in the array twice, assumes equidistant data in x with distance h assumes dst.length >= x.length-1 dst[i]= (x[i+1]-2*x[i]+x[i-1])/(h*h), for 1 <= i <= x.length-1 dst[0]=dst[1] Assumes the data is aligned in blocks of width, differentiates the block elements seperately


diff2

public static void diff2(float[] dst,
                         float[] x,
                         float h,
                         int width)
Differentiates the values x in the array twice, assumes equidistant data in x with distance h assumes dst.length >= x.length-1 dst[i]= (x[i+1]-2*x[i]+x[i-1])/(h*h), for 1 <= i <= x.length-1 dst[0]=dst[1] Assumes the data is aligned in blocks of width, differentiates the block elements seperately


interpolate

public static double interpolate(double[] x,
                                 double h,
                                 double t)
Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t


interpolate

public static float interpolate(float[] x,
                                float h,
                                float t)
Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t


interpolate

public static void interpolate(double[] dst,
                               double[] x,
                               double h,
                               double t)
Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t


interpolate

public static void interpolate(float[] dst,
                               float[] x,
                               float h,
                               float t)
Linear interpolation of equadistantly placed points, the distance between the points is h: x(t) = x[i] + (x(i)-x(i+1)/h * (t-i*h) with i*h<=t, (i+h)*h>=t