|
SSJ V. 1.2.5. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.util.Misc
public class Misc
This class provides miscellaneous functions that are hard to classify. Some may be moved to another class in the future.
Method Summary | |
---|---|
static double |
evalPoly(int n,
double[] X,
double[] C,
double z)
Given n, X and C as described in interpol (n, X, Y, C),
this function returns the value of the interpolating polynomial evaluated at z. |
static int |
getTimeInterval(double[] times,
int start,
int end,
double t)
Returns the index of the time interval corresponding to time t. |
static void |
interpol(int n,
double[] X,
double[] Y,
double[] C)
. |
static double |
quickSelect(double[] t,
int n,
int k)
Returns the kth smallest item of the array t of size n. |
static int |
quickSelect(int[] t,
int n,
int k)
Returns the kth smallest item of the array t of size n. |
static double |
simpsonIntegral(MathFunction func,
double a,
double b,
int numIntervals)
Computes and returns an approximation of the integral of func over [a, b], using the Simpsons 1/3 method with numIntervals intervals. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double quickSelect(double[] t, int n, int k)
t
- the array which contain the itemsn
- the number of items in the arrayk
- the index of the smallest item
public static int quickSelect(int[] t, int n, int k)
t
- the array which contain the itemsn
- the number of items in the arrayk
- the index of the smallest item
public static int getTimeInterval(double[] times, int start, int end, double t)
times
- an array of simulation times.start
- the first index in the array to consider.end
- the last index (inclusive) in the array to consider.t
- the queried simulation time.
NullPointerException
- if times is null.
IllegalArgumentException
- if start is negative,
or if end is smaller than start.
ArrayIndexOutOfBoundsException
- if start + end
is greater than or equal to the length of times.public static void interpol(int n, double[] X, double[] Y, double[] C)
n
- degree of the interpolating polynomialX
- x-coordinates of pointsY
- y-coordinates of pointsC
- Coefficients of the interpolating polynomialpublic static double evalPoly(int n, double[] X, double[] C, double z)
interpol
(n, X, Y, C),
this function returns the value of the interpolating polynomial evaluated at z.
n
- degree of the interpolating polynomialX
- x-coordinates of pointsC
- Coefficients of the interpolating polynomialz
- x-coordinate where polynomial is evaluatedpublic static double simpsonIntegral(MathFunction func, double a, double b, int numIntervals)
func
- the function being integrated.a
- the left boundb
- the right bound.numIntervals
- the number of intervals.
|
SSJ V. 1.2.5. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |