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. [...]

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
Avogadro → const double
NA
bar → const double
1e5
barrel → const double
bbl
bbl → const double
for oil
42 * gallonUS
blob → const double
lbf*s**2/in (added in 1.0.0)
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
angle in rad
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
    Avogadro constant
    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
    lbf*s**2/foot (added in 1.0.0)
    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}) Array
    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. [...]
    array2dTruncateEachElement(Array2d a, int fractionDigits, {bool returnNewArray = false}) → dynamic
    Truncate all the elements of the array [...]
    arrayArgMax(Array a) → int
    Return the index of the first greater element of the array [...]
    arrayComplexAbs(ArrayComplex a) Array
    Absolute value of all elements of the current array [...]
    arrayComplexConcat(ArrayComplex a, ArrayComplex b) ArrayComplex
    Concatenate X in to the current array [...]
    arrayComplexConjugate(ArrayComplex a) ArrayComplex
    Conjugate of all elements of the current array [...]
    arrayComplexCos(ArrayComplex a) ArrayComplex
    Compute the cos for each element of the array [...]
    arrayComplexDivisionToScalar(ArrayComplex a, num b) ArrayComplex
    Divide all the array elements for a number [...]
    arrayComplexMultiplyToScalar(ArrayComplex a, num b) ArrayComplex
    Multiply all the array elements for a number [...]
    arrayComplexPadStart(ArrayComplex a, int pad) ArrayComplex
    Add zeros at begging of the array [...]
    arrayComplexReverse(ArrayComplex a) ArrayComplex
    Return the array complex reversed [...]
    arrayComplexSum(ArrayComplex a, ArrayComplex b) ArrayComplex
    Sum two arrays [...]
    arrayComplexTruncateEachElement(ArrayComplex a, int fractionDigits, {bool returnNewArray = false}) → dynamic
    Truncate all the numbers of the array [...]
    arrayComplexTruncateLast(ArrayComplex a) ArrayComplex
    Return a Array without the last element [...]
    arrayConcat(Array a, Array b) Array
    Concatenate a and b and return [...]
    arrayCos(Array a) Array
    Compute the cos for each element of the array [...]
    arrayCumSum(Array a) Array
    Return the array with accumulative sum of all elements of the array [...]
    arrayDiff(Array a) Array
    Calculate the n-th discrete difference of a Array using the formula out[i] = a[i+1] - a[i]. [...]
    arrayDivisionToScalar(Array a, num b) Array
    Divide all the array elements for a number [...]
    arrayLog(Array a) Array
    Compute the natural logarithm for each element of the array [...]
    arrayLog10(Array a) Array
    Compute the log10 for each element of the array [...]
    arrayMax(Array a) → double
    Return the greater element in the array [...]
    arrayMin(Array a) → double
    Return the sum of all elements of the array [...]
    arrayMultiplyToScalar(Array a, num b) Array
    Multiply all the array elements for a number [...]
    arrayPadStart(Array a, int pad) Array
    Add zeros at begging of the array [...]
    arrayPow(Array a, double exponent) Array
    Compute the square root for each element of the array [...]
    arrayReshapeToMatrix(Array a, int order) Array2d
    Reshape a Array to a matrix with a given order [...]
    arrayReverse(Array a) Array
    Return the array reversed [...]
    arraySin(Array a) Array
    Compute the sin for each element of the array [...]
    arraySinc(Array a) Array
    Compute the sinc for each element of the array [...]
    arraySqrt(Array a) Array
    Compute the square root for each element of the array [...]
    arraySubToScalar(Array a, num b) Array
    Multiply all the array elements for a number [...]
    arraySum(Array a) → double
    Return the sum of all elements of the array [...]
    arrayToColumnMatrix(Array a) Array2d
    Convert a Array to a matrix with one column [...]
    arrayToComplexArray(Array a) ArrayComplex
    Convert a Array to ArrayComplex [...]
    arrayTruncateEachElement(Array a, int fractionDigits, {bool returnNewArray = false}) → dynamic
    Truncate all the numbers of the array [...]
    arrayTruncateLast(Array a) Array
    Return a Array without the last element [...]
    atan2Fast(double y, double x) → double
    Two arguments arctangent function [...]
    atanFast(double xa, [double xb = 0.0, bool leftPlane = false]) → double
    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(Array y, Array x, int dx) → void
    complexAbs(Complex a) → double
    Return a double that represent the absolute value of a complex number [...]
    complexConjugate(Complex a) Complex
    Return the conjugate of a complex number [...]
    complexCos(Complex a) Complex
    Compute the cosine of this complex number. [...]
    complexDivideScalar(Complex a, num b) Complex
    Divide real part and imaginary for a double number [...]
    complexMultiplyScalar(Complex a, num b) Complex
    Multiply real part and imaginary for a double number [...]
    complexTruncate(Complex val, int fractionDigits) Complex
    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) → double
    Returns the first argument with the sign of the second argument. A NaN sign argument is treated as positive. [...]
    cosh(double x) → double
    Compute the hyperbolic cosine of a number.
    cumIntegration(Array y, {Array x, int dx = 1, double initial}) Array
    Compute the numerical accumulative integration of a Array using the trapezoidal rule. [...]
    differentiateArray(Array y, Array x) Array
    Compute the numerical derivative of two arrays [...]
    differentiateFunction(double x, Function f, {double dx = 0.00000001}) → double
    Compute the numerical derivative of a function in a certain point [...]
    expFast(double x, [double extra = 0.0, List<double> hiPrec]) → double
    Internal helper method for exponential function. [...]
    expm1(double x, {List<double> hiPrecOut}) → double
    Compute exp(x) - 1.
    highestOneBit(int n) → int
    Reurn the highest one bit of a int n : input number References [...]
    hypotenuse(double x, double y) → double
    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. [...]
    linspace(double start, double stop, {int num = 50, bool endpoint = true}) Array
    Return evenly spaced numbers over a specified interval. Returns num evenly spaced samples, calculated over the interval `start`, `stop`. [...]
    matrixColumnToArray(Array2d a, int column) Array
    Get matrix column. return Array [...]
    matrixDeterminant(Array2d a) → double
    Matrix determinant return determinant
    matrixDivideColumns(Array2d a, Array b) Array2d
    Divide all the columns by a Array [...]
    matrixDot(Array2d a, Array2d b) Array2d
    Multiply two matrix [...]
    matrixIdentity(int row, int column) Array2d
    Generate identity matrix [...]
    matrixInverse(Array2d a) Array2d
    Matrix inverse or pseudoinverse return inverse(A) if A is square, pseudoinverse otherwise. [...]
    matrixMultiplyColumns(Array2d a, Array b) Array2d
    Multiply all the columns by a Array [...]
    matrixNormOne(Array2d a) → double
    One norm return maximum column sum. [...]
    matrixNormTwo(Array2d a) → double
    Two norm return maximum singular value. [...]
    matrixQR(Array2d a) QR
    Generate a QR decomposition of the matrix [...]
    matrixRank(Array2d a) → int
    Matrix rank return rank, obtained from SVD.
    matrixSolve(Array2d a, Array2d b) Array2d
    Solve A*X = B [...]
    matrixSub(Array2d a, int i0, int i1, int j0, int j1) Array2d
    generate a submatrix from a given interval [...]
    matrixSubFromArray(Array2d a, Array rows, int col0, int col1) Array2d
    Get a submatrix where each element of rows array represent a column on current matrix. [...]
    matrixSumColumns(Array2d a) Array
    Sum the all columns of the array [...]
    matrixTranspose(Array2d a) Array2d
    Matrix transpose. return A' [...]
    matrixVander(Array x, {int N, bool increasing = false}) Array2d
    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(Array a) → double
    Return the mean of all elements of the array [...]
    median(Array a) → double
    Return the median of a array [...]
    mode(Array a) → double
    Return the mode of all elements of the array [...]
    ones(int num) Array
    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) Array
    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) Array2d
    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) ArrayComplex
    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, {Array x, int dx = 1, Even even = Even.last}) → double
    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, Function f) → double
    Compute the numerical integration of f() using the Simpson's rule. [...]
    sinc(double x) → double
    compute nomilized sinc function of x
    sinh(double x) → double
    Compute the hyperbolic sine of a number.
    standardDeviation(Array a) → double
    Return the standard deviation of sample array [...]
    timeit(Function function) → Duration
    Return the time necessary to compute a function. [...]
    trapzArray(Array y, {Array x, int dx = 1}) → double
    Compute the numerical integration of a Array using the trapezoidal rule. [...]
    trapzFunction(double a, double b, int n, Function f) → double
    Compute the numerical integration of f() using the trapezoidal rule. [...]
    truncate(double val, int fractionDigits) → double
    Truncate the decimal part of a double number. This function is very useful for compere two double numbers. [...]
    variance(Array a) → double
    Return the variance of the array [...]
    zeros(int num) Array
    Return a new array of given shape and type, filled with zeros. [...]

    Enums

    Even