# numdart library

## Classes

Array
Class to create 1 dimension Array.
Array2d
Class to create 2 dimensions Array.
Array3d
Class to create 3 dimensions Array.
ArrayComplex
Class to create 1 dimension ArrayComplex.
Complex
Class to create and handle a complex numbers.
FloatInfo
LU
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. If m < n, then L is m-by-m and U is m-by-n. The LU decomposition with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations. This will fail if isNonsingular() returns false.
PolyFit
The PolynomialRegression class performs a polynomial regression on an set of N data points (yi, xi). That is, it fits a polynomial y = β0 + β1 x + β2 x2 + ... + βd xd (where y is the response variable, x is the predictor variable, and the βi are the regression coefficients) that minimizes the sum of squared residuals of the multiple regression model. It also computes associated the coefficient of determination R2. This implementation performs a QR-decomposition of the underlying Vandermonde matrix, so it is neither the fastest nor the most numerically stable way to perform the polynomial regression.
QR
QR Decomposition. For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n orthogonal matrix Q and an n-by-n upper triangular matrix R so that A = Q*R. The QR decompostion always exists, even if the matrix does not have full rank, so the constructor will never fail. The primary use of the QR decomposition is in the least squares solution of nonsquare systems of simultaneous linear equations. This will fail if isFullRank() returns false.
SVD
Singular Value Decomposition. For an m-by-n matrix A with m >= n, the singular value decomposition is an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and an n-by-n orthogonal matrix V so that A = USV'. The singular values, sigma[k] = S[k][k], are ordered so that sigma[0] >= sigma[1] >= ... >= sigma[n-1]. The singular value decompostion always exists, so the constructor will never fail. The matrix condition number and the effective numerical rank can be computed from this decomposition.

Even

## Constants

acos → const double Function(num x)
acre → const double
alpha → const double
fine-structure constant
angstrom → const double
arcmin → const double
arcminute → const double
arcsec → const double
arcsecond → const double
asin → const double Function(num x)
astronomicalUnit → const double
atan2 → const double Function(num a, num b)
atm → const int
atmosphere → const int
atomicMass → const double
atto → const double
au → const double
bar → const double
barrel → const double
bbl → const double
for oil
blob → const double
Boltzmann → const double
Btu → const double
BtuIT → const double
BtuTh → const double
c → const int
physical constants
calorie → const double
calorieIT → const double
calorieTh → const double
carat → const double
centi → const double
cos → const double Function(num radians)
day → const double
deci → const double
degree → const double
degreeFahrenheit → const double
only for differences
deka → const double
dyn → const double
force in newton
dyne → const double
e → const double
Base of the natural logarithms. Typically written as "e".
eC → const double
elementary charge
electron_volt → const double
electronMass → const double
elementaryCharge → const double
epsilon0 → const double
erg → const double
eV → const double
energy in joule
exa → const double
exbi → const double
exp → const double Function(num x)
femto → const double
fermi → const double
fineStructure → const double
fluid_ounce_imp → const double
fluidOunce → const double
pint = gallon_US / 8
fluidOunceUS → const double
G → const double
Newtonian constant of gravitation
g → const double
Standard acceleration of gravity
gallon → const double
gallonImp → const double
UK
gallonUS → const double
gasConstant → const double
gibi → const int
giga → const double
golden → const double
goldenRatio → const double
grain → const double
gram → const double
mass in kg
gravitationalConstant → const double
h → const double
Planck constant
hbar → const double
hectare → const double
hecto → const double
horsepower → const double
hour → const double
hp → const double
power in watt
inch → const double
length in meter
JulianYear → const double
k → const double
Boltzmann constant
kgf → const double
• 1 kg
• kibi → const int
binary prefixes
kilo → const double
kilogram_force → const double
kmh → const double
speed in meter per second
knot → const double
lb → const double
avoirdupois
lbf → const double
lightYear → const double
liter → const double
litre → const double
volume in meter**3
ln10 → const double
ln2 → const double
log → const double Function(num x)
log10e → const double
log2e → const double
longTon → const double
mach → const double
max → const T Function<T extends num>(T a, T b)
mE → const double
electron mass
mebi → const int
mega → const double
metricTon → const double
micro → const double
micron → const double
mil → const double
mile → const double
milli → const double
min → const T Function<T extends num>(T a, T b)
minute → const double
time in second
mmHg → const double
mN → const double
neutron mass
mP → const double
proton mass
mph → const double
mU → const double
atomic mass constant
mu0 → const double
NA → const double
nano → const double
nauticalMile → const double
neutronMass → const double
ounce → const double
oz → const double
parsec → const double
pebi → const int
peta → const double
pi → const double
The PI constant.
pico → const double
Planck → const double
point → const double
pound → const double
poundForce → const double
pow → const num Function(num x, num exponent)
protonMass → const double
psi → const double
pt → const double
typography
R → const double
molar gas constant
Rydberg → const double
Rydberg constant
shortTon → const double
sigma → const double
Stefan-Boltzmann constant
sin → const double Function(num radians)
slinch → const double
slug → const double
speedOfLight → const int
speedOfSound → const double
sqrt → const double Function(num x)
sqrt1_2 → const double
sqrt2 → const double
Stefan_Boltzmann → const double
stone → const double
surveyFoot → const double
surveyMile → const double
tan → const double Function(num radians)
tebi → const int
tera → const double
ton_TNT → const double
torr → const double
troyOunce → const double
troyPound → const double
u → const double
week → const double
Wien → const double
Wien wavelength displacement law constant
yard → const double
year → const double
yobi → const double
yotta → const double
SI prefixes
zebi → const double
zepto → const double
zero_Celsius → const double
temperature in kelvin
zetta → const double

