MathUtil Methods |
The MathUtil type exposes the following members.
Name | Description | |
---|---|---|
AllPositive(Double, Int32) |
Checks if vector xTable has all positive elements
| |
AllPositive(Double, Int32, Int32) |
Checks if vector xTable has all positive elements
| |
AllZero |
Checks if vector xTable has all zero elements
| |
AreEqualRel |
Returns true if a and b are equal
within a relative tolerance.
| |
Derivative |
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.
| |
Derivatives |
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.
| |
DivOrZero |
This functions will make a division. If the denominator equals zero the function returns zero.
| |
FixBetweenLimits |
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.
| |
GetIndeces(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.
| |
GetIndeces(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.
| |
GetIndeces(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.
| |
GetInterval(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]) arg = (1-fraction)*vector[res-1] + fraction*vector[res] If arg exists in vector, the result is such that arg = vector[res] | |
GetInterval(DateTime, IReadOnlyListDateTime, Double, Int32) | GetInterval(Double, Double, Double, Int32) for DateTimes.
This has an IReadOnlyListT DateTime as argument instead of a DateTime[].
which is slower than a DateTime[] version
| |
GetInterval(Double, MathUtilIDataForSearching, Double, Int32) | GetInterval(Double, Double, Double, Int32) for details.
This has an MathUtilIDataForSearching as argument instead of a double[].
This version is slower than the double[] version.
| |
GetInterval(Double, IListDouble, Double, Int32) | GetInterval(Double, Double, Double, Int32) for details.
This has an IListT as argument instead of a double[].
This version is slower than the double[] version.
| |
GetInterval(Double, ListDouble, Double, Int32) | GetInterval(Double, Double, Double, Int32) for details.
This has an ListT as argument instead of a double[].
This version is slower than the double[] version
| |
GetInterval(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]) arg = vector[res-1] + fraction*(vector[res]-vector[res-1]) arg = (1-fraction)*vector[res-1] + fraction*vector[res] arg = vector[res] | |
GetInterval(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]) arg = (1-fraction)*vector[res-1] + fraction*vector[res] If arg exists in vector, the result is such that arg = vector[res] | |
GetInterval(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]) arg = (1-fraction)*vector[res-1] + fraction*vector[res] If arg exists in vector, the result is such that arg = vector[res] | |
GetIntervalT(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]) arg = (1-fraction)*vector[res-1] + fraction*vector[res] If arg exists in vector, the result is such that arg = vector[res] | |
GetIntervalT(T, MathUtilIDataForSearchingT, Double, Int32) | GetInterval(Double, Double, Double, Int32) for details.
This has an MathUtilIDataForSearchingT as argument instead of a double[].
This version is slower than an array version.
| |
GetIntervalU |
Unsafe version of GetInterval(Double, Double, Double, Int32) | |
Interp(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.
| |
Interp(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.
| |
Interp(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.
| |
Interp(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.
| |
Interpn(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.
| |
Interpn(Double, Double, Double, ExtrapolationTypes) | ||
InterpolateRowsInTable |
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'.
| |
InterpolateTable |
Interpolate an XYtable
| |
Limit |
Limit a value between min and max
| |
Max |
Determines the maximum value contained in the vector x.
| |
Min |
Determines the minimum value contained in the vector x.
| |
MonotonicallyDecreasingOrConstant |
Checks if vector xTable is monoton and decreasing or constant
| |
MonotonicallyIncreasingOrConstant |
Checks if vector xTable is monoton and increasing or constant
| |
MonotonouslyDecreasingOrConstant |
Checks if vector xTable is monoton and decreasing or constant
| |
PrepareIndexesForDerivation |
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.
| |
Sqr |
Square function.
| |
StrictlyMonoton |
Checks if vector xTable is strictly monoton and increasing
| |
StrictlyMonotonIndex(Double) |
Checks if vector xTable is strictly monoton and increasing
| |
StrictlyMonotonIndexT(T, ComparisonT) |
Checks if vector xTable is strictly monoton and increasing
| |
SurfaceAreaOfPartialCone |
Return the surface area of a partial cone given the volume and one surface areas.
| |
VolumeOfPartialCone |
Return the volume of a partial cone of a given height and surface areas.
|