Statistics and data
mean(a, b, …)
Section titled “mean(a, b, …)”The mean of all the numbers given.
mean([1; 2; 3; 6]) = 3median(a, b, …)
Section titled “median(a, b, …)”The median of all the numbers given.
median([1; 2; 3; 6]) = 2.5var(a, b, …)
Section titled “var(a, b, …)”The variance of the numbers as a whole population (dividing by n).
var([1; 2; 3; 6]) = 3.5Var(a, b, …)
Section titled “Var(a, b, …)”The variance of the numbers as a sample (dividing by n − 1).
Var([1; 2; 3; 6]) = 4.667stdev(a, b, …)
Section titled “stdev(a, b, …)”The standard deviation of a whole population.
stdev([1; 2; 3; 6]) = 1.871Stdev(a, b, …)
Section titled “Stdev(a, b, …)”The standard deviation of a sample.
Stdev([1; 2; 3; 6]) = 2.16corr(vx, vy)
Section titled “corr(vx, vy)”The correlation coefficient of the two vectors.
corr([1; 2; 3], [2; 4; 7]) = 0.993slope(vx, vy)
Section titled “slope(vx, vy)”The slope of the least-squares straight line through the points.
slope([1; 2; 3], [2; 4; 7]) = 2.5intercept(vx, vy)
Section titled “intercept(vx, vy)”Where the least-squares straight line crosses x = 0.
intercept([1; 2; 3], [2; 4; 7]) = -0.667linterp(vx, vy, x)
Section titled “linterp(vx, vy, x)”The value at x of the straight lines between the points (vx, vy); beyond the ends, the end line carries on.
linterp([0 m; 2 m], [10 kN; 20 kN], 0.5 m) = 12.5 kNcspline(vx, vy)
Section titled “cspline(vx, vy)”A cubic spline through the points, with cubic ends, for interp.
vx := [0; 1; 2; 3]vy := vx^3interp(cspline(vx, vy), vx, vy, 1.5) = 3.375pspline(vx, vy)
Section titled “pspline(vx, vy)”A cubic spline with parabolic ends, for interp.
vx := [0; 1; 2; 3]vy := [0; 1; 4; 9]interp(pspline(vx, vy), vx, vy, 1.5) = 2.25lspline(vx, vy)
Section titled “lspline(vx, vy)”A cubic spline with straight ends (the natural spline), for interp.
vx := [0; 1; 2; 3]vy := [0; 1; 4; 9]interp(lspline(vx, vy), vx, vy, 1.5) = 2.2interp(vs, vx, vy, x)
Section titled “interp(vs, vx, vy, x)”The value at x of a spline from cspline, pspline or lspline, or of a polynomial from regress.
vx := [0; 1; 2; 3]vy := [1; 3; 5; 7]interp(regress(vx, vy, 1), vx, vy, 10) = 21regress(vx, vy, k)
Section titled “regress(vx, vy, k)”The least-squares polynomial of degree k through the points, for interp.
vx := [0; 1; 2; 3]vy := [1; 2; 5; 10]interp(regress(vx, vy, 2), vx, vy, 4) = 17linfit(vx, vy, F)
Section titled “linfit(vx, vy, F)”The least-squares coefficients of a sum of terms: F(x) returns a vector of the terms.
F(x) := [1; x]linfit([0; 1; 2], [1; 3; 5], F) = [1; 2]dnorm(x, μ, σ)
Section titled “dnorm(x, μ, σ)”The probability density of the normal distribution at x.
dnorm(0, 0, 1) = 0.399pnorm(x, μ, σ)
Section titled “pnorm(x, μ, σ)”The probability that a normal variable is below x.
pnorm(1.96, 0, 1) = 0.975cnorm(x)
Section titled “cnorm(x)”The probability that a standard normal variable is below x.
cnorm(1.645) = 0.95qnorm(p, μ, σ)
Section titled “qnorm(p, μ, σ)”The x below which a normal variable falls with probability p.
qnorm(0.95, 0, 1) = 1.645rnd(x)
Section titled “rnd(x)”A random number between 0 and x, the same at every recalculation.
rnd(1) = 0.731runif(m, a, b)
Section titled “runif(m, a, b)”m random numbers between a and b, as a column.
runif(3, 0, 10) = [7.309; 4.101; 2.077]rnorm(m, μ, σ)
Section titled “rnorm(m, μ, σ)”m random numbers from the normal distribution, as a column.
rnorm(3, 0, 1) = [1.562; -0.608; -1.091]hist(intervals, data)
Section titled “hist(intervals, data)”How many of the data fall in each interval: intervals is a vector of their ends, or the number of equal intervals.
hist([0; 1; 2; 3], [0.5; 1.5; 1.7; 2.2]) = [1; 2; 1]histogram(intervals, data)
Section titled “histogram(intervals, data)”As hist, beside the middle of each interval: a column of middles, then one of counts.
histogram([0; 1; 2; 3], [0.5; 1.5; 1.7; 2.2]) = [0.5, 1; 1.5, 2; 2.5, 1]fft(v)
Section titled “fft(v)”The Fourier transform of the real vector v (2ⁿ elements), its first half and the middle, scaled by 1/√n.
fft([1; 0; 0; 0]) = [0.5; 0.5; 0.5]ifft(c)
Section titled “ifft(c)”The inverse of fft: the real vector whose transform is c.
ifft(fft([1; 2; 3; 4])) = [1; 2; 3; 4]FFT(v)
Section titled “FFT(v)”As fft, scaled by 1/n and with the opposite sign in the exponent.
FFT([1; 0; 0; 0]) = [0.25; 0.25; 0.25]IFFT(c)
Section titled “IFFT(c)”The inverse of FFT.
IFFT(FFT([1; 2; 3; 4])) = [1; 2; 3; 4]cfft(A)
Section titled “cfft(A)”The Fourier transform of a complex vector or matrix of any size, scaled by 1/√n.
cfft([1; 1i]) = [0.707 + 0.707i; 0.707 - 0.707i]icfft(A)
Section titled “icfft(A)”The inverse of cfft.
icfft(cfft([1; 1i])) = [1; 1i]CFFT(A)
Section titled “CFFT(A)”As cfft, scaled by 1/n and with the opposite sign in the exponent.
CFFT([1; 1i]) = [0.5 + 0.5i; 0.5 - 0.5i]ICFFT(A)
Section titled “ICFFT(A)”The inverse of CFFT.
ICFFT(CFFT([1; 1i])) = [1; 1i]READPRN("file")
Section titled “READPRN("file")”The numbers in a text file, in columns separated by spaces, tabs or commas; lines that aren’t numbers are skipped.
READCSV("file")
Section titled “READCSV("file")”A comma-separated file as a matrix, numbers and text kept apart.
READFILE("file", type)
Section titled “READFILE("file", type)”A data file, type being “delimited” (spaces, tabs or commas) or “csv”.
READEXCEL("file"[, "Sheet1!A1:C10"])
Section titled “READEXCEL("file"[, "Sheet1!A1:C10"])”The cells of an Excel workbook (.xlsx or .xls), all of its first sheet or a range; in the desktop app.