Click or drag to resize

MathUtilGetInterval Method

Overload List
  NameDescription
Public methodStatic memberGetInterval(Double, Double, Double)

Finds the interval in a vector where the argument lays in between. Assumes that the vector has at least two elements.

The vector must increase strictly monotonically. If argument is below the first value, 0 is returned. If argument is above last value, the length of the vector is returned.

The result is the interval number, one based, meaning that the arg fullfills:

(vector[res-1] < arg && arg <= vector[res])

Also the scale factor for interpolating is returned. For linear interpolation

arg = vector[res-1] + fraction*(vector[res]-vector[res-1])
or
arg = (1-fraction)*vector[res-1] + fraction*vector[res]

If arg exists in vector, the result is such that

arg = vector[res]
i.e., fraction is one (except when arg = vector[0], then res = 1 and fraction = 0).

Public methodStatic memberGetInterval(DateTime, IReadOnlyListDateTime, Double, Int32)
Public methodStatic memberGetInterval(Double, MathUtilIDataForSearching, Double, Int32)
Public methodStatic memberGetInterval(Double, IListDouble, Double, Int32)
Public methodStatic memberGetInterval(Double, ListDouble, Double, Int32)
Public methodStatic memberGetInterval(Double, Double, Double, Int32)
Finds the interval in a vector where the argument lays in between. Searches the last interval first. It is assumed that the input vector has at least two elements. This uses binary search techniques for efficiency. The vector must increase strictly monotonically. If argument is below the first value, 0 is returned. If argument is above last value, the length of the vector is returned. The result is the interval number, one based, meaning that the arg fullfills:
(vector[res-1] < arg && arg <= vector[res])
Also the scale factor for interpolating is returned. For linear interpolation
arg = vector[res-1] + fraction*(vector[res]-vector[res-1])
or
arg = (1-fraction)*vector[res-1] + fraction*vector[res]
If arg exists in vector, the result is such that
arg = vector[res]
i.e., fraction is one (except when arg = vector[0], then res = 1 and fraction = 0).
Public methodStatic memberGetInterval(Double, Int32, FuncInt32, Double, Double)

Finds the interval in a vector where the argument lays in between. Assumes that the vector has at least two elements.

The vector must increase strictly monotonically. If argument is below the first value, 0 is returned. If argument is above last value, the length of the vector is returned.

The result is the interval number, one based, meaning that the arg fullfills:

(vector[res-1] < arg && arg <= vector[res])

Also the scale factor for interpolating is returned. For linear interpolation

arg = vector[res-1] + fraction*(vector[res]-vector[res-1])
or
arg = (1-fraction)*vector[res-1] + fraction*vector[res]

If arg exists in vector, the result is such that

arg = vector[res]
i.e., fraction is one (except when arg = vector[0], then res = 1 and fraction = 0).

Public methodStatic memberGetIntervalT(Double, T, FuncT, Double, Double)

Finds the interval in a vector where the argument lays in between. Assumes that the vector has at least two elements.

The vector must increase strictly monotonically. If argument is below the first value, 0 is returned. If argument is above last value, the length of the vector is returned.

The result is the interval number, one based, meaning that the arg fullfills:

(vector[res-1] < arg && arg <= vector[res])

Also the scale factor for interpolating is returned. For linear interpolation

arg = vector[res-1] + fraction*(vector[res]-vector[res-1])
or
arg = (1-fraction)*vector[res-1] + fraction*vector[res]

If arg exists in vector, the result is such that

arg = vector[res]
i.e., fraction is one (except when arg = vector[0], then res = 1 and fraction = 0).

Public methodStatic memberGetIntervalT(T, MathUtilIDataForSearchingT, Double, Int32)
Public methodStatic memberGetInterval(Double, Int32, FuncInt32, Double, Double, Int32)

Finds the interval in a vector where the argument lays in between. Assumes that the vector has at least two elements.

The vector is represented by the vectorValue function, which must return vector values in strictly increasing order.

The vector must increase strictly monotonically. If argument is below the first value, 0 is returned. If argument is above last value, the length of the vector is returned.

The result is the interval number, one based, meaning that the arg fullfills:

(vector[res-1] < arg && arg <= vector[res])

Also the scale factor for interpolating is returned. For linear interpolation

arg = vector[res-1] + fraction*(vector[res]-vector[res-1])
or
arg = (1-fraction)*vector[res-1] + fraction*vector[res]

If arg exists in vector, the result is such that

arg = vector[res]
i.e., fraction is one (except when arg = vector[0], then res = 1 and fraction = 0).

Top
See Also