## Functions

arange({int start = 0, int stop = 10, int step = 1})
array2dAddToScalar(Array2d a, num b, {bool returnNewArray = false}) → dynamic
Add all the matrix elements for a number
array2dDivisionToScalar(Array2d a, num b, {bool returnNewArray = false}) → dynamic
Divide all the matrix elements for a number
array2dInverseOfEachElement(Array2d a, {bool returnNewArray = false}) → dynamic
Compute the inverse of each elements ( x`l` = 1/x`l` )
array2dMultiplyToScalar(Array2d a, num b, {bool returnNewArray = false}) → dynamic
Multiply all the matrix elements for a number
array2dPow(Array2d a, double exponent, {bool returnNewArray = false}) → dynamic
Compute the power of each element of the array2d `a` by `exponent` ( x`l` = x`l`^exponent )
array2dSubToScalar(Array2d a, num b, {bool returnNewArray = false}) → dynamic
Subtract all the matrix elements for a number
array2dTruncateEachElement(Array2d a, int fractionDigits, {bool returnNewArray = false}) → dynamic
Truncate all the elements of the array
Add a number for each array element
arrayArgMax() int
Return the index of the first greater element of the array
arrayComplexAbs()
Absolute value of all elements of the current array
arrayComplexConcat()
Concatenate X in to the current array
arrayComplexConjugate()
Conjugate of all elements of the current array
arrayComplexCos()
Compute the cos for each element of the array
arrayComplexDivisionToScalar(num b)
Divide all the array elements for a number
arrayComplexMultiplyToScalar(num b)
Multiply all the array elements for a number
Add zeros at begging of the array
arrayComplexReverse()
Return the array complex reversed
arrayComplexSum()
Sum two arrays
arrayComplexTruncateEachElement(int fractionDigits, {bool returnNewArray = false}) → dynamic
Truncate all the numbers of the array
arrayComplexTruncateLast()
Return an Array without the last element
arrayConcat( arrays)
Concatenate a list of arrays and return
arrayCos()
Compute the cos for each element of the array
arrayCumSum()
Return the array with accumulative sum of all elements of the array
arrayDiff()
Calculate the n-th discrete difference of an Array using the formula `out[i] = a[i+1] - a[i]`.
arrayDivisionToScalar(Array a, num b)
Divide all the array elements for a number
arrayLog()
Compute the natural logarithm for each element of the array
arrayLog10()
Compute the log10 for each element of the array
arrayMax()
Return the greater element in the array
arrayMin()
Return the sum of all elements of the array
arrayMultiplyToScalar(Array a, num b)
Multiply all the array elements for a number
Add zeros at begging of the array
arrayPow(Array a, double exponent)
Compute the power for each element of the array `a` by `exponent`
arrayReshapeToMatrix(Array a, int order)
Reshape an Array to a matrix with a given order
arrayReverse()
Return the array reversed
arraySin()
Compute the sin for each element of the array
arraySinc()
Compute the sinc for each element of the array
arraySqrt()
Compute the square root for each element of the array
arraySubToScalar(Array a, num b)
Subtract all the array elements for a number
arraySum()
Return the sum of all elements of the array
arrayToColumnMatrix()
Convert an Array to a matrix with one column
arrayToComplexArray()
Convert an Array to ArrayComplex
arrayTruncateEachElement(Array a, int fractionDigits, {bool returnNewArray = false}) → dynamic
Truncate all the numbers of the array
arrayTruncateLast()
Return an Array without the last element
atan2Fast(double y, )
Two arguments arctangent function
atanFast(double xa, [double xb = 0.0, bool leftPlane = false])
Internal helper function to compute arctangent.
bitReverse(int n, int bits) int
Rotate to left the bits of an int number n times
boolToInt(bool a) int
Convert a bool to int, if true return 1, else 0
checkParamsGetRangeArray( y, x, int dx) → void
complexAbs()
Return a double that represent the absolute value of a complex number
complexConjugate()
Return the conjugate of a complex number
complexCos()
Compute the cosine of this complex number.
complexDivideScalar(Complex a, num b)
Divide real part and imaginary for a double number
complexExp(Complex exponent)
Calculate natural exponent for any number complex number: e^(x+(yi)). It's a generatlization of Euler’s formula: e^(iy) = cos(y) + i*sen(y).
complexMultiplyScalar(Complex a, num b)
Multiply real part and imaginary for a double number
complexTruncate(Complex val, int fractionDigits)
Truncate the real and imaginary part of an imaginary number. This function is very useful for compere two double numbers.
copySign(double magnitude, double sign)
Returns the first argument with the sign of the second argument. A NaN `sign` argument is treated as positive.
cosh()
Compute the hyperbolic cosine of a number.
createArrayRange({int start = 0, int stop = 10, int step = 1})
Return evenly spaced values within a given interval. Values are generated within the half-open interval [start, stop) (in other words, the interval including start but excluding stop). When using a non-integer step, such as 0.1, It is better to use linspace.
cumIntegration(Array y, { x, int dx = 1, initial})
Compute the numerical accumulative integration of an Array using the trapezoidal rule.
differentiateArray(Array y, )
Compute the numerical derivative of two arrays
differentiateFunction(double x, Function f, {double dx = 0.00000001})
Compute the numerical derivative of a function in a certain point
expFast(double x, [double extra = 0.0, List<double>? hiPrec])
Internal helper method for exponential function.
expm1(double x, {List<double>? hiPrecOut})
Compute `exp(x) - 1`.
highestOneBit(int n) int
Reurn the highest one bit of an int `n` : input number References
hypotenuse(double x, )
Calculate the hypotenuse with pythagorean theorem
intToBool(int a) bool
Convert an int to bool, if 0 return false, else true
isEven(int a) bool
Check if `a` is an Even number.
isEvenDouble(double a, int fractionDigits) bool
Check if `a` is an Even number after a truncation.
isOdd(int a) bool
Check if `a` is an Odd number.
isOddDouble(double a, int fractionDigits) bool
Check if `a` is an Odd number after a truncation.
isPowerOf2(int n) bool
CHeck if `n` is power of 2.
linspace(double start, double stop, {int num = 50, bool endpoint = true})
Return evenly spaced numbers over a specified interval. Returns `num` evenly spaced samples, calculated over the interval ``start`, `stop``.
matrixColumnToArray(Array2d a, int column)
Get matrix column. return Array
matrixDeterminant()
Matrix determinant return determinant
matrixDivideColumns(Array2d a, )
Divide all the columns by an Array
matrixDot(Array2d a, )
Multiply two matrix
matrixIdentity(int row, int column)
Generate identity matrix
matrixInverse()
Matrix inverse or pseudoinverse return inverse(A) if A is square, pseudoinverse otherwise.
matrixMultiplyColumns(Array2d a, )
Multiply all the columns by an Array
matrixNormOne()
One norm return maximum column sum.
matrixNormTwo()
Two norm return maximum singular value.
matrixPseudoInverse(Array2d matrix)
Pseudo inverse matrix using Moore–Penrose return inverse(A) if A is square, pseudoinverse otherwise.
matrixQR() QR
Generate a QR decomposition of the matrix
matrixRank() int
Matrix rank return rank, obtained from SVD.
matrixSolve(Array2d a, )
Solve A*X = B
matrixSub(Array2d a, int i0, int i1, int j0, int j1)
generate a submatrix from a given interval
matrixSubFromArray(Array2d a, Array rows, int col0, int col1)
Get a submatrix where each element of `rows` array represent a column on current matrix.
matrixSumColumns()
Sum the all columns of the array
matrixTranspose()
Matrix transpose. return A'
matrixVander(Array x, {int? N, bool increasing = false})
Generate a Vandermonde matrix. The columns of the output matrix are powers of the input vector. The order of the powers is determined by the `increasing` boolean argument. Specifically, when `increasing` is False, the `i`-th output column is the input vector raised element-wise to the power of `N - i - 1`. Such a matrix with a geometric progression in each row is named for Alexandre- Theophile Vandermonde.
mean()
Return the mean of all elements of the array
median()
Return the median of an array
mode()
Return the mode of all elements of the array
ones(int num)
Return a new array of given shape and type, filled with ones.
parabolic(Array y, int x) List
Quadratic interpolation for estimating the true position of an inter-sample maximum when nearby samples are known.
randomArray(int n)
Generates an Array with n elements containing non-negative random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive.
randomArray2d(int rows, int columns)
Generates an Array with n elements containing non-negative random floating point value uniformly distributed in the range from 0.0, inclusive, to 1.0, exclusive.
randomArrayComplex(int n)
Generates an ArrayComplex with n elements containing non-negative random floating point value uniformly distributed complex numbers in the range from 0.0, inclusive, to 1.0, exclusive.
simpsArray(Array y, { x, int dx = 1, Even even = Even.last})
Integrate y(x) using samples along the given axis and the composite Simpson's rule. If x is None, spacing of dx is assumed. If there are an even number of samples, N, then there are an odd number of intervals (N-1), but Simpson's rule requires an even number of intervals. The parameter 'even' controls how this is handled.
simpsFunction(double a, double b, int n, )
Compute the numerical integration of f() using the Simpson's rule.
sinc()
compute nomilized sinc function of x
sinh()
Compute the hyperbolic sine of a number.
standardDeviation()
Return the standard deviation of sample array
timeit(Function function)
Return the time necessary to compute a function.
trapzArray(Array y, { x, int dx = 1})
Compute the numerical integration of an Array using the trapezoidal rule.
trapzFunction(double a, double b, int n, )
Compute the numerical integration of f() using the trapezoidal rule.
truncate(double val, int fractionDigits)
Truncate the decimal part of a double number. This function is very useful for compere two double numbers.
variance()
Return the variance of the array
zeros(int num)
Return a new array of given shape and type, filled with zeros.