Click or drag to resize

MathUtil Methods

The MathUtil type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAllPositive(Double, Int32)
Checks if vector xTable has all positive elements
Public methodStatic memberAllPositive(Double, Int32, Int32)
Checks if vector xTable has all positive elements
Public methodStatic memberAllZero
Checks if vector xTable has all zero elements
Public methodStatic memberAreEqualRel
Returns true if a and b are equal within a relative tolerance.
Public methodStatic memberDerivative
Calculates the derivative of the yTable versus xTable at x. The xTable must be either monoton increasing or monoton decreasing array. The method applied when the argument is outside the interval corresponds to the exrapolationmethod.nearest, i.e derivative equals zero.
Public methodStatic memberDerivatives
This procedure calculates the derivative of vector yTable with respect to the monoton and increasing vector xTable. The lengt of the yTable and xTable vectors must be equal and at least equal to 2.
Public methodStatic memberDivOrZero
This functions will make a division. If the denominator equals zero the function returns zero.
Public methodStatic memberFixBetweenLimits
Function that ensures that a value (the variable arg) is located within certain limits. if the value is lower than the low limit (the variable LowLimit) this function returns LowLimit. If the value is higher than the high limit (the variable HighLimit) the function returns HighLimit. Otherwise the value is returned.
Public methodStatic memberGetIndeces(DateTime, DateTime, Int32, Int32, Boolean)
Finds the two indexes in a mononton vector using bisection search. This can handle as well increasing as decreasing vectors, as long as they are monotone. The indexes corresponds to the points neighbouring the argument, arg. In case of an exact match the two indexes will be identical. If the argument is outside the valid interval either the lower or the upper interval boundary is returned depending on wheter the argument is lower or higher than the lower or upper boundary, respectively.
Public methodStatic memberGetIndeces(Double, MathUtilIDataToInterpolate, Int32, Int32, Boolean)
Finds the two indexes in a mononton vector using bisection search. This can handle as well increasing as decreasing vectors, as long as they are monotone. The indexes corresponds to the points neighbouring the argument, arg. In case of an exact match the two indexes will be identical. If the argument is outside the valid interval either the lower or the upper interval boundary is returned depending on wheter the argument is lower or higher than the lower or upper boundary, respectively.
Public methodStatic memberGetIndeces(Double, Double, Int32, Int32, Boolean)
Finds the two indexes in a mononton vector using bisection search. This can handle as well increasing as decreasing vectors, as long as they are monotone. The indexes corresponds to the points neighbouring the argument, arg. In case of an exact match the two indexes will be identical. If the argument is outside the valid interval either the lower or the upper interval boundary is returned depending on wheter the argument is lower or higher than the lower or upper boundary, respectively.
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 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).

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 memberGetIntervalU
Public methodStatic memberInterp(Double, MathUtilIDataToInterpolate, ExtrapolationTypes)
1-D linear interpolation (table lookup) Interpolates to find y, the value of the underlying function yTable at the point x. xTable must be a monoton increasing array of the same length as yTable. For x values outside xTable extrapolation is applied. Extrapolation method is specified.
Public methodStatic memberInterp(Double, Double, Double)
1-D linear interpolation (table lookup) Interpolates to find y, the value of the underlying function yTable at the point x. xTable must be a monoton increasing array of the same length as yTable.
Public methodStatic memberInterp(DateTime, DateTime, Double, ExtrapolationTypes)
1-D linear interpolation (table lookup) Interpolates to find y, the value of the underlying function yTable at the point x. xTable must be a monoton increasing array of the same length as yTable. For x values outside xTable extrapolation is applied. Extrapolation method is specified.
Public methodStatic memberInterp(Double, Double, Double, ExtrapolationTypes)
1-D linear interpolation (table lookup) Interpolates to find y, the value of the underlying function yTable at the point x. xTable must be a monoton increasing array of the same length as yTable. For x values outside xTable extrapolation is applied. Extrapolation method is specified.
Public methodStatic memberInterpn(Double, Double, Double)
1-D linear interpolation (table lookup) Interpolates to find y, the value of the underlying function yTable at the point x. xTable must be a monoton increasing array of the same length as yTable.
Public methodStatic memberInterpn(Double, Double, Double, ExtrapolationTypes)
Public methodStatic memberInterpolateRowsInTable
Looks the argument, x, up in the rowheader, xTable, of a table, table. Hereby the row numbers used for the interpolation is determined. In case of an exact match the indexes are identical. No extrapolations is used which implicitly corresponds to the extraplation type 'Nearest'.
Public methodStatic memberInterpolateTable
Interpolate an XYtable
Public methodStatic memberLimit
Limit a value between min and max
Public methodStatic memberMax
Determines the maximum value contained in the vector x.
Public methodStatic memberMin
Determines the minimum value contained in the vector x.
Public methodStatic memberMonotonicallyDecreasingOrConstant
Checks if vector xTable is monoton and decreasing or constant
Public methodStatic memberMonotonicallyIncreasingOrConstant
Checks if vector xTable is monoton and increasing or constant
Public methodStatic memberMonotonouslyDecreasingOrConstant
Checks if vector xTable is monoton and decreasing or constant
Public methodStatic memberPrepareIndexesForDerivation
Returns the indexes used to make a derivative. As input is used the indexes found in GetIndeces and the total number of entries in the array.
Public methodStatic memberSqr
Square function.
Public methodStatic memberStrictlyMonoton
Checks if vector xTable is strictly monoton and increasing
Public methodStatic memberStrictlyMonotonIndex(Double)
Checks if vector xTable is strictly monoton and increasing
Public methodStatic memberStrictlyMonotonIndexT(T, ComparisonT)
Checks if vector xTable is strictly monoton and increasing
Public methodStatic memberSurfaceAreaOfPartialCone
Return the surface area of a partial cone given the volume and one surface areas.
Public methodStatic memberVolumeOfPartialCone
Return the volume of a partial cone of a given height and surface areas.
Top
See Also