# numdart library Null safety

## 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 >= sigma >= ... >= 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. [...]

## Constants

acos → const double Function(num x)
`math.acos`
acre → const double
`43560 * foot * foot`
alpha → const double
fine-structure constant
`7.2973525693e-3`
angstrom → const double
`1e-10`
arcmin → const double
`degree / 60`
arcminute → const double
`arcmin`
arcsec → const double
`arcmin / 60`
arcsecond → const double
`arcsec`
asin → const double Function(num x)
`math.asin`
astronomicalUnit → const double
`au`
atan2 → const double Function(num a, num b)
`math.atan2`
atm → const int
`101325`
atmosphere → const int
`atm`
atomicMass → const double
`u`
atto → const double
`1e-18`
au → const double
`149597870700.0`
`NA`
bar → const double
`1e5`
barrel → const double
`bbl`
bbl → const double
for oil
`42 * gallonUS`
blob → const double
`pound * g / 0.0254`
Boltzmann → const double
`k`
Btu → const double
`pound * degreeFahrenheit * calorieIT / gram`
BtuIT → const double
`Btu`
BtuTh → const double
`pound * degreeFahrenheit * calorieTh / gram`
c → const int
physical constants ## Reference: [...]
`299792458`
calorie → const double
`4.184`
calorieIT → const double
`4.1868`
calorieTh → const double
`calorie`
carat → const double
`200e-6`
centi → const double
`1e-2`
cos → const double Function(num radians)
`math.cos`
day → const double
`24 * hour`
deci → const double
`1e-1`
degree → const double
`pi / 180`
degreeFahrenheit → const double
only for differences
`1 / 1.8`
deka → const double
`1e1`
dyn → const double
force in newton
`1e-5`
dyne → const double
`dyn`
e → const double
Base of the natural logarithms. Typically written as "e".
`math.e`
eC → const double
elementary charge
`1.602176634e-19`
electron_volt → const double
`eV`
electronMass → const double
`mE`
elementaryCharge → const double
`eC`
epsilon0 → const double
`1 / (mu0 * c * c)`
erg → const double
`1e-7`
eV → const double
energy in joule [...]
`elementaryCharge`
exa → const double
`1e18`
exbi → const double
`1.152921504606847e18`
exp → const double Function(num x)
`math.exp`
femto → const double
`1e-15`
fermi → const double
`1e-15`
fineStructure → const double
`alpha`
fluid_ounce_imp → const double
`gallonImp / 160`
fluidOunce → const double
pint = gallon_US / 8
`gallonUS / 128`
fluidOunceUS → const double
`fluidOunce`
`12 * inch`
G → const double
Newtonian constant of gravitation
`6.67430e-11`
g → const double
Standard acceleration of gravity
`9.80665`
gallon → const double
`231 * inch * inch * inch`
gallonImp → const double
UK
`4.54609e-3`
gallonUS → const double
`gallon`
gasConstant → const double
`R`
gibi → const int
`1073741824`
giga → const double
`1e9`
golden → const double
`(1 + 2.23606797749979) / 2`
goldenRatio → const double
`golden`
grain → const double
`64.79891e-6`
gram → const double
mass in kg [...]
`1e-3`
gravitationalConstant → const double
`G`
h → const double
Planck constant
`6.62607015e-34`
hbar → const double
`h / (2 * pi)`
hectare → const double
`1e4`
hecto → const double
`1e2`
horsepower → const double
`hp`
hour → const double
`60 * minute`
hp → const double
power in watt
`550 * foot * pound * g`
inch → const double
length in meter
`0.0254`
JulianYear → const double
`365.25 * day`
k → const double
Boltzmann constant
`1.380649e23`
kgf → const double
• 1 kg
• `g`
kibi → const int
binary prefixes [...]
`1024`
kilo → const double
`1e3`
kilogram_force → const double
`kgf`
kmh → const double
speed in meter per second
`1e3 / hour`
knot → const double
`nauticalMile / hour`
lb → const double
avoirdupois
`7000 * grain`
lbf → const double
`pound * g`
lightYear → const double
`JulianYear * c`
liter → const double
`litre`
litre → const double
volume in meter**3
`1e-3`
ln2 → const double
`math.ln2`
ln10 → const double
`math.ln10`
log → const double Function(num x)
`math.log`
log2e → const double
`math.log2e`
log10e → const double
`math.log10e`
longTon → const double
`2240 * pound`
mach → const double
`340.5`
max → const T Function<T extends num>(T a, T b)
`math.max`
mE → const double
electron mass
`9.1093837015e-31`
mebi → const int
`1048576`
mega → const double
`1e6`
metricTon → const double
`1e3`
micro → const double
`1e-6`
micron → const double
`1e-6`
mil → const double
`inch / 1000`
mile → const double
`1760 * yard`
milli → const double
`1e-3`
min → const T Function<T extends num>(T a, T b)
`math.min`
minute → const double
time in second [...]
`60.0`
mmHg → const double
`torr`
mN → const double
neutron mass
`1.67492749804e-27`
mP → const double
proton mass
`1.67262192369e-27`
mph → const double
`mile / hour`
mU → const double
atomic mass constant
`1.66053906660e-27`
mu0 → const double
`4e-7 * pi`
NA → const double
`6.02214076e23`
nano → const double
`1e-9`
nauticalMile → const double
`1852.0`
neutronMass → const double
`mN`
ounce → const double
`oz`
oz → const double
`pound / 16`
parsec → const double
`au / arcsec`
pebi → const int
`1125899906842624`
peta → const double
`1e15`
pi → const double
The PI constant.
`math.pi`
pico → const double
`1e-12`
Planck → const double
`h`
point → const double
`pt`
pound → const double
`lb`
poundForce → const double
`lbf`
pow → const num Function(num x, num exponent)
`math.pow`
protonMass → const double
`mP`
psi → const double
`pound * g / (inch * inch)`
pt → const double
typography
`inch / 72`
R → const double
molar gas constant
`8.314462618`
Rydberg → const double
Rydberg constant
`10973731.568160`
shortTon → const double
`2000 * pound`
sigma → const double
Stefan-Boltzmann constant
`5.670374419e-8`
sin → const double Function(num radians)
`math.sin`
slinch → const double
`blob`
slug → const double
`blob / 12`
speedOfLight → const int
`c`
speedOfSound → const double
`mach`
sqrt → const double Function(num x)
`math.sqrt`
sqrt1_2 → const double
`math.sqrt1_2`
sqrt2 → const double
`math.sqrt2`
Stefan_Boltzmann → const double
`sigma`
stone → const double
`14 * pound`
surveyFoot → const double
`1200.0 / 3937`
surveyMile → const double
`5280 * surveyFoot`
tan → const double Function(num radians)
`math.tan`
tebi → const int
`1099511627776`
tera → const double
`1e12`
ton_TNT → const double
`1e9 * calorieTh`
torr → const double
`atm / 760`
troyOunce → const double
`480 * grain`
troyPound → const double
`12 * troyOunce`
u → const double
`mU`
week → const double
`7 * day`
Wien → const double
Wien wavelength displacement law constant
`2.897771955e-3`
yard → const double
`3 * foot`
year → const double
`365 * day`
yobi → const double
`1.208925819614629e24`
yotta → const double
SI prefixes [...]
`1e24`
zebi → const double
`1.180591620717411e21`
zepto → const double
`1e-21`
zero_Celsius → const double
temperature in kelvin
`273.15`
zetta → const double
`1e21`

## Functions

arange({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. [...]
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 a 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 a 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 a 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 a Array to a matrix with one column [...]
arrayToComplexArray()
Convert a Array to ArrayComplex [...]
arrayTruncateEachElement(Array a, int fractionDigits, {bool returnNewArray = false}) → dynamic
Truncate all the numbers of the array [...]
arrayTruncateLast()
Return a 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 a 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 a 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.
cumIntegration(Array y, { x, int dx = 1, initial})
Compute the numerical accumulative integration of a Array using the trapezoidal rule. [...]
differentiateArray(Array y, )
Compute the numerical derivative of two arrays [...]
differentiateFunction(double x, Function f, {double dx = 1e-8})
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 a int `n` : input number References [...]
hypotenuse(double x, )
Calculate the hypotenuse with pythagorean theorem [...]
intToBool(int a) bool
Convert a 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 a 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 a 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 a 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 a 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 a 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 a 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 a 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. [...]

Even