A list of features to add to mathflow - based on numpy, mathjs and more.
-
add(a, b, ...): Adds all numbers. -
sub(a, b): Subtracts the second number from the first. -
mul(a, b, ...): Multiplies all numbers. -
div(a, b): Divides the first number by the second. -
mod(a, b): Returns the remainder of division of two numbers. -
abs(x): Returns the absolute value of a number. -
ceil(x): Rounds a number up to the nearest integer. -
floor(x): Rounds a number down to the nearest integer. -
sign(x): Returns the sign of a number:-1,0, or1. -
sqrt(x): Returns the square root of a number. -
pow(x, y): Raisesxto the power ofy. -
cbrt(x): Computes the cube root of a number. -
root(x, n): Computes the n-th root of a number. -
trunc(x): Removes the fractional part of a number, leaving the integer part. -
round(x, n?): Rounds a number to the nearest integer or tondecimal places. -
gcd(a, b, ...): Calculates the greatest common divisor of all numbers. -
lcm(a, b, ...): Computes the least common multiple of all numbers. -
rand(min?, max?): Generates a random number within a specified range. -
randi(min, max): Generates a random integer between the specified min and max values. -
complex(re, im): Creates a complex number with real and imaginary parts. -
bignumber(x): Creates a big number with arbitrary precision. -
fraction(x): Creates a fraction from a number or a string. -
clamp(x, min, max): Clamps a value between a minimum and maximum value. -
modExp(base, exponent, modulus): Computes the modular exponentiation of a number. -
fix(x): Rounds towards zero, removing the fractional part. -
precision(x, n): Adjusts a number tonsignificant digits. -
sigFigs(x, n): Rounds a number tonsignificant figures. -
roundToNearest(x, step): Roundsxto the nearest multiple ofstep.
-
matrix(data): Creates a matrix from an array or other data format. -
identity(n): Creates an identity matrix of sizen. -
transpose(matrix): Returns the transpose of a matrix. -
det(matrix): Calculates the determinant of a matrix. -
inv(matrix): Computes the inverse of a matrix. -
concat(a, b, dim?): Concatenates two arrays or matrices along the specified dimension. -
size(matrix): Returns the size (dimensions) of a matrix. -
reshape(matrix, sizes): Reshapes a matrix to the specified sizes. -
flatten(matrix): Flattens a multi-dimensional matrix into a single dimension. -
dot(a, b): Computes the dot product of two vectors or matrices. -
cross(a, b): Calculates the cross product of two 3D vectors. -
subset(matrix, index, replacement?): Retrieves or sets a subset of a matrix. -
diag(matrix, k?): Extracts or creates a diagonal matrix. -
norm(matrix, p?): Computes the norm of a matrix or vector. -
trace(matrix): Computes the trace (sum of diagonal elements) of a matrix. -
zeros(m, n): Creates a matrix filled with zeros of specified dimensions. -
ones(m, n): Creates a matrix filled with ones of specified dimensions. -
range(start, end, step?): Generates an array of numbers fromstarttoendwith a specified step. -
sort(matrix, compare?): Sorts the elements of a matrix according to a compare function. -
magnitude(vector): Computes the magnitude (length) of a vector. -
normalize(vector): Normalizes a vector to a unit length.
-
simplify(expr, rules?): Simplifies an algebraic expression using optional rules. -
solve(equation, variable?): Solves an equation for a specified variable. -
expand(expr): Expands an algebraic expression. -
evaluate(expr, scope?): Evaluates an expression given optional variable values. -
derivative(expr, variable): Computes the derivative of an expression with respect to a variable. -
parse(expr): Parses a string into an expression tree. -
rationalize(expr, scope?): Converts an expression into a rational fraction form. -
binomialCoefficient(n, k): Computes the binomial coefficient, representing combinations ofnitems takenkat a time.
-
mean(arr): Computes the mean (average) of an array of numbers. -
median(arr): Finds the median value in an array of numbers. -
mode(arr): Identifies the mode (most frequent value) in an array. -
variance(arr, normalization?): Calculates the variance of a data set. -
std(arr, normalization?): Computes the standard deviation of a data set. -
sum(arr): Computes the sum of all elements in an array. -
prod(arr): Calculates the product of all elements in an array. -
min(arr): Finds the minimum value in an array. -
max(arr): Finds the maximum value in an array. -
quantileSeq(arr, prob, sorted?): Computes the specified quantile of a sorted array. -
mad(arr): Computes the mean absolute deviation of an array. -
entropy(arr): Calculates the entropy of a data set. -
covariance(arr1, arr2): Computes the covariance between two data sets. -
corr(arr1, arr2): Calculates the correlation coefficient between two data sets. -
weightedMean(values, weights): Computes the weighted mean of values given their weights. -
geometricMean(values): Calculates the geometric mean of a set of values. -
harmonicMean(values): Computes the harmonic mean of a set of values. -
skewness(arr): Measures the skewness of a data set, indicating asymmetry. -
kurtosis(arr): Measures the kurtosis of a data set, indicating the tails' heaviness.
-
combinations(n, k): Calculates the number of ways to choosekitems fromn. -
permutations(n, k): Computes the number of ways to arrangekitems out ofn. -
random(min?, max?): Generates a random number within a range. -
randomInt(min, max): Generates a random integer between specified bounds. -
pickRandom(arr): Randomly selects an element from an array. -
shuffle(arr): Randomly shuffles the elements of an array. -
factorial(n): Computes the factorial of a number. -
stirlingApproximation(n): Approximates the factorial ofnusing Stirling's formula. -
isPrime(n): Checks if a number is a prime number. -
primeFactors(n): Returns the prime factors of a number. -
fibonacci(n): Calculates the n-th Fibonacci number. -
birthdayProblem(p, n): Computes the probability of a shared birthday in a group ofn.
-
deg(x): Converts the angle from radians to degrees. -
rad(x): Converts the angle from degrees to radians. -
sin(x): Computes the sine of an angle (in radians). -
cos(x): Computes the cosine of an angle (in radians). -
tan(x): Computes the tangent of an angle (in radians). -
sind(x): Computes the sine of an angle (in degrees). -
cosd(x): Computes the cosine of an angle (in degrees). -
tand(x): Computes the tangent of an angle (in degrees). -
sec(x): Computes the secant of an angle. -
csc(x): Computes the cosecant of an angle. -
cot(x): Computes the cotangent of an angle. -
asin(x): Computes the inverse sine of a value. -
acos(x): Computes the inverse cosine of a value. -
atan(x): Computes the inverse tangent of a value. -
atan2(y, x): Computes the angle from the x-axis to a point (x,y). -
sinh(x): Computes the hyperbolic sine of a value. -
cosh(x): Computes the hyperbolic cosine of a value. -
tanh(x): Computes the hyperbolic tangent of a value. -
asinh(x): Computes the inverse hyperbolic sine of a value. -
acosh(x): Computes the inverse hyperbolic cosine of a value. -
atanh(x): Computes the inverse hyperbolic tangent of a value. -
hypot(a, b, ...): Computes the square root of the sum of squares (Euclidean norm). -
versin(x): Computes the versine of an angle (in radians). -
versind(x): Computes the versine of an angle (in degrees). -
coversin(x): Computes the coversine of an angle (in radians). -
coversin(x): Computes the coversine of an angle (in degrees).
-
derivative(expr, variable): Calculates the derivative of an expression. -
integrate(expr, variable): Computes the integral of an expression. -
numericDerivative(func, x): Numerically computes the derivative at a point.
-
complex(re, im): Creates a complex number from real and imaginary parts. -
re(complex): Extracts the real part of a complex number. -
im(complex): Extracts the imaginary part of a complex number. -
arg(complex): Computes the argument (phase angle) of a complex number. -
conj(complex): Returns the complex conjugate of a complex number. -
iabs(complex): Computes the magnitude (absolute value) of a complex number. -
iadd(complex1, complex2): Adds two complex numbers. -
isub(complex1, complex2): Subtracts the second complex number from the first. -
imul(complex1, complex2): Multiplies two complex numbers. -
idiv(complex1, complex2): Divides the first complex number by the second. -
isqrt(complex): Computes the square root of a complex number. -
iexp(complex): Calculates the exponential of a complex number. -
ilog(complex): Computes the natural logarithm of a complex number. -
ipow(complex, exponent): Raises a complex number to a specified power. -
phase(complex): Returns the phase angle (argument) of a complex number.
-
gamma(x): Computes the gamma function ofx, an extension of the factorial. -
sinc(x): Computes the sinc function, defined assin(x)/x. -
heaviside(x): Computes the Heaviside step function. -
erf(x): Computes the error function ofx. -
beta(a, b): Calculates the beta function. -
lambertW(x): Computes the Lambert W function. -
digamma(x): Calculates the digamma function, the logarithmic derivative of the gamma function. -
zeta(s): Computes the Riemann zeta function ofs. -
gammaIncomplete(a, x): Computes the incomplete gamma function.
-
exp(x): Computeseraised to the power ofx. -
ln(x): Computes the natural logarithm ofx. -
log(x, base): Computes the logarithm ofxwith a specifiedbase. -
log10(x): Computes the base-10 logarithm ofx. -
log2(x): Computes the base-2 logarithm ofx. -
pow10(exp): Computes10raised to the power ofexp. -
pow2(exp): Computes2raised to the power ofexp. -
expm1(x): Computese^x - [ ] 1, useful for small values ofxto reduce numerical error. -
log1p(x): Computeslog(1 + x), improving accuracy for smallx.
-
dotProduct(a, b): Computes the dot product of two vectors. -
crossProduct(a, b): Computes the cross product of two 3D vectors. -
projection(u, v): Projects vectoruonto vectorv. -
angleBetween(u, v): Calculates the angle between two vectors. -
distance(p1, p2): Computes the Euclidean distance between two points. -
reflect(point, line): Reflects a point over a line. -
intersect(line1, line2): Finds the intersection point of two lines.
-
fft(arr): Computes the Fast Fourier Transform of an array. -
ifft(arr): Computes the inverse Fast Fourier Transform. -
dft(arr): Calculates the Discrete Fourier Transform of an array. -
idft(arr): Calculates the inverse Discrete Fourier Transform. -
convolve(arr1, arr2): Computes the convolution of two sequences. -
correlate(arr1, arr2): Computes the cross-correlation of two sequences.
-
futureValue(principal, rate, periods): Computes the future value of an investment. -
presentValue(futureValue, rate, periods): Computes the present value given the future value. -
compoundInterest(principal, rate, timesCompounded, periods): Calculates compound interest over time. -
annuityPayment(rate, periods, presentValue): Computes the payment amount of an annuity.
-
lerp(a, b, t): Performs linear interpolation between two valuesaandbbased ont. -
hermite(p0, p1, t): Performs Hermite interpolation. -
lagrange(points, x): Uses Lagrange polynomials to interpolate the value atx. -
spline(points, x): Computes spline interpolation atx.
-
totient(n): Computes Euler’s totient function ofn. -
mobius(n): Computes the Möbius function ofn. -
isPerfectSquare(n): Checks whether a number is a perfect square. -
divisors(n): Lists all divisors of a numbern.