EQS

EQS reference

The help that EQS 0.2.1 shows inside the program, on one page: the tutorial, every function with its parameters and an example, the statements and settings of the language, and every menu command. In EQS the same text appears when you hover a function name, in Help → Reference, and in Help → Tutorial.

Tutorial (14 steps) Functions (377) Statements and settings Menu commands

Tutorial

Each step is one idea and a model to try: in EQS, Help → Tutorial loads the same model into the editor; press F2 to solve it.

1. Equations in any order

Type equations, one per line, in whatever order you think of them. EQS works out which ones must be solved together and solves them. Names are case-insensitive. Two slashes start a comment: // like this. Load this step, press F2, and look at the Solution tab.

// A rectangle with a known area and aspect ratio
area = 12
w = 1.5 * h
area = w * h
perimeter = 2 * (w + h)

2. Units are checked, not converted

Write the unit after a number: m = 0.5 kg/s. The unit of a computed variable goes in brackets after its equation: Q = m*cp*dT [kW]. EQS then checks every equation: if the two sides disagree you get a warning with the line number, and the solve still runs. A bare number takes the unit of what it is added to.

m = 0.5 kg/s
cp = 4.18 kJ/(kg*K)
dT = 30 K
Q = m * cp * dT   [kW]
bad = Q + m       [kW]   // this line gets a warning

3. Guesses and bounds

Nonlinear equations start from a guess of 1 unless you say otherwise. A guess line sets the start value, and a comparison line such as 0.005 <= f <= 0.1 keeps a variable inside bounds. EQS also improves the default guesses on its own, so you rarely need many.

// Colebrook: an implicit equation for the friction factor
Re = 500000
eps_D = 0.0015
1 / sqrt(f) = -2 * log10(eps_D / 3.7 + 2.51 / (Re * sqrt(f)))
guess f = 0.02
0.005 <= f <= 0.1

4. Properties from CoolProp

A state line names one state of a fluid: the fluid first, then two inputs as name=value. Its properties are then members: vap.h, vap.s, vap.T. For one property alone, the property functions (enthalpy, density …) take the same arguments. The units line sets the units of every property; the default is SI, °C, kPa, kJ. Type 'enth' in the editor and the autocomplete shows the signatures.

units SI °C kPa kJ
P = 800
// saturated R134a vapour: one state, its properties as members
vap = state(R134a, P=P, x=1)
h_g = vap.h
s_g = vap.s
T_sat = vap.T
// one property: the function form
rho = density(Water, T=25, P=101.325)

5. A cycle, and its diagram

State points named T_1 s_1, T_2 s_2 ... or T[1] s[1] are found automatically by the Property plot tab: draw the T-s diagram of this refrigeration cycle after solving it.

units SI °C kPa kJ
P_evap = 140 ; P_cond = 800
h[1] = enthalpy(R134a, P=P_evap, x=1) ; s[1] = entropy(R134a, P=P_evap, x=1) ; T[1] = t_sat(R134a, P=P_evap)
s[2] = s[1] ; h[2] = enthalpy(R134a, P=P_cond, s=s[2]) ; T[2] = temperature(R134a, P=P_cond, s=s[2])
h[3] = enthalpy(R134a, P=P_cond, x=0) ; s[3] = entropy(R134a, P=P_cond, x=0) ; T[3] = t_sat(R134a, P=P_cond)
h[4] = h[3] ; s[4] = entropy(R134a, P=P_evap, h=h[4]) ; T[4] = T[1]
COP = (h[1] - h[4]) / (h[2] - h[1])

6. Parametric table

Any variable set as 'name = number' can be swept. Open the Parametric table tab, vary P_cond from 600 to 1200 in 7 rows, run, and plot COP against it. The same study can live in the file: sweep P_cond from 600 to 1200 step 100, then plot COP vs P_cond.

7. Optimise and uncertainty

The same 'name = number' variables can be optimised or carry an uncertainty. Either use the Optimise / Uncertainty tab, or put the request in the file (maximize … over …, uncertainty of … given …) so it runs after every solve.

x = 0
y = 0
f = 10 - (x - 1)^2 - 2 * (y + 2)^2
maximize f over x in -5..5, y in -5..5
uncertainty of f given x ± 0.1, y ± 0.1

8. Functions, loops

Write your own functions: the lines of a function run in order, = assigns, return gives the result, and if … then … else … end and repeat … until choose and loop. A function with -> (…) gives several results, called as (t, d) = stats(3, 8). A for loop writes many equations at once, with arrays, and sum(… for …) adds them.

function area(w, h)
    return w * h
end
function stats(a, b) -> (total, diff)
    total = a + b
    if a > b then
        diff = a - b
    else
        diff = b - a
    end
end
A = area(3, 4)
(t, d) = stats(3, 8)
N = 5
for i in 1..N
    sq[i] = i^2
end
total_sq = sum(sq[i] for i in 1..N)

9. Time: differential equations

A time problem is written with der(): der(T) is the rate of change of T. An initial line gives the start value, and simulate sets the time range, the step and the variables to record; the trajectory appears in the Integral table, plotted. Names ignore letter case, so the time is called time here: t would be T.

// A tank cooling towards the room: dT/dtime = -(T - T_amb) / tau
T_amb = 20 ; tau = 600
der(T) = -(T - T_amb) / tau
initial T = 90
simulate time from 0 to 3600 step 60 record T

10. AC circuits: complex numbers

The line complex on makes every variable complex. Write 4i or j for the imaginary unit, polar(r, angle) for a phasor; abs and angle give magnitude and phase, conj the conjugate. Results show both forms. Load this series RL circuit and solve.

complex on
units SI degrees
V = polar(230, 0)
Z = 12 + j * 2 * pi * 50 * 0.04
I = V / Z
I_rms = abs(I)
phi = angle(Z)
S = V * conj(I)
P = real(S) ; Q = imag(S)

11. Tables, plots, diagram

The Parametric table tab is an editable grid: add columns, type values (they turn blue), Alter values fills a column, Run (F3) solves every row. The Plots tab draws any columns against each other, overlays curves, fits them. The Diagram tab is the front panel: in development mode add input fields bound to variables and output fields, switch to application mode (Ctrl+D), type values and press Calculate. A default line gives an input its value until the table or the diagram gives another. Load this file, then set P_cond from the table or the diagram.

units SI °C kPa kJ
default P_cond = 800
default P_evap = 140
s1 = state(R134a, P=P_evap, x=1)
s2 = state(R134a, P=P_cond, s=s1.s)
s3 = state(R134a, P=P_cond, x=0)
COP = (s1.h - s3.h) / (s2.h - s1.h)
key COP 'coefficient of performance'

12. Fields and flow

Equations over a grid are still equations: this 12 x 12 conduction field is 144 unknowns in one block. Larger fields (10,000 unknowns) take under a minute. For flow, the Flow tab has a live 2-D solver: draw walls with the mouse.

N = 12 ; M = 12
G = 2 ; h = 5 ; T_amb = 20 ; q = 500
for i in 1..N
  for j in 1..M
    G*(T[max(i-1,1),j] - T[i,j]) + G*(T[min(i+1,N),j] - T[i,j]) + G*(T[i,max(j-1,1)] - T[i,j]) + G*(T[i,min(j+1,M)] - T[i,j]) + q * (if j > 6 then 0.5 else 1.5) - h*(T[i,j] - T_amb) = 0
  end
end
T_hot = T[6,1] ; T_cold = T[6,12]

13. The library, strings and brines

A use line loads a library of routines into the model: the shipped heat_transfer library has fins, Nusselt correlations, effectiveness-NTU and radiation. Strings hold fluid names and units (Concat$, Uppercase$, a unit taken from a string as in h = 850 U$), and brines take a C= concentration in per cent. Load, press F2, then open Properties → Function Info to browse what is available.

use heat_transfer
units SI °C kPa kJ
fluid$ = 'EG'
U$ = 'W/(m^2*K)'
rho = density(fluid$, T=20, P=100, C=40)     // 40 % ethylene glycol brine
h = 850 U$
eta = eta_fin_straight(h, 237, 0.003, 0.05)
eps = effectiveness_counterflow(2, 0.5)

14. Min/Max and Uncertainty tables, contour plots

Tables → New Parametric Table with a column for x (Alter Values 0 to 4), then in the Min/Max window choose f, vary y:-5:5 and press Min/Max Table (F5): every row gets its optimum. Uncertainty Table does the same for x:5% and shows value ± sigma with error bars in plots. A 2-D array T[i,j] plots as a contour: Plots → New Plot, kind contour, source 2-D arrays.

x = 1
y = 0
f = (x - 2)^2 + (y + 1)^2 + 3
for i in 1..12
  for j in 1..8
    T[i,j] = 20 + 60 * exp(-((i - 5)^2 + (j - 4)^2) / 6)
  end
end

EQS for spreadsheet users

The short guide of Help → EQS for Excel Users.

Equations, not cells

In Excel, C1 = A1 + B1 always computes C1 from the cells it points at. In EQS you write equations with names, and EQS finds which variable each one gives: y = x + 1 can just as well give x when y is known. The order of the lines does not matter, and there are no cell references to keep straight. Load this step: the values appear at the end of each line, as a sheet shows its results.

// Excel would need x first; EQS solves the line for whichever is unknown
y = 10
y = x + 1
z = 2*x

Your inputs and results, as cells

Lines that set a variable to a number are the inputs, like the cells you type into. Analyze → Inputs and Results (the ⊞ button) shows them as editable cells with their units, and every result beside them. Type a new value and press Enter: the line changes and everything is solved again, as a sheet recalculates.

// A pipe: pressure drop from flow, diameter and length
Q = 0.01 m^3/s   // flow
D = 0.05 m       // diameter
L = 100 m        // length
f = 0.02         // friction factor
rho = 1000 kg/m^3
v = Q/(pi*D^2/4)
dP = f*(L/D)*rho*v^2/2

Recalculation: live, and F2

EQS solves again by itself when you stop typing, and shows each result at the end of its line (View → Live Solve). F2 is the full solve, with the Solution window, plots and the files a model writes; it is EQS's F9. A line that cannot be solved shows why, in red, where a sheet would show #VALUE!.

a = 3
b = 4
c = sqrt(a^2 + b^2)
// try b = -4 and then sqrt(a - 5): the reason shows on the line

Units belong to the numbers

Write a unit after a number: m = 2 kg/s. Results take their units from the equations, and Model → Check Units warns when the two sides of an equation disagree, a mistake a sheet never notices. Model → Unit System sets the units of property functions (C or K, kPa or bar …).

m = 2 kg/s
cp = 4.18 kJ/(kg*K)
dT = 15 K
Q = m*cp*dT

A table that works like a sheet

Tables → New Parametric Table makes a grid of runs: each column a variable, each row one calculation. Type values in an input column and the row is solved at once. Select two cells and drag the small square at the corner down to continue the series, as Excel's fill handle does. Ctrl+Z undoes, Ctrl+C copies a block for your spreadsheet, and Paste takes a range from it.

// Make a table with the columns D and dP, type diameters, drag the fill handle
Q = 0.01
L = 100
f = 0.02
rho = 1000
D = 0.05
v = Q/(pi*D^2/4)
dP = f*(L/D)*rho*v^2/2

From and to your spreadsheet

Paste a copied range into the parametric table (a first row of names chooses the columns). Lookup tables open .xlsx workbooks, one table per sheet, for Interpolate and Lookup in the equations. Save Table writes .xlsx or .csv, and Copy CSV (Solution, tables, the property calculator) puts results on the clipboard for a sheet.

Functions you know

Most sheet functions have the same name: sqrt, exp, ln, log10, abs, min, max, sum, average, round, pi. IF(test; a; b) is if test then a else b. Arguments are separated by commas. Hover a function name for its help, or type two letters for the list.

x = 7
r = sqrt(x)
big = if x > 5 then 1 else 0
m = max(x, 10)
avg = average(2, 4, 9)

Goal Seek without Goal Seek

In Excel you ask Goal Seek to change a cell until another reaches a target. In EQS you write the target as an equation and leave the cell out: EQS solves for it. For the best value of something, Analyze → Min/Max does what Solver does.

// Which diameter gives a pressure drop of 20 kPa?
Q = 0.01
L = 100
f = 0.02
rho = 1000
dP = 20000
v = Q/(pi*D^2/4)
dP = f*(L/D)*rho*v^2/2

What-if, and what matters

Analyze → What Drives This Result? ranks every input by its effect on a result (a tornado chart), and a Monte Carlo run gives the spread of the result when the inputs are uncertain: the questions a sheet answers with data tables and copied formulas.

Q = 0.01
L = 100
f = 0.02
rho = 1000
D = 0.05
v = Q/(pi*D^2/4)
dP = f*(L/D)*rho*v^2/2

Fewer menus

View → Simple Mode keeps the everyday menus and buttons; switch it off to see every menu (macros, the grader, distributables …). Properties → Property Calculator gives every property of a fluid from two values, and Help → Help Index lists the functions, units and constants.

Functions

377 functions, as EQS computes them. Property results and inputs follow the file's units line (default °C, kPa, kJ, per kg); trigonometry works in degrees unless the units line says radians. A routine with several outputs is written as it is called: (x, y) = name(a, b). Type a word to filter every table on this page.

Constants and basic math

FunctionWhat it does, its parameters, an example
piThe constant π = 3.14159…, unless the file defines a variable named pi.
Example: A = pi*D^2/4
sqrt(x)Square root; with complex on the principal complex root.
  • x — a number ≥ 0 (any number with complex on)
Example: r = sqrt(A/pi)
abs(x)Absolute value; with complex on the magnitude |z|.
  • x — any number
Example: dT = abs(T_1 - T_2)
exp(x)e raised to the power x (the complex exponential with complex on).
  • x — exponent
Example: y = exp(-t/tau)
ln(x)Natural logarithm (principal complex logarithm with complex on).
  • x — a number > 0
Example: s = cp*ln(T_2/T_1)
log10(x)Base-10 logarithm.
  • x — a number > 0
Example: pH = -log10(c_H)
log(x)Base-10 logarithm in EQS, the same as log10 (use ln for the natural logarithm).
  • x — a number > 0
Example: dB = 10*log(P/P_ref)
pow(x, y)x raised to the power y, the same as x^y.
  • x — base
  • y — exponent
Example: V = pow(r, 3)*4/3*pi
sign(x)1 for x ≥ 0 (zero included), -1 for x < 0. A step: the solver sees no derivative through it.
  • x — any number
Example: F = -sign(v)*F_friction
floor(x)Largest integer ≤ x. A step: no derivative for the solver.
  • x — any number
Example: n = floor(L/pitch)
ceil(x)Smallest integer ≥ x. A step: no derivative for the solver.
  • x — any number
Example: N_tubes = ceil(A/A_tube)
round(x, m)Nearest integer (halves away from zero); with a second argument the nearest multiple of m. No derivative for the solver.
  • x — any number
  • m — optional: round to a multiple of m
Example: D_std = round(D, 0.005)
trunc(x)Integer part of x, towards zero. No derivative for the solver.
  • x — any number
Example: k = trunc(t/period)
gcd(a, b)Greatest common divisor of two whole numbers (rounded first). No derivative for the solver.
  • a — whole number
  • b — whole number
Example: g = gcd(84, 36)
lcm(a, b)Least common multiple of two whole numbers (rounded first). No derivative for the solver.
  • a — whole number
  • b — whole number
Example: lcd = lcm(12, 18)
mod(x, y)Remainder of x/y with the sign of x (x - y*trunc(x/y)). No derivative for the solver.
  • x — dividend
  • y — divisor ≠ 0
Example: phase = mod(t, period)
min(a, b, ...)Smallest of the arguments (any number of them).
  • a — first value
  • b — second value
  • ... — more values
Example: dT_min = min(T_h_in - T_c_out, T_h_out - T_c_in)
max(a, b, ...)Largest of the arguments (any number of them).
  • a — first value
  • b — second value
  • ... — more values
Example: Q_max = max(Q_1, Q_2, Q_3)
sum(a, b, ...)Sum of the arguments; an array range A[1..N] counts as its elements. Indexed form: sum(expr for j in lo..hi) adds expr for j = lo … hi (constant bounds).
  • a — first value, or the indexed form expr for j in lo..hi
  • b — second value
  • ... — more values
Example: m_total = sum(m[j] for j in 1..N)
product(a, b, ...)Product of the arguments; indexed form product(expr for j in lo..hi) multiplies expr for j = lo … hi (constant bounds).
  • a — first value, or the indexed form expr for j in lo..hi
  • b — second value
  • ... — more values
Example: eta = product(eta[j] for j in 1..3)
average(a, b, ...)Arithmetic mean of the arguments; an array range A[1..N] counts as its elements.
  • a — first value
  • b — second value
  • ... — more values
Example: T_avg = average(T[1..N])
stddev(a, b, ...)Sample standard deviation of the arguments (divides by n - 1).
  • a — first value
  • b — second value
  • ... — more values
Example: s_T = stddev(T[1..N])
lmtd(dT_1, dT_2)Log-mean temperature difference (dT_1 - dT_2)/ln(dT_1/dT_2); the arithmetic mean when the two are equal. Both must have the same sign.
  • dT_1 — temperature difference at one end
  • dT_2 — temperature difference at the other end
Example: Q = U*A*lmtd(T_h_in - T_c_out, T_h_out - T_c_in)
lmtd_f(dT_1, dT_2)The same as lmtd: log-mean temperature difference of the two end differences.
  • dT_1 — temperature difference at one end
  • dT_2 — temperature difference at the other end
Example: dT_lm = lmtd_f(dT_a, dT_b)
heaviside(x)Unit step: 1 for x ≥ 0, else 0. No derivative for the solver.
  • x — any number
Example: Q = Q_0*heaviside(t - t_on)
step(x)Unit step, the same as heaviside: 1 for x ≥ 0, else 0.
  • x — any number
Example: P = P_max*step(t - 10)
squarewave(t, period, v1, v2, duty)v1 for the first duty fraction of each period and v2 for the rest; duty is 0.5 when left out.
  • t — time (or any running variable)
  • period — length of one period
  • v1 — value in the first part of the period
  • v2 — value in the rest
  • duty — optional: fraction of the period at v1, default 0.5
Example: Q_in = squarewave(time, 3600, 5, 0, 0.25)
convert(From, To, x)With x: the value x in unit From converted to unit To, the same for every unit; between temperature scales (C, K, F, R) it adds the offset, convert(C, K, 25) = 298.15. Without x: the factor from From to To, convert(kPa, Pa) = 1000. Between C, F and K a factor could mean a temperature or a difference, so it needs x for a temperature, and DELTAC, DELTAF, DELTAK for a difference: convert(DELTAC, DELTAF) = 1.8. Units may be written bare or quoted.
  • From — unit of the value, e.g. kPa, ft, Btu/hr, C
  • To — unit wanted
  • x — optional: the value to convert
Example: T_K = convert(C, K, T_1)

Trigonometry (degrees unless the units line says radians)

FunctionWhat it does, its parameters, an example
sin(angle)Sine of an angle in degrees, or radians when the units line says radians (complex with complex on).
  • angle — degrees (radians when the units line says radians)
Example: F_y = F*sin(theta)
cos(angle)Cosine of an angle in degrees, or radians when the units line says radians (complex with complex on).
  • angle — degrees (radians when the units line says radians)
Example: F_x = F*cos(theta)
tan(angle)Tangent of an angle in degrees, or radians when the units line says radians.
  • angle — degrees (radians when the units line says radians)
Example: h = L*tan(alpha)
arcsin(x)Inverse sine, in degrees (radians when the units line says radians).
  • x — -1 … 1
Example: theta = arcsin(n_1/n_2*sin(phi))
asin(x)Inverse sine, the same as arcsin: in degrees (radians when the units line says radians).
  • x — -1 … 1
Example: theta = asin(0.5)
arccos(x)Inverse cosine, in degrees (radians when the units line says radians).
  • x — -1 … 1
Example: phi = arccos(PF)
acos(x)Inverse cosine, the same as arccos: in degrees (radians when the units line says radians).
  • x — -1 … 1
Example: phi = acos(PF)
arctan(x)Inverse tangent, -90 … 90 degrees (radians when the units line says radians).
  • x — any number
Example: alpha = arctan(h/L)
atan(x)Inverse tangent, the same as arctan: in degrees (radians when the units line says radians).
  • x — any number
Example: alpha = atan(h/L)
atan2(y, x)Angle of the point (x, y) from the +x axis, -180 … 180 degrees (-π … π when the units line says radians). Note the order: y first.
  • y — y coordinate
  • x — x coordinate
Example: theta = atan2(F_y, F_x)
arctan2(y, x)The same as atan2: angle of the point (x, y) from +x, y first.
  • y — y coordinate
  • x — x coordinate
Example: theta = arctan2(F_y, F_x)
sinh(x)Hyperbolic sine (eˣ - e⁻ˣ)/2.
  • x — any number
Example: y = a*sinh(x/a)
cosh(x)Hyperbolic cosine (eˣ + e⁻ˣ)/2.
  • x — any number
Example: y = a*cosh(x/a)
tanh(x)Hyperbolic tangent.
  • x — any number
Example: eta_fin = tanh(m*L)/(m*L)
arcsinh(x)Inverse hyperbolic sine ln(x + √(x²+1)).
  • x — any number
Example: u = arcsinh(x/a)
asinh(x)Inverse hyperbolic sine, the same as arcsinh.
  • x — any number
Example: u = asinh(x/a)
arccosh(x)Inverse hyperbolic cosine ln(x + √(x²-1)).
  • x — a number ≥ 1
Example: u = arccosh(y/a)
acosh(x)Inverse hyperbolic cosine, the same as arccosh.
  • x — a number ≥ 1
Example: u = acosh(y/a)
arctanh(x)Inverse hyperbolic tangent ½ ln((1+x)/(1-x)).
  • x — -1 < x < 1
Example: u = arctanh(v/c)
atanh(x)Inverse hyperbolic tangent, the same as arctanh.
  • x — -1 < x < 1
Example: u = atanh(v/c)

Special functions

FunctionWhat it does, its parameters, an example
erf(x)Error function (2/√π)∫₀ˣ e^(-t²) dt.
  • x — any number
Example: theta = erf(x/(2*sqrt(alpha*t)))
hypot(x, y)√(x² + y²) without overflow or underflow; the result has the unit of x.
  • x — first component
  • y — second component, the same unit as x
Example: v = hypot(v_x, v_y)
log2(x)Logarithm to base 2.
  • x — a number > 0
Example: bits = log2(N_levels)
log1p(x)ln(1 + x), exact also when x is very small (ln(1 + x) would lose the digits).
  • x — a number > -1
Example: r_cont = log1p(i_annual)
expm1(x)eˣ − 1, exact also when x is very small.
  • x — any number
Example: dV_V = expm1(beta_T*dT)
clamp(x, lo, hi)x kept between lo and hi: lo when x < lo, hi when x > hi, else x.
  • x — the value
  • lo — lower bound
  • hi — upper bound ≥ lo
Example: eta_used = clamp(eta, 0, 1)
LambertW(x)Lambert's W, the principal branch W₀: the w ≥ −1 with w·eʷ = x, for x ≥ −1/e. Gives the Colebrook friction factor in closed form.
  • x — a number ≥ −1/e
Example: w = LambertW(exp(b/(a*c))/(a*c))
LambertW_m1(x)Lambert's W, the lower branch W₋₁: the w ≤ −1 with w·eʷ = x, for −1/e ≤ x < 0.
  • x — −1/e ≤ x < 0
Example: w = LambertW_m1(-0.2)
erfinv(x)Inverse error function: the w with erf(w) = x.
  • x — −1 < x < 1
Example: z = sqrt(2)*erfinv(2*p - 1)
erfcinv(x)Inverse complementary error function: the w with erfc(w) = x, precise for tiny x.
  • x — 0 < x < 2
Example: eta = erfcinv(theta)
lngamma(x)ln Γ(x), for arguments where Γ itself would overflow (x > 171).
  • x — a number > 0
Example: lnN = lngamma(N + 1)
beta(a, b)The beta function B(a, b) = Γ(a) Γ(b) / Γ(a + b).
  • a — a number > 0
  • b — a number > 0
Example: B = beta(2.5, 3.5)
betainc(x, a, b)The regularized incomplete beta function I_x(a, b) (SciPy's betainc(a, b, x)).
  • x — 0 ≤ x ≤ 1
  • a — a number > 0
  • b — a number > 0
Example: F = betainc(0.3, 2, 5)
gammainc(a, x)The regularized lower incomplete gamma function P(a, x).
  • a — a number > 0
  • x — a number ≥ 0
Example: P = gammainc(2.5, 1.5)
gammaincc(a, x)The regularized upper incomplete gamma function Q(a, x) = 1 − P(a, x), precise in the tail.
  • a — a number > 0
  • x — a number ≥ 0
Example: Q = gammaincc(2.5, 30)
erfc(x)Complementary error function 1 - erf(x), accurate far into the tail.
  • x — any number
Example: T = T_s + (T_i - T_s)*erfc(x/(2*sqrt(alpha*t)))
gamma_(x)Gamma function Γ(x); Γ(n) = (n-1)! for whole n.
  • x — any number but 0 or a negative integer
Example: G = gamma_(1.5)
gamma(x)Gamma function Γ(x), the same as gamma_. With a fluid and named state inputs, gamma(CO2, T=300) is the specific-heat ratio cp/cv instead, as SpecHeatRatio.
  • x — any number but 0 or a negative integer
Example: G = gamma(2.5)
factorial(n)n! of round(n); 1 for n ≤ 1. No derivative for the solver.
  • n — a whole number (rounded)
Example: C = factorial(N)/(factorial(k)*factorial(N - k))
besselj(n, x)Bessel function of the first kind Jₙ(x) of integer order n.
  • n — order, a whole number (rounded)
  • x — argument
Example: J = besselj(2, 3.5)
bessely(n, x)Bessel function of the second kind Yₙ(x) of integer order n.
  • n — order, a whole number (rounded)
  • x — argument > 0
Example: Y = bessely(1, r*m)
besseli(n, x)Modified Bessel function of the first kind Iₙ(x) of integer order n.
  • n — order, a whole number (rounded)
  • x — argument
Example: I = besseli(0, m*r)
besselk(n, x)Modified Bessel function of the second kind Kₙ(x) of integer order n.
  • n — order, a whole number (rounded)
  • x — argument > 0
Example: K = besselk(1, m*r_2)
bessel_j0(x)Bessel function of the first kind, order 0: J₀(x).
  • x — argument
Example: J0 = bessel_j0(2.405)
bessel_j1(x)Bessel function of the first kind, order 1: J₁(x).
  • x — argument
Example: J1 = bessel_j1(lambda)
bessel_y0(x)Bessel function of the second kind, order 0: Y₀(x).
  • x — argument > 0
Example: Y0 = bessel_y0(x)
bessel_y1(x)Bessel function of the second kind, order 1: Y₁(x).
  • x — argument > 0
Example: Y1 = bessel_y1(x)
bessel_i0(x)Modified Bessel function of the first kind, order 0: I₀(x).
  • x — argument
Example: I0 = bessel_i0(m*r_1)
bessel_i1(x)Modified Bessel function of the first kind, order 1: I₁(x).
  • x — argument
Example: I1 = bessel_i1(m*r_1)
bessel_k0(x)Modified Bessel function of the second kind, order 0: K₀(x).
  • x — argument > 0
Example: K0 = bessel_k0(m*r_2)
bessel_k1(x)Modified Bessel function of the second kind, order 1: K₁(x).
  • x — argument > 0
Example: K1 = bessel_k1(m*r_2)
Kelvin_ber(x)Kelvin function ber(x), the real part of J₀(x e^(3πi/4)); power series, accurate to about x = 10. ber(0) = 1.
  • x — argument ≥ 0
Example: b = Kelvin_ber(2)
Kelvin_bei(x)Kelvin function bei(x), the imaginary part of J₀(x e^(3πi/4)). bei(0) = 0.
  • x — argument ≥ 0
Example: b = Kelvin_bei(2)
Kelvin_ker(x)Kelvin function ker(x), the real part of K₀(x e^(πi/4)); infinite at x = 0.
  • x — argument > 0
Example: k = Kelvin_ker(2)
Kelvin_kei(x)Kelvin function kei(x), the imaginary part of K₀(x e^(πi/4)); -π/4 at x = 0.
  • x — argument ≥ 0
Example: k = Kelvin_kei(2)

Statistics and random numbers

FunctionWhat it does, its parameters, an example
probability(x1, x2, mean, sd)Chance that a normally distributed variable lies between x1 and x2.
  • x1 — lower bound
  • x2 — upper bound
  • mean — mean of the distribution
  • sd — standard deviation > 0
Example: P_ok = probability(9.9, 10.1, D_mean, sigma_D)
students_t(t, dof)Two-sided confidence that a Student-t variable lies within ±t: P(|T| < t).
  • t — t value ≥ 0
  • dof — degrees of freedom
Example: conf = students_t(2.228, 10)
chi_square(x, k)Cumulative chi-square distribution with k degrees of freedom: P(X < x).
  • x — value ≥ 0
  • k — degrees of freedom
Example: p = chi_square(18.3, 10)
random(a, b, seed)Uniform random number between a and b, drawn once per solve (a fixed number while the equations are solved). A positive constant seed makes it repeatable.
  • a — lower end
  • b — upper end
  • seed — optional: a positive constant for a repeatable draw
Example: T_amb = random(15, 25)
randg(mean, sd, seed)Normally distributed random number, drawn once per solve. A positive constant seed makes it repeatable.
  • mean — mean
  • sd — standard deviation
  • seed — optional: a positive constant for a repeatable draw
Example: D = randg(0.025, 0.0001)

Numerical tools: statistics of data and distributions (checked against SciPy)

FunctionWhat it does, its parameters, an example
median(a, b, ...)The median: the middle value, or the mean of the two middle values; an array range X[1..N] counts as its elements. Keeps the unit of the data.
  • a — first value or array range
  • b — second value
  • ... — more values
Example: T_med = median(T[1..N])
percentile(p, a, b, ...)The p-th percentile (p in %), linear between the sorted values (NumPy's default, R type 7); an array range counts as its elements.
  • p — percent, 0 … 100
  • a — first value or array range
  • ... — more values
Example: P_95 = percentile(95, P[1..N])
variance(a, b, ...)The sample variance (divides by n − 1), the square of stddev; the unit is the data's squared.
  • a — first value or array range
  • b — second value
  • ... — more values
Example: s2 = variance(D[1..N])
correlation(X[1..N], Y[1..N])Pearson's correlation coefficient r of two data arrays of the same length (−1 … 1).
  • X[1..N] — first data array
  • Y[1..N] — second data array, same length
Example: r = correlation(T[1..N], Q[1..N])
NormalCDF(x, mean, sd)The normal distribution: the probability that a normal variable is below x.
  • x — value
  • mean — mean
  • sd — standard deviation > 0
Example: P_below = NormalCDF(9.95, D_mean, sigma_D)
NormalPDF(x, mean, sd)The normal density at x (unit: 1 over the unit of x).
  • x — value
  • mean — mean
  • sd — standard deviation > 0
Example: f = NormalPDF(x, 0, 1)
NormalInv(p, mean, sd)The normal quantile: the x below which a normal variable lies with probability p (R's qnorm).
  • p — probability, 0 < p < 1
  • mean — mean
  • sd — standard deviation > 0
Example: D_max = NormalInv(0.999, D_mean, sigma_D)
TCDF(t, dof)Student's t, one-sided: P(T ≤ t) (R's pt). Students_T is the two-sided form.
  • t — t value
  • dof — degrees of freedom > 0
Example: p = TCDF(2.228, 10)
TInv(p, dof)Student's t quantile: the t with P(T ≤ t) = p (R's qt); TInv(0.975, N-1) is the t of a 95 % two-sided interval.
  • p — probability, 0 < p < 1
  • dof — degrees of freedom > 0
Example: t_95 = TInv(0.975, N - 1)
ChiSquareInv(p, dof)The χ² quantile: the x with Chi_Square(x, dof) = p.
  • p — probability, 0 < p < 1
  • dof — degrees of freedom > 0
Example: chi2_crit = ChiSquareInv(0.95, 3)
FCDF(F, d1, d2)The F distribution: P(X ≤ F) with d1 and d2 degrees of freedom.
  • F — value ≥ 0
  • d1 — numerator degrees of freedom
  • d2 — denominator degrees of freedom
Example: p = FCDF(F_ratio, 3, 10)
FInv(p, d1, d2)The F quantile: the F with FCDF(F, d1, d2) = p.
  • p — probability, 0 < p < 1
  • d1 — numerator degrees of freedom
  • d2 — denominator degrees of freedom
Example: F_crit = FInv(0.95, 3, 10)
WeibullCDF(x, k, lambda)The Weibull distribution (fatigue, failure): 1 − exp(−(x/λ)^k) for x ≥ 0.
  • x — value, e.g. a life
  • k — shape > 0
  • lambda — scale > 0
Example: F_fail = WeibullCDF(t_op, 1.8, 12000)
WeibullInv(p, k, lambda)The Weibull quantile λ (−ln(1 − p))^(1/k); keeps the unit of λ. WeibullInv(0.1, k, λ) is the B10 life.
  • p — probability, 0 < p < 1
  • k — shape > 0
  • lambda — scale > 0
Example: L_10 = WeibullInv(0.1, 1.5, 20000)
LognormalCDF(x, mu, sigma)The lognormal distribution Φ((ln x − μ)/σ); μ and σ are the mean and standard deviation of ln x.
  • x — value > 0
  • mu — mean of ln x
  • sigma — standard deviation of ln x, > 0
Example: F = LognormalCDF(d, ln(50), 0.4)
LognormalInv(p, mu, sigma)The lognormal quantile exp(μ + σ Φ⁻¹(p)).
  • p — probability, 0 < p < 1
  • mu — mean of ln x
  • sigma — standard deviation of ln x, > 0
Example: d_90 = LognormalInv(0.9, ln(50), 0.4)
(low, high) = ConfidenceInterval(level, X[1..N])The confidence interval mean ± t·s/√N of the mean of X at a level in % (Student's t with N − 1 degrees of freedom, as R's t.test). low and high keep the unit of X.
  • level — confidence level in %, e.g. 95
  • X[1..N] — the data
  • low — output: lower end
  • high — output: upper end
Example: (eta_lo, eta_hi) = ConfidenceInterval(95, eta[1..10])

Numerical tools: integrals and derivatives of tabulated data (NumPy, SciPy)

FunctionWhat it does, its parameters, an example
Trapz(Y[1..N], X[1..N])∫ y dx of tabulated data by the trapezoid rule (numpy.trapezoid); the steps may be uneven. The unit is the unit of Y times the unit of X: the energy of a power log.
  • Y[1..N] — the values y
  • X[1..N] — the points x, same length
Example: E = Trapz(P[1..N], t[1..N])
Simpson(Y[1..N], X[1..N])∫ y dx of tabulated data by Simpson's rule for uneven steps, with Cartwright's correction for the last interval when N is even (scipy.integrate.simpson).
  • Y[1..N] — the values y
  • X[1..N] — the points x, all different
Example: E = Simpson(P[1..N], t[1..N])
(I[1..N]) = CumTrapz(Y[1..N], X[1..N])The running trapezoid integral, I[1] = 0 and I[N] = Trapz(Y, X) (scipy.integrate.cumulative_trapezoid).
  • Y[1..N] — the values y
  • X[1..N] — the points x
  • I[1..N] — output: ∫ y dx from X[1] to each X[k]
Example: (E[1..N]) = CumTrapz(P[1..N], t[1..N])
(dY[1..N]) = Gradient(Y[1..N], X[1..N])dy/dx at each point, second-order central differences for uneven steps and one-sided differences at the two ends (numpy.gradient). The unit is the unit of Y over the unit of X.
  • Y[1..N] — the values y
  • X[1..N] — the points x, all different
  • dY[1..N] — output: dy/dx at each point
Example: (dTdt[1..N]) = Gradient(T[1..N], t[1..N])
IntegralLookup('Table', 'x', 'y', x1, x2)∫ y dx from x1 to x2 over two columns of a lookup table: linear between the rows (the trapezoid rule), extended linearly beyond the table with a warning.
  • 'Table' — lookup table name
  • 'x' — the column of x
  • 'y' — the column of y
  • x1 — lower limit
  • x2 — upper limit
Example: E = IntegralLookup('PowerLog', 't', 'P', 0, 3600)

Numerical tools: interpolation and splines on arrays (NumPy, SciPy)

FunctionWhat it does, its parameters, an example
LinInterp(X[1..N], Y[1..N], x)Linear interpolation in arrays (numpy.interp): straight lines between the points, X increasing. Outside the data the end value is kept, with a warning.
  • X[1..N] — the points, increasing
  • Y[1..N] — the values, same length
  • x — where the value is wanted
Example: H = LinInterp(Q[1..N], H_data[1..N], Q_op)
Spline(X[1..N], Y[1..N], x)The natural cubic spline through the points (SciPy's CubicSpline with natural ends): smooth, with a continuous curvature. Beyond the data the end polynomial is extended, with a warning.
  • X[1..N] — the points, increasing
  • Y[1..N] — the values, same length
  • x — where the value is wanted
Example: c_p = Spline(T[1..N], cp_data[1..N], T_mean)
SplineDeriv(X[1..N], Y[1..N], x)The slope dy/dx of the natural cubic spline at x; the unit is the unit of Y over the unit of X.
  • X[1..N] — the points, increasing
  • Y[1..N] — the values, same length
  • x — where the slope is wanted
Example: dHdQ = SplineDeriv(Q[1..N], H[1..N], Q_op)
Pchip(X[1..N], Y[1..N], x)The monotone piecewise cubic (SciPy's PchipInterpolator): smooth, and never above or below the data between two points, so a monotone curve stays monotone.
  • X[1..N] — the points, increasing
  • Y[1..N] — the values, same length
  • x — where the value is wanted
Example: eta = Pchip(load[1..N], eta_data[1..N], load_op)

Numerical tools: polynomials, coefficients lowest power first (NumPy)

FunctionWhat it does, its parameters, an example
PolyVal(a[0..n], x)The polynomial a[0] + a[1]·x + … + a[n]·xⁿ by Horner's rule; the coefficients go lowest power first, as the curve fits give them.
  • a[0..n] — coefficients, lowest power first
  • x — where the polynomial is wanted
Example: cp = PolyVal(c[0..3], T)
(re[1..n], im[1..n]) = PolyRoots(a[0..n])All n roots of a[0] + a[1]·x + … + a[n]·xⁿ, real parts then imaginary parts, sorted by real part (the eigenvalues of the companion matrix, as numpy.roots). With complex on it may give complex variables: (z[1..n]) = PolyRoots(a[0..n]).
  • a[0..n] — coefficients, lowest power first; a[n] not 0
  • re[1..n] — output: real parts
  • im[1..n] — output: imaginary parts
Example: (re[1..3], im[1..3]) = PolyRoots(a[0..3])
(r[1..n], count) = PolyRealRoots(a[0..n])The real roots of the polynomial in ascending order, the remaining places 0, and how many there are.
  • a[0..n] — coefficients, lowest power first; a[n] not 0
  • r[1..n] — output: the real roots, ascending, then zeros
  • count — output: the number of real roots
Example: (Z[1..3], n_real) = PolyRealRoots(a[0..3])

Numerical tools: matrices, 2-D ranges A[1..n, 1..m] row by row (NumPy)

FunctionWhat it does, its parameters, an example
(x[1..n]) = MatrixSolve(A[1..n, 1..n], b[1..n])x with A·x = b, by LU decomposition with partial pivoting (numpy.linalg.solve); b may be an n×k matrix. Unknowns may be inside A and b. An error names the pivot when A is singular.
  • A[1..n, 1..n] — square matrix
  • b[1..n] — right side (or an n×k matrix)
  • x[1..n] — output: the solution
Example: (x[1..3]) = MatrixSolve(A[1..3, 1..3], b[1..3])
(B[1..n, 1..n]) = MatrixInverse(A[1..n, 1..n])The inverse matrix A⁻¹ (numpy.linalg.inv). To solve A·x = b, MatrixSolve is faster and more precise.
  • A[1..n, 1..n] — square, not singular
  • B[1..n, 1..n] — output: A⁻¹
Example: (C[1..3, 1..3]) = MatrixInverse(K[1..3, 1..3])
(C[1..n, 1..p]) = MatrixMultiply(A[1..n, 1..m], B[1..m, 1..p])The product A·B; B may be a vector B[1..m], then C is C[1..n].
  • A[1..n, 1..m] — first matrix
  • B[1..m, 1..p] — second matrix or a vector, as many rows as A has columns
  • C[1..n, 1..p] — output: the product
Example: (F[1..3]) = MatrixMultiply(K[1..3, 1..3], u[1..3])
(B[1..m, 1..n]) = MatrixTranspose(A[1..n, 1..m])The transpose Aᵀ.
  • A[1..n, 1..m] — a matrix
  • B[1..m, 1..n] — output: Aᵀ
Example: (At[1..3, 1..2]) = MatrixTranspose(A[1..2, 1..3])
Determinant(A[1..n, 1..n])The determinant det A, from the LU decomposition (numpy.linalg.det); 0 for a singular matrix.
  • A[1..n, 1..n] — square matrix
Example: D = Determinant(K[1..3, 1..3])
Trace(A[1..n, 1..n])The sum of the diagonal of a square matrix.
  • A[1..n, 1..n] — square matrix
Example: tr = Trace(S[1..3, 1..3])
Norm(x[1..n])The Euclidean length √(Σ x²) of a vector of any size, without overflow (of a matrix: the Frobenius norm). Keeps the unit of x.
  • x[1..n] — a vector (or a matrix)
Example: F_res = Norm(F[1..3])
(lambda[1..n], V[1..n, 1..n]) = EigenSym(A[1..n, 1..n])The eigenvalues of a symmetric matrix, ascending, and its unit eigenvectors as the columns of V, each with its largest component positive (Jacobi's method; numpy.linalg.eigh). V may be left out. The vibration modes: the eigenvalues of M^(-1/2) K M^(-1/2) are ω².
  • A[1..n, 1..n] — symmetric matrix
  • lambda[1..n] — output: eigenvalues, ascending
  • V[1..n, 1..n] — output (optional): eigenvectors as columns
Example: (lambda[1..3], V[1..3, 1..3]) = EigenSym(S[1..3, 1..3])
(re[1..n], im[1..n]) = Eigen(A[1..n, 1..n])The eigenvalues of any real square matrix, real parts then imaginary parts, sorted by real part (Francis QR; numpy.linalg.eigvals). With complex on it may give complex variables: (z[1..n]) = Eigen(A[1..n, 1..n]).
  • A[1..n, 1..n] — square matrix
  • re[1..n] — output: real parts
  • im[1..n] — output: imaginary parts
Example: (re[1..4], im[1..4]) = Eigen(J[1..4, 1..4])

Numerical tools: signal tools (pandas, SciPy, NumPy's FFT)

FunctionWhat it does, its parameters, an example
(S[1..N]) = MovingAverage(Y[1..N], w)The centred moving average over w samples (w odd); near the ends the window holds only the samples there are (pandas rolling mean, center=True).
  • Y[1..N] — the signal
  • w — window width, odd
  • S[1..N] — output: the smoothed signal
Example: (T_s[1..N]) = MovingAverage(T[1..N], 5)
(S[1..N]) = SavGol(Y[1..N], w, order)Savitzky–Golay smoothing: a least-squares polynomial of the given order through each window of w samples (w odd, order < w ≤ N); the end windows are fitted as a whole (scipy.signal.savgol_filter).
  • Y[1..N] — the signal
  • w — window width, odd
  • order — polynomial order, below w
  • S[1..N] — output: the smoothed signal
Example: (T_s[1..N]) = SavGol(T[1..N], 9, 3)
(f[1..M], A[1..M]) = Spectrum(Y[1..N], dt)The one-sided amplitude spectrum of N samples taken every dt, M = N/2 + 1 (rounded down): f from 0 to the Nyquist frequency and A the amplitude of the sine at each (FFT; Bluestein's algorithm when N is not a power of 2).
  • Y[1..N] — the samples
  • dt — sampling step
  • f[1..M] — output: frequencies, k/(N·dt)
  • A[1..M] — output: amplitudes, in the unit of Y
Example: (f[1..129], A[1..129]) = Spectrum(a[1..256], 0.001)

Numerical tools: linear and integer programs (SciPy's linprog, milp)

FunctionWhat it does, its parameters, an example
(x[1..n], f) = LinProg(c[1..n], A[1..m, 1..n], b[1..m], lo[1..n], hi[1..n])The linear program min cᵀx with A·x ≤ b and lo ≤ x ≤ hi, by the revised simplex method (two phases, Bland's rule). A bound of 1e20 or more means none; maximise by minimising −cᵀx; an equality is two rows. Errors say when the problem is infeasible or unbounded.
  • c[1..n] — costs
  • A[1..m, 1..n] — constraint matrix
  • b[1..m] — right sides of A·x ≤ b
  • lo[1..n] — lower bounds
  • hi[1..n] — upper bounds (1e20: none)
  • x[1..n] — output: the optimum
  • f — output: cᵀx at the optimum
Example: (x[1..2], f) = LinProg(c[1..2], A[1..3, 1..2], b[1..3], lo[1..2], hi[1..2])
(x[1..n], f) = LinProgInt(c[1..n], A[1..m, 1..n], b[1..m], lo[1..n], hi[1..n], isInt[1..n])LinProg with the variables whose isInt is not 0 kept whole numbers, by branch and bound over the linear relaxations (scipy.optimize.milp).
  • c[1..n] — costs
  • A[1..m, 1..n] — constraint matrix
  • b[1..m] — right sides of A·x ≤ b
  • lo[1..n] — lower bounds
  • hi[1..n] — upper bounds (1e20: none)
  • isInt[1..n] — 1 for a whole-number variable, 0 for a continuous one
  • x[1..n] — output: the optimum
  • f — output: cᵀx at the optimum
Example: (x[1..3], f) = LinProgInt(c[1..3], A[1..2, 1..3], b[1..2], lo[1..3], hi[1..3], isInt[1..3])

Uncertainty propagation (0 in a plain solve; filled in by Uncertainty Propagation)

FunctionWhat it does, its parameters, an example
UncertaintyOf(x)The standard uncertainty σ of x after an uncertainty propagation (uncertainty of …); 0 in a plain solve.
  • x — a variable: a propagated result or a measured input
Example: sigma_eta = UncertaintyOf(eta)
Uncert_ParDif(y, x)The partial derivative ∂y/∂x from the uncertainty propagation; 0 in a plain solve.
  • y — the propagated result
  • x — a measured input
Example: dEta_dT = Uncert_ParDif(eta, T_1)
Uncert_Percent(y, x)The share (%) of y's variance that comes from the uncertainty of x; 0 in a plain solve.
  • y — the propagated result
  • x — a measured input
Example: share_T = Uncert_Percent(eta, T_1)

Engineering functions

FunctionWhat it does, its parameters, an example
(z1, z2, z3) = RealCubicRoots(a2, a1, a0)The real roots of z³ + a2 z² + a1 z + a0 = 0; with one real root, z2 and z3 are 0.
  • a2 — coefficient of z²
  • a1 — coefficient of z
  • a0 — constant term
  • z1 — output: first root
  • z2 — output: second root (0 if none)
  • z3 — output: third root (0 if none)
Example: (z1, z2, z3) = RealCubicRoots(-4, -3, 6)
(P, T) = StdAtm_1976(Z)Pressure and temperature of the 1976 U.S. Standard Atmosphere at altitude Z (m, ft in English units), valid -5 … 86 km; results in the file's units.
  • Z — geometric altitude, m (ft in English units)
  • P — output: pressure
  • T — output: temperature
Example: (P_amb, T_amb) = StdAtm_1976(2000)
(P, T) = StandardAtmosphere_1976(Z)The same as StdAtm_1976: the 1976 Standard Atmosphere at altitude Z.
  • Z — geometric altitude, m (ft in English units)
  • P — output: pressure
  • T — output: temperature
Example: (P, T) = StandardAtmosphere_1976(z)
StdAtm_1976_P(Z)Pressure of the 1976 U.S. Standard Atmosphere at altitude Z, in the file's pressure unit (the P output of StdAtm_1976).
  • Z — geometric altitude, m (ft in English units)
Example: P_amb = StdAtm_1976_P(1500)
StdAtm_1976_T(Z)Temperature of the 1976 U.S. Standard Atmosphere at altitude Z, in the file's temperature unit (the T output of StdAtm_1976).
  • Z — geometric altitude, m (ft in English units)
Example: T_amb = StdAtm_1976_T(1500)
BarometricPressure(z)Standard-atmosphere pressure at elevation z, 101325 (1 - 2.25577e-5 z)^5.25588 Pa, in the file's pressure unit.
  • z — elevation, m (ft in English units)
Example: P_atm = BarometricPressure(450)
VoltTC(Type$, T)Thermocouple voltage in mV at T (C) with the reference junction at 0 C, from the NIST ITS-90 reference functions; an error outside the type's range.
  • Type$ — thermocouple type: 'B', 'E', 'J', 'K', 'N', 'R', 'S' or 'T'
  • T — junction temperature, C
Example: E_mV = VoltTC('K', T_gas)
RGB(r, g, b)Colour number r + 256 g + 65536 b (each rounded and clamped to 0 … 255), as the plot and diagram colours use.
  • r — red 0 … 255
  • g — green 0 … 255
  • b — blue 0 … 255
Example: c = RGB(255, 128, 0)
Compress(Tr, Pr, w)Compressibility factor Z from the generalised Redlich-Kwong-Soave equation (GEN_EOS), vapour-like root.
  • Tr — reduced temperature T/Tc
  • Pr — reduced pressure P/Pc
  • w — optional: acentric factor, default 0.1
Example: Z = Compress(T/T_c, P/P_c, 0.011)
EnthDep(Tr, Pr, w)Enthalpy departure (h_ideal - h)/(R Tc) from the generalised Redlich-Kwong-Soave equation.
  • Tr — reduced temperature T/Tc
  • Pr — reduced pressure P/Pc
  • w — optional: acentric factor, default 0.1
Example: h = h_ig - R*T_c*EnthDep(T_r, P_r, omega)
EntrDep(Tr, Pr, w)Entropy departure (s_ideal - s)/R from the generalised Redlich-Kwong-Soave equation.
  • Tr — reduced temperature T/Tc
  • Pr — reduced pressure P/Pc
  • w — optional: acentric factor, default 0.1
Example: s = s_ig - R*EntrDep(T_r, P_r, omega)
FugCoef(Tr, Pr, w)Fugacity coefficient f/P from the generalised Redlich-Kwong-Soave equation.
  • Tr — reduced temperature T/Tc
  • Pr — reduced pressure P/Pc
  • w — optional: acentric factor, default 0.1
Example: f = P*FugCoef(T_r, P_r, omega)

Economics (Duffie & Beckman life-cycle factors; rates as fractions)

FunctionWhat it does, its parameters, an example
PWF(N, i, d)Present worth of N yearly payments that start at 1 and inflate at rate i, discounted at rate d; N/(1+i) when i = d.
  • N — number of years
  • i — inflation rate (fraction)
  • d — discount rate (fraction)
Example: LCC = C_0 + C_fuel*PWF(20, 0.03, 0.07)
P_1f(N, i, d, c, t_bar)Ratio of life-cycle fuel savings to first-year fuel savings: (1 - c t_bar) PWF(N, i, d).
  • N — period of analysis, years
  • i — fuel inflation rate
  • d — discount rate
  • c — 1 for an income-producing investment, else 0
  • t_bar — effective income tax rate
Example: P_1 = P_1f(20, 0.04, 0.08, 0, 0.3)
P_2f(c, d, DD, i, m, M_s, N, N_L, N_D, p, R_v, t_bar, V)Ratio of the life-cycle expenses caused by the extra investment to the investment: down payment, mortgage and its interest deduction, maintenance, property tax, depreciation, resale value.
  • c — 1 for an income-producing investment, else 0
  • d — discount rate
  • DD — down payment (fraction of investment)
  • i — general inflation rate
  • m — mortgage interest rate
  • M_s — first-year misc. costs (fraction of investment)
  • N — period of analysis, years
  • N_L — term of the loan, years
  • N_D — depreciation lifetime, years
  • p — property tax rate (fraction of assessed value)
  • R_v — resale value (fraction of investment)
  • t_bar — effective income tax rate
  • V — assessed value (fraction of investment)
Example: P_2 = P_2f(0, 0.1, 0.2, 0.035, 0.065, 0.01, 10, 10, 10, 0.035, 0, 0.35, 1)

Lookup tables, parametric table and arrays

FunctionWhat it does, its parameters, an example
Interpolate(Table$, xcol, ycol, x)Cubic interpolation of column ycol at x in column xcol of a lookup table; the order Interpolate(Table$, ycol, xcol, xcol=x) works too. Extrapolates past the ends with a warning; two more arguments FirstRow, LastRow limit the rows. A last word 'spline' takes the natural cubic spline through all the rows, 'pchip' the monotone cubic (no overshoot).
  • Table$ — lookup table name, e.g. 'Table1' (<model>-Table1.csv)
  • xcol — column of the known value (name or number)
  • ycol — column wanted (name or number)
  • x — the known value
Example: k = Interpolate('Conductivity', 'T', 'k', T_avg)
Interpolate1(Table$, xcol, ycol, x)Linear interpolation between the two nearest rows of a lookup table (same arguments as Interpolate).
  • Table$ — lookup table name
  • xcol — column of the known value
  • ycol — column wanted
  • x — the known value
Example: cp = Interpolate1('Oil', 'T', 'cp', T)
Interpolate2(Table$, xcol, ycol, x)Quadratic interpolation through the three nearest rows of a lookup table (same arguments as Interpolate).
  • Table$ — lookup table name
  • xcol — column of the known value
  • ycol — column wanted
  • x — the known value
Example: eta = Interpolate2('Pump', 'Q', 'eta', Q)
Interpolate3(Table$, xcol, ycol, x)The same as Interpolate: cubic interpolation in a lookup table.
  • Table$ — lookup table name
  • xcol — column of the known value
  • ycol — column wanted
  • x — the known value
Example: H = Interpolate3('Pump', 'Q', 'H', Q)
Differentiate(Table$, ycol, xcol, xcol=x)dy/dx at x from the cubic through the nearest four rows of a lookup table; the order (Table$, xcol, ycol, x) works too. Linear slope past the ends. A last word 'spline' or 'pchip' differentiates that curve instead.
  • Table$ — lookup table name
  • ycol — column of y
  • xcol — column of x
  • xcol=x — the x value, named after its column
Example: dkdT = Differentiate('Lookup 1', k, T, T=550)
Differentiate1(Table$, ycol, xcol, xcol=x)The same as Differentiate in EQS (the same fitted curve).
  • Table$ — lookup table name
  • ycol — column of y
  • xcol — column of x
  • xcol=x — the x value, named after its column
Example: s = Differentiate1('Data', y, x, x=2)
Differentiate2(Table$, ycol, xcol, xcol=x)The same as Differentiate in EQS (the same fitted curve).
  • Table$ — lookup table name
  • ycol — column of y
  • xcol — column of x
  • xcol=x — the x value, named after its column
Example: s = Differentiate2('Data', y, x, x=2)
Interpolate2D(Table$, X, Y, Z, X=x, Y=y)Column Z at the point (x, y) from scattered rows: a quadratic surface fitted to the nearest rows (a plane with fewer than six). The two columns named in the X=, Y= arguments are the independent ones.
  • Table$ — lookup table name
  • X — first independent column
  • Y — second independent column
  • Z — column wanted
  • X=x — value of X, named after its column
  • Y=y — value of Y, named after its column
Example: P = Interpolate2D('Map', T_cond, T_evap, P, T_cond=40, T_evap=-5)
Interpolate2DM(Table$, x, y)Bilinear interpolation in a matrix table: x values in the header row (from column 2), y values in the first column, z in the body; clamped outside.
  • Table$ — lookup table name
  • x — value along the header row
  • y — value along the first column
Example: eta = Interpolate2DM('Efficiency', N, Q)
Lookup(Table$, row, col)A cell of a lookup table by 1-based row and column (number or name); a fractional row or column interpolates linearly. On the left of a line, Lookup(…) = expr writes the cell after the solve.
  • Table$ — lookup table name
  • row — row number, 1-based (may be fractional)
  • col — column name or number
Example: T_1 = Lookup('Data', 3, 'T')
TableValue(row, column)A cell of the Parametric table being solved (rows solved so far); TableValue(Table$, row, col) with three arguments reads a lookup table like Lookup.
  • row — row number, 1-based
  • column — column name or number
Example: T_prev = TableValue(table_run - 1, 'T')
LookupCellEmpty(Table$, row, col)1 when the cell holds a value, 0 when it is empty: the opposite of what the name suggests (0 if the cell is empty, 1 if it contains a value).
  • Table$ — lookup table name
  • row — row number, 1-based
  • col — column name or number
Example: has = LookupCellEmpty('Data', i, 'T')
LookupRow(Table$, col, value)The (fractional) row at which column col takes the value: the inverse of Lookup, linear between rows, clamped at the ends.
  • Table$ — lookup table name
  • col — column name or number
  • value — value to find
Example: r = LookupRow('Data', 'T', 350)
LookupRow1(Table$, col, value)As LookupRow, leaving out the first row.
  • Table$ — lookup table name
  • col — column name or number
  • value — value to find
Example: r = LookupRow1('Map', 1, 350)
LookupCol(Table$, row, value)The (fractional) column in which the row takes the value, linear between columns. LookupCol(Table$, 'name') with two arguments is the column number of a named column.
  • Table$ — lookup table name
  • row — row number, 1-based
  • value — value to find
Example: c = LookupCol('Map', 1, 2.5)
LookupCol1(Table$, row, value)As LookupCol, leaving out the first column (for Interpolate2DM-style tables).
  • Table$ — lookup table name
  • row — row number, 1-based
  • value — value to find
Example: c = LookupCol1('Map', 1, 2.5)
LookupColNumber(Table$, col$)The 1-based number of a named column.
  • Table$ — lookup table name
  • col$ — column name
Example: k = LookupColNumber('Data', 'T')
NLookupRows(Table$)Number of rows of a lookup table.
  • Table$ — lookup table name
Example: N = NLookupRows('Data')
NLookupColumns(Table$)Number of columns of a lookup table.
  • Table$ — lookup table name
Example: M = NLookupColumns('Data')
SumLookup(Table$, col, row1, row2)Sum of a column of a lookup table; rows row1 … row2 when given.
  • Table$ — lookup table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: E = SumLookup('Hourly', 'Q')
AvgLookup(Table$, col, row1, row2)Mean of a column of a lookup table; rows row1 … row2 when given.
  • Table$ — lookup table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: T_mean = AvgLookup('Hourly', 'T')
MaxLookup(Table$, col, row1, row2)Largest value of a column of a lookup table; rows row1 … row2 when given.
  • Table$ — lookup table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: Q_peak = MaxLookup('Hourly', 'Q')
MinLookup(Table$, col, row1, row2)Smallest value of a column of a lookup table; rows row1 … row2 when given.
  • Table$ — lookup table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: T_low = MinLookup('Hourly', 'T')
StdDevLookup(Table$, col, row1, row2)Sample standard deviation of a column of a lookup table; rows row1 … row2 when given.
  • Table$ — lookup table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: s = StdDevLookup('Data', 'T')
SumParametric(Table$, col, row1, row2)Sum of a column of a solved Parametric table; rows row1 … row2 when given.
  • Table$ — Parametric table name, e.g. 'Table 1'
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: W_total = SumParametric('Table 1', 'W')
AvgParametric(Table$, col, row1, row2)Mean of a column of a solved Parametric table.
  • Table$ — Parametric table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: eta_avg = AvgParametric('Table 1', 'eta')
MaxParametric(Table$, col, row1, row2)Largest value of a column of a solved Parametric table.
  • Table$ — Parametric table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: T_max = MaxParametric('Table 1', 'T')
MinParametric(Table$, col, row1, row2)Smallest value of a column of a solved Parametric table.
  • Table$ — Parametric table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: T_min = MinParametric('Table 1', 'T')
StdDevParametric(Table$, col, row1, row2)Sample standard deviation of a column of a solved Parametric table.
  • Table$ — Parametric table name
  • col — column name or number
  • row1 — optional: first row
  • row2 — optional: last row
Example: s = StdDevParametric('Table 1', 'eta')
NParametricRows(Table$)Number of rows of a Parametric table.
  • Table$ — Parametric table name
Example: N = NParametricRows('Table 1')
NParametricColumns(Table$)Number of columns of a Parametric table.
  • Table$ — Parametric table name
Example: M = NParametricColumns('Table 1')
NArrayRows(Table$)Rows of the Arrays table of the main program ('Main'): the largest first index of any array; 0 for another table.
  • Table$ — 'Main'
Example: N = NArrayRows('Main')
NArrayColumns(Table$)Columns of the Arrays table of the main program ('Main'): the number of arrays; 0 for another table.
  • Table$ — 'Main'
Example: M = NArrayColumns('Main')

Integration and differential equations

FunctionWhat it does, its parameters, an example
Integral(f, t, t0, t1, step)∫ f dt from t0 to t1, marched in steps with the other equations solved at each one (integraltable and integralautostep set the output and the step); inside another Integral a Simpson quadrature. Integral(f, t) with two arguments accumulates down the rows of a Parametric table.
  • f — integrand (an expression or variable)
  • t — integration variable
  • t0 — lower limit
  • t1 — upper limit
  • step — optional: fixed step
Example: T = T_0 + Integral(dTdt, time, 0, 3600)
IntegralValue(t, Name$)A variable's value at an earlier time t of the integration (only inside an Integral problem).
  • t — time of the integration variable
  • Name$ — variable name, e.g. 'y'
Example: y_delay = IntegralValue(time - 1, 'y')
MinIntegral(Name$)The smallest value of a variable over the integration steps so far (0 before the first).
  • Name$ — variable name
Example: T_low = MinIntegral('T')
MaxIntegral(Name$)The largest value of a variable over the integration steps so far (0 before the first).
  • Name$ — variable name
Example: T_high = MaxIntegral('T')
der(x)Time derivative of the state x in a time problem (simulate, with start values from initial): write der(x) = f(x, t).
  • x — a state variable
Example: der(T) = -h*A*(T - T_inf)/(m*c)
SUM2D(A[], row1, rowN, col1, colM)Sum of the elements A[i,j] of a two-dimensional array over rows row1 … rowN and columns col1 … colM (constant limits).
  • A[] — array name followed by []
  • row1 — first row
  • rowN — last row
  • col1 — first column
  • colM — last column
Example: Q_total = SUM2D(Q[], 1, 10, 1, 5)

Strings (worked out before the solve: numbers inside must be known constants)

FunctionWhat it does, its parameters, an example
StringLen(s$)Number of characters in the text.
  • s$ — text
Example: n = StringLen(name$)
StringPos(find$, in$)1-based position of the first find$ in in$ (case ignored); 0 when absent.
  • find$ — text to find
  • in$ — text searched
Example: k = StringPos('_', name$)
StringVal(s$)The number written in the text; an error when it is not a number.
  • s$ — text holding a number
Example: N = StringVal(Copy$(id$, 2, 3))
UnitSystem(Word$)1 when the file's units line uses the word (e.g. 'SI', 'Eng', 'C', 'K', 'kPa', 'Rad', 'Molar'), else 0.
  • Word$ — a unit-system word
Example: g = if UnitSystem('SI') = 1 then 9.81 else 32.174

Dates, files and windows

FunctionWhat it does, its parameters, an example
Date(Text$)A date as a serial number: days since 30 Dec 1899, the fraction the time of day. Accepts 'March 15, 2022', '15-Mar-2022', '3/15/2022' (month/day), '2022-03-15', optionally with a time.
  • Text$ — date text
Example: days = Date('2026-10-02') - Date('2026-01-01')
Time(Text$)A time of day as hours since midnight: '14:30', '14:30:15', '2:30 PM', '14h30'.
  • Text$ — time text
Example: t_start = Time('7:30 AM')
TimeStamp(File$)When the file was last changed, as a serial date number; 0 when there is no such file.
  • File$ — file name (relative to the model's folder) or path
Example: t = TimeStamp('data.csv')
FileExists(File$)1 when the file exists, else 0 (relative names are in the model's folder).
  • File$ — file name or path
Example: has_data = FileExists('data.csv')
NFileRows(File$)Number of lines in a text file; 0 when it does not exist.
  • File$ — file name or path
Example: N = NFileRows('data.txt')
GetWindowInfo(Window$, Item$)Position and size of an app window; EQS answers for a nominal 1000 x 700 window at the origin.
  • Window$ — window name, e.g. 'Diagram'
  • Item$ — 'Left', 'Top', 'Right', 'Bottom', 'Width' or 'Height'
Example: W = GetWindowInfo('Diagram', 'Width')
GetDiagramAttribute(Name$)An attribute of a Diagram window object, 'Object.attribute'; -9999 when not found.
  • Name$ — 'Object.attribute'
Example: x = GetDiagramAttribute('Text1.Left')
GetAttribute(Name$)The same as GetDiagramAttribute: a Diagram object attribute, -9999 when not found.
  • Name$ — 'Object.attribute'
Example: x = GetAttribute('Text1.Left')
diagram_width(Window$)Width in pixels of a Diagram window (the main one when no name is given; 1000 when unknown).
  • Window$ — optional: window name
Example: W = diagram_width()
diagram_height(Window$)Height in pixels of a Diagram window (the main one when no name is given; 700 when unknown).
  • Window$ — optional: window name
Example: H = diagram_height()

Vectors (vector2d / vector3d A B declares A_x, A_y, A_z)

FunctionWhat it does, its parameters, an example
VectorAssign(x, y, z)A vector from its components (leave out z for 2-D).
  • x — x component
  • y — y component
  • z — z component (3-D only)
Example: F = VectorAssign(10, 0, -5)
VectorAssignPolar(r, angle_x, angle_y)A vector from its magnitude and the angle from +x (2-D); in 3-D the second angle is from +y (direction cosines).
  • r — magnitude
  • angle_x — angle from the +x axis
  • angle_y — 3-D only: angle from the +y axis
Example: V = VectorAssignPolar(25, 30)
VectorZerosThe zero vector, sized like the vector it is used with (written with or without ()).
Example: F_net = VectorZeros
VectorUnit_iThe unit vector along x.
Example: F = 20*VectorUnit_i
VectorUnit_jThe unit vector along y.
Example: F = 20*VectorUnit_j
VectorUnit_kThe unit vector along z (3-D).
Example: M = 5*VectorUnit_k
VectorDot(A, B)Dot product A·B of two declared vectors; also VectorDot(A[1..3], B[1..3]) on three-element arrays.
  • A — first vector
  • B — second vector
Example: W = VectorDot(F, d)
VectorMag(A)Magnitude |A|; also VectorMag(A[1..3]) on a three-element array.
  • A — a vector
Example: F_mag = VectorMag(F)
VectorCross(A, B)Cross product A×B: a vector in 3-D, the scalar z component in 2-D. Array form VectorCross(A[1..3], B[1..3], k) gives component k.
  • A — first vector
  • B — second vector
Example: M = VectorCross(r, F)
VectorCross_i(A, B)The x component of A×B.
  • A — first vector
  • B — second vector
Example: M_x = VectorCross_i(r, F)
VectorCross_j(A, B)The y component of A×B.
  • A — first vector
  • B — second vector
Example: M_y = VectorCross_j(r, F)
VectorCross_k(A, B)The z component of A×B.
  • A — first vector
  • B — second vector
Example: M_z = VectorCross_k(r, F)
VectorAngle_x(A)Angle between A and the +x axis, arccos(A_x/|A|), in the file's angle unit.
  • A — a vector
Example: alpha = VectorAngle_x(F)
VectorAngle_y(A)Angle between A and the +y axis, arccos(A_y/|A|).
  • A — a vector
Example: beta = VectorAngle_y(F)
VectorAngle_z(A)Angle between A and the +z axis, arccos(A_z/|A|).
  • A — a vector
Example: gamma_z = VectorAngle_z(F)
VectorPolarAngle(A)Angle of a 2-D vector from +x, atan2(A_y, A_x).
  • A — a vector
Example: theta = VectorPolarAngle(V)
VectorAngle(A[1..3], B[1..3])Angle between two three-element arrays, arccos(A·B/(|A||B|)), in the file's angle unit.
  • A[1..3] — first vector as an array range
  • B[1..3] — second vector as an array range
Example: phi = VectorAngle(A[1..3], B[1..3])
dot(A[1..3], B[1..3])Dot product of two three-element arrays (as VectorDot).
  • A[1..3] — first vector
  • B[1..3] — second vector
Example: W = dot(F[1..3], d[1..3])
cross(A[1..3], B[1..3], k)Component k (1, 2, 3) of the cross product of two three-element arrays.
  • A[1..3] — first vector
  • B[1..3] — second vector
  • k — component: 1, 2 or 3
Example: M[3] = cross(r[1..3], F[1..3], 3)
magnitude3(A[1..3])Magnitude of a three-element array (as VectorMag).
  • A[1..3] — a vector
Example: F_mag = magnitude3(F[1..3])

Complex numbers (complex on)

FunctionWhat it does, its parameters, an example
real(z)Real part of a complex number (complex on only).
  • z — complex number
Example: R = real(Z)
imag(z)Imaginary part of a complex number (complex on only).
  • z — complex number
Example: X = imag(Z)
conj(z)Complex conjugate (complex on only).
  • z — complex number
Example: S = V*conj(I)
magnitude(z)Magnitude |z| of a complex number, the same as abs (complex on only).
  • z — complex number
Example: Z_mag = magnitude(Z)
angle(z)Argument of a complex number in the file's angle unit (complex on only).
  • z — complex number
Example: phi = angle(Z)
arg(z)Argument of a complex number, the same as angle (complex on only).
  • z — complex number
Example: phi = arg(Z)
angleRad(z)Argument of a complex number in radians, whatever the unit system (complex on only).
  • z — complex number
Example: phi_r = angleRad(Z)
angleDeg(z)Argument of a complex number in degrees, whatever the unit system (complex on only).
  • z — complex number
Example: phi_d = angleDeg(Z)
polar(r, angle)The complex number r(cos angle + i sin angle), angle in the file's angle unit (complex on only).
  • r — magnitude
  • angle — argument (degrees unless Rad)
Example: V = polar(230, -30)
cis(angle)cos angle + i sin angle, the same as polar(1, angle) (complex on only).
  • angle — argument (degrees unless Rad)
Example: a = cis(120)
PolarToRect(r, angle)The same as polar: r at the given angle as a complex number (complex on only).
  • r — magnitude
  • angle — argument (degrees unless Rad)
Example: V = PolarToRect(230, -30)

Curve fits and regression (several outputs)

FunctionWhat it does, its parameters, an example
(a_0, a_1, rms, bias, R2) = CurveFit1D(Form$, X[1..N], Y[1..N])Least-squares fit of Y on X. Outputs: the coefficients (as many as the form has), then rms, bias, R² in %, then the coefficients' standard errors. Forms: 'Linear', 'Polynomial2' … 'Polynomial6', 'Exponential', 'Power', 'Logarithmic'.
  • Form$ — 'Linear', 'Polynomial2' … 'Polynomial6', 'Exponential', 'Power', 'Logarithmic'
  • X[1..N] — x data
  • Y[1..N] — y data, same length
  • a_0 — output: first coefficient
  • a_1 — output: second coefficient (more for higher forms)
  • rms — output: rms error
  • bias — output: bias
  • R2 — output: R² in %
Example: (a_0, a_1, rms, bias, R2) = CurveFit1D('Linear', X[1..10], Y[1..10])
(a_0, a_1, rms, bias, R2) = CurveFit(Form$, X[1..N], Y[1..N])The same as CurveFit1D.
  • Form$ — fit form, e.g. 'Linear'
  • X[1..N] — x data
  • Y[1..N] — y data, same length
  • a_0 — output: first coefficient
  • a_1 — output: second coefficient
  • rms — output: rms error
  • bias — output: bias
  • R2 — output: R² in %
Example: (a_0, a_1, rms, bias, R2) = CurveFit('Linear', X[1..10], Y[1..10])
(a_0, a_1, rms, bias, R2) = CurveFit1DT(Form$, Table$, xcol$, ycol$, row1, rowN)CurveFit1D on two columns of a lookup table, rows row1 … rowN.
  • Form$ — fit form, e.g. 'Polynomial2'
  • Table$ — lookup table name
  • xcol$ — x column
  • ycol$ — y column
  • row1 — first row
  • rowN — last row
  • a_0 — output: first coefficient
  • a_1 — output: second coefficient
  • rms — output: rms error
  • bias — output: bias
  • R2 — output: R² in %
Example: (a_0, a_1, rms, bias, R2) = CurveFit1DT('Linear', 'Data', 'T', 'k', 1, 20)
(a[0..NInd], rms, bias, R2, StdErr[0..NInd]) = LinearRegression(Table$, Row1, RowN, DepVar$, NInd, Names$[1..NInd], Exclude0)Multiple linear regression of one column on NInd others, on the 'Arrays' table or a lookup table. Outputs the coefficients (a[0] = 0 when the constant is excluded), rms, bias, R² in %, then standard errors.
  • Table$ — 'Arrays' or a lookup table name
  • Row1 — first row
  • RowN — last row
  • DepVar$ — dependent column
  • NInd — number of independent columns
  • Names$[1..NInd] — independent columns
  • Exclude0 — true to fit without the constant
  • a[0..NInd] — output: coefficients
  • rms — output: rms error
  • bias — output: bias
  • R2 — output: R² in %
  • StdErr[0..NInd] — output: standard errors
Example: (a[0..2], rms, bias, R2, se[0..2]) = LinearRegression('Arrays', 1, N, 'y', 2, Names$[1..2], false)

Property functions (real fluids through CoolProp, ideal gases from NASA polynomials, brines, solids, Ice)

FunctionWhat it does, its parameters, an example
Enthalpy(Fluid, T=, P=)Specific enthalpy in the file's units (kJ/kg by default; per kmol with Molar), on the fluid's usual reference state. AirH2O: per kg of dry air.
  • Fluid — fluid name: Water, R134a, Air, CO2, a mixture of the file (mixture m = …), a brine with C=, Ice …
  • T= — first state input: T=, P=, h=, s=, u=, v=, x= or rho=
  • P= — second, independent state input (x is quality 0..1)
Example: h_1 = Enthalpy(Water, T=T_1, P=P_1)
Entropy(Fluid, T=, P=)Specific entropy (kJ/(kg*K) by default), on the fluid's usual reference state.
  • Fluid — fluid name
  • T= — first state input: T=, P=, h=, s=, u=, v=, x= or rho=
  • P= — second, independent state input
Example: s_1 = Entropy(R134a, P=P_1, x=1)
IntEnergy(Fluid, T=, P=)Specific internal energy (kJ/kg by default).
  • Fluid — fluid name
  • T= — first state input: T=, P=, h=, s=, u=, v=, x= or rho=
  • P= — second, independent state input
Example: u_2 = IntEnergy(Air, T=T_2)
Temperature(Fluid, P=, h=)Temperature in the file's unit (C by default) from two other properties.
  • Fluid — fluid name
  • P= — first state input: P=, h=, s=, u=, v=, x= or rho=
  • h= — second, independent state input
Example: T_2 = Temperature(Water, P=P_2, h=h_2)
Pressure(Fluid, T=, s=)Pressure in the file's unit (kPa by default) from two other properties.
  • Fluid — fluid name
  • T= — first state input: T=, h=, s=, u=, v=, x= or rho=
  • s= — second, independent state input
Example: P_2 = Pressure(Water, T=T_2, s=s_1)
Density(Fluid, T=, P=)Density (kg/m³ in SI; kmol/m³ with Molar). AirH2O: mass of air and vapour over volume.
  • Fluid — fluid name
  • T= — first state input: T=, P=, h=, s=, u=, v=, x=
  • P= — second, independent state input
Example: rho = Density(Water, T=25, P=101.325)
Volume(Fluid, T=, P=)Specific volume 1/density (m³/kg in SI). AirH2O: per kg of dry air.
  • Fluid — fluid name
  • T= — first state input: T=, P=, h=, s=, u=, x= or rho=
  • P= — second, independent state input
Example: v_1 = Volume(Air, T=T_1, P=P_1)
Quality(Fluid, P=, h=)Vapour quality 0..1 inside the dome; -100 for a subcooled liquid, 100 for a superheated vapour or supercritical fluid.
  • Fluid — fluid name
  • P= — first state input: T=, P=, h=, s=, u=, v=
  • h= — second, independent state input
Example: x_4 = Quality(R134a, P=P_4, h=h_4)
Cp(Fluid, T=, P=)Specific heat at constant pressure (kJ/(kg*K) by default).
  • Fluid — fluid name
  • T= — first state input (ideal gases need only T=)
  • P= — second, independent state input
Example: c_p = Cp(Air, T=T_avg)
SpecHeat(Fluid, T=, P=)Specific heat, the same as Cp (for solids and liquids T= alone is enough).
  • Fluid — fluid or solid name, e.g. Copper
  • T= — temperature (first state input)
  • P= — second state input, where needed
Example: c = SpecHeat(Copper, T=T_avg)
Cv(Fluid, T=, P=)Specific heat at constant volume (kJ/(kg*K) by default).
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: c_v = Cv(CO2, T=500)
SpecHeatRatio(Fluid, T=)cp/cv at the state: of an ideal gas (CO2, N2, Air, a mixture of the file (mixture m = …) …) from T alone, of a real fluid (Water, R134a …) from two state inputs. gamma(Fluid, …) is the same.
  • Fluid — fluid name
  • T= — temperature (or h=, u=, s= with P=; a real fluid needs two inputs, e.g. T= and P=)
Example: k = SpecHeatRatio(Air, T=T_1)
Viscosity(Fluid, T=, P=)Dynamic viscosity (Pa*s in SI). Ideal-gas names (N2, CO2 …) use the built-in gas tables; real-fluid names (Nitrogen) use CoolProp.
  • Fluid — fluid name
  • T= — first state input (gases: T= alone is enough)
  • P= — second, independent state input
Example: mu = Viscosity(Water, T=T_m, P=P)
Conductivity(Fluid, T=, P=)Thermal conductivity (W/(m*K) in SI); solids and liquids need only T=. k(…) is the same.
  • Fluid — fluid or solid name
  • T= — first state input
  • P= — second, independent state input
Example: k = Conductivity(Air, T=T_film, P=101.325)
k(Fluid, T=, P=)Thermal conductivity, the short name of Conductivity (for every fluid; the specific-heat ratio is gamma or SpecHeatRatio). The result carries no unit label; Conductivity's does.
  • Fluid — fluid or solid name
  • T= — first state input
  • P= — second, independent state input
Example: k_w = k(Water, T=T_1, P=P_1)
mu(Fluid, T=, P=)Dynamic viscosity, the short name of Viscosity. The result carries no unit label; Viscosity's does.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: mu_air = mu(Air, T=T_1)
Prandtl(Fluid, T=, P=)Prandtl number μ cp / k.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: Pr = Prandtl(Air, T=T_film)
KinematicViscosity(Fluid, T=, P=)Kinematic viscosity μ/ρ in m²/s (ft²/s in English units).
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: nu = KinematicViscosity(Air, T=T_f, P=P_atm)
ThermalDiffusivity(Fluid, T=, P=)Thermal diffusivity k/(ρ cp) in m²/s (ft²/s in English units).
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: alpha = ThermalDiffusivity(Water, T=T_f, P=P)
SoundSpeed(Fluid, T=, P=)Speed of sound in m/s (ft/s in English units); √(k R T) for ideal gases.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: c = SoundSpeed(Air, T=T_1)
SurfaceTension(Fluid, T=)Surface tension in N/m of the saturated liquid at T.
  • Fluid — fluid name
  • T= — temperature
Example: sigma = SurfaceTension(Water, T=100)
CompressibilityFactor(Fluid, T=, P=)Compressibility factor Z = Pv/(RT) of a real fluid (1 for AirH2O).
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: Z = CompressibilityFactor(CO2, T=T_1, P=P_1)
VolExpCoef(Fluid, T=, P=)Volumetric expansion coefficient β = (1/v)(∂v/∂T)ₚ per degree of the file's temperature unit.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: beta = VolExpCoef(Water, T=T_f, P=101.325)
IsothermalCompressibility(Fluid, T=, P=)Isothermal compressibility -(1/v)(∂v/∂P)ₜ per unit of the file's pressure.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: kappa = IsothermalCompressibility(Water, T=20, P=100)
IsothermalCompress(Fluid, T=, P=)The same as IsothermalCompressibility.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: kappa = IsothermalCompress(Water, T=20, P=100)
IsentropicExponent(Fluid, T=, P=)Isentropic exponent -(v/P)(∂P/∂v)ₛ; cp/cv for an ideal gas.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: n = IsentropicExponent(Steam, T=300, P=1000)
JouleThomson(Fluid, T=, P=)Joule-Thomson coefficient (∂T/∂P) at constant enthalpy, in the file's temperature per pressure unit.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: mu_JT = JouleThomson(Nitrogen, T=T_1, P=P_1)
JouleThomsonCoef(Fluid, T=, P=)The same as JouleThomson: (∂T/∂P) at constant enthalpy.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: mu_JT = JouleThomsonCoef(CO2, T=T_1, P=P_1)
Fugacity(Fluid, T=, P=)Fugacity in the file's pressure unit, from the equation of state's residual Helmholtz energy.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: f = Fugacity(CO2, T=T_1, P=P_1)
Gibbs(Fluid, T=, P=)Specific Gibbs free energy g = h - T s (kJ/kg by default).
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: g_1 = Gibbs(Water, T=T_1, P=P_1)
GibbsFreeEnergy(Fluid, T=, P=)The same as Gibbs: g = h - T s.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: g_CO2 = GibbsFreeEnergy(CO2, T=T, P=P_o)
Helmholtz(Fluid, T=, P=)Specific Helmholtz free energy a = u - T s (real fluids).
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: a_1 = Helmholtz(Water, T=T_1, P=P_1)
HelmholtzFreeEnergy(Fluid, T=, P=)The same as Helmholtz: a = u - T s.
  • Fluid — fluid name
  • T= — first state input
  • P= — second, independent state input
Example: a_1 = HelmholtzFreeEnergy(Water, T=T_1, P=P_1)
T_sat(Fluid, P=)Saturation temperature at pressure P.
  • Fluid — fluid name
  • P= — pressure
Example: T_evap = T_sat(R134a, P=P_low)
Tsat(Fluid, P=)The same as T_sat: saturation temperature at P.
  • Fluid — fluid name
  • P= — pressure
Example: T_b = Tsat(Water, P=101.325)
P_sat(Fluid, T=)Saturation (vapour) pressure at temperature T.
  • Fluid — fluid name
  • T= — temperature
Example: P_v = P_sat(Water, T=T_w)
Psat(Fluid, T=)The same as P_sat: saturation pressure at T.
  • Fluid — fluid name
  • T= — temperature
Example: P_v = Psat(Water, T=T_w)
Enthalpy_vaporization(Fluid, T=)Latent heat h_g - h_f at saturation temperature T= or pressure P= (one of them alone).
  • Fluid — fluid name
  • T= — saturation temperature (or P= saturation pressure)
Example: h_fg = Enthalpy_vaporization(Water, T=100)
Enthalpy_vaporisation(Fluid, T=)The same as Enthalpy_vaporization: h_g - h_f at T= or P=.
  • Fluid — fluid name
  • T= — saturation temperature (or P=)
Example: h_fg = Enthalpy_vaporisation(Water, P=200)
Enthalpy_fusion(Fluid)Latent heat of melting at the normal melting point, from the built-in data, per kg (per kmol with Molar).
  • Fluid — substance name
Example: h_sf = Enthalpy_fusion(Water)
NormalBoilingPt(Fluid)Saturation temperature at 1 atm (101.325 kPa).
  • Fluid — fluid name
Example: T_nb = NormalBoilingPt(Ammonia)
FreezingPt(Brine, C=)Freezing temperature of a solution (EG, PG, NaCl, CaCl2 …) at mass concentration C %.
  • Brine — solution name, e.g. EG, PG, NaCl
  • C= — concentration, mass %
Example: T_f = FreezingPt(EG, C=30)
MolarMass(Fluid)Molar mass in kg/kmol (also of a mixture of the file (mixture m = …)).
  • Fluid — fluid or gas name
Example: M = MolarMass(CO2)
MolarMass_soln(Brine, C=)Molar mass of a brine solution (kg/kmol) at mass concentration C %.
  • Brine — solution name, e.g. NaCl
  • C= — concentration, mass %
Example: M_s = MolarMass_soln(NaCl, C=20)
IsIdealGas(Fluid)Kind code of a fluid: 1 ideal gas, 0 real fluid, -1 incompressible/solid, -2 brine, -3 NH3H2O, -4 AirH2O.
  • Fluid — fluid name
Example: ig = IsIdealGas(F$)
MassFraction(NH3H2O, T=, P=, Q=)Ammonia mass fraction of an ammonia-water state; NH3H2O takes three of T=, P=, x=, h=, s=, u=, v=, Q=.
  • NH3H2O — the ammonia-water fluid
  • T= — first state input
  • P= — second state input
  • Q= — third state input (Q = vapour mass fraction)
Example: x_l = MassFraction(NH3H2O, T=T_g, P=P_h, Q=0)
T_crit(Fluid)Critical temperature.
  • Fluid — fluid name
Example: T_c = T_crit(CO2)
P_crit(Fluid)Critical pressure.
  • Fluid — fluid name
Example: P_c = P_crit(CO2)
V_crit(Fluid)Critical specific volume.
  • Fluid — fluid name
Example: v_c = V_crit(Water)
T_triple(Fluid)Triple-point temperature.
  • Fluid — fluid name
Example: T_tp = T_triple(CO2)
P_triple(Fluid)Triple-point pressure.
  • Fluid — fluid name
Example: P_tp = P_triple(CO2)
AcentricFactor(Fluid)Pitzer acentric factor ω.
  • Fluid — fluid name
Example: omega = AcentricFactor(Propane)
Dipole(Fluid)Molecular dipole moment in debye (built-in data).
  • Fluid — fluid name
Example: mu_d = Dipole(Ammonia)
EOS_Tmin(Fluid)Lowest temperature of the fluid's equation of state.
  • Fluid — fluid name
Example: T_lo = EOS_Tmin(R134a)
EOS_Tmax(Fluid)Highest temperature of the fluid's equation of state.
  • Fluid — fluid name
Example: T_hi = EOS_Tmax(R134a)
EOS_Pmax(Fluid)Highest pressure of the fluid's equation of state.
  • Fluid — fluid name
Example: P_hi = EOS_Pmax(R134a)
T_min(Fluid)The same as EOS_Tmin: lowest temperature of the equation of state.
  • Fluid — fluid name
Example: T_lo = T_min(Water)
T_max(Fluid)The same as EOS_Tmax: highest temperature of the equation of state.
  • Fluid — fluid name
Example: T_hi = T_max(Water)
P_max(Fluid)The same as EOS_Pmax: highest pressure of the equation of state.
  • Fluid — fluid name
Example: P_hi = P_max(Water)
GWP(Fluid)Global warming potential over 100 years.
  • Fluid — refrigerant name
Example: gwp_r = GWP(R410A)
GWP100(Fluid)The same as GWP: 100-year global warming potential.
  • Fluid — refrigerant name
Example: gwp_r = GWP100(R32)
ODP(Fluid)Ozone depletion potential.
  • Fluid — refrigerant name
Example: odp_r = ODP(R22)
T_melting(Fluid, P=)Melting temperature of ice Ih at pressure P (IAPWS R14-08); water only (Ice, Water, Steam).
  • Fluid — Water, Ice or Steam
  • P= — pressure, 611.657 Pa … 208.566 MPa
Example: T_m = T_melting(Water, P=50000)
P_melting(Fluid, T=)Melting pressure of ice Ih at temperature T (IAPWS R14-08); water only, 251.165 … 273.16 K.
  • Fluid — Water, Ice or Steam
  • T= — temperature
Example: P_m = P_melting(Water, T=-5)
Sigma_LJ(Gas)Lennard-Jones collision diameter σ in m (ft in English units), built-in data.
  • Gas — gas name
Example: sigma = Sigma_LJ(N2)
EK_LJ(Gas)Lennard-Jones energy parameter ε/k in K (R in English units), built-in data.
  • Gas — gas name
Example: eps_k = EK_LJ(N2)
LowerHeatingValue(Fuel)Lower heating value at 25 C per kg (per kmol with Molar): built-in data, or from ideal-gas enthalpies of a C-H-O formula; mixtures by mole fraction.
  • Fuel — fuel name or formula, e.g. CH4, C3H8, a mixture of the file (mixture m = …)
Example: LHV = LowerHeatingValue(CH4)
HigherHeatingValue(Fuel)Higher heating value at 25 C (water condensed) per kg (per kmol with Molar).
  • Fuel — fuel name or formula
Example: HHV = HigherHeatingValue(C3H8)

Incompressible library (solids, liquid metals, salts …; T= input)

FunctionWhat it does, its parameters, an example
IntK(Material, T=)Integral of the conductivity over temperature (W/m), for conduction with temperature-dependent k.
  • Material — material name, e.g. Copper
  • T= — temperature
Example: Q = 2*pi*L*(IntK(Copper, T=T_1) - IntK(Copper, T=T_2))/ln(r_2/r_1)
LinearExpCoef(Material, T=)Linear thermal expansion coefficient, 1/K.
  • Material — material name
  • T= — temperature
Example: alpha_L = LinearExpCoef(Aluminum, T=T)
TotalThermalExp(Material, T=)Total thermal expansion ΔL/L relative to 293 K.
  • Material — material name
  • T= — temperature
Example: dLL = TotalThermalExp(Copper, T=T)
TotalThermExp(Material, T=)The same as TotalThermalExp: ΔL/L relative to 293 K.
  • Material — material name
  • T= — temperature
Example: dLL = TotalThermExp(Copper, T=T)
YoungsModulus(Material, T=)Young's modulus in GPa (built-in mechanical data).
  • Material — material name, e.g. Aluminum_alloy_6061T6
  • T= — temperature
Example: E = YoungsModulus(Aluminum_alloy_6061T6, T=T)
ModulusOfRigidity(Material, T=)Shear modulus in GPa.
  • Material — material name
  • T= — temperature
Example: G = ModulusOfRigidity(Aluminum_alloy_6061T6, T=T)
PoissonsRatio(Material, T=)Poisson's ratio.
  • Material — material name
  • T= — temperature
Example: nu = PoissonsRatio(Aluminum_alloy_6061T6, T=T)
Ductility(Material, T=)Ductility (percent elongation), from the built-in data.
  • Material — material name
  • T= — temperature
Example: el = Ductility(Aluminum_alloy_6061T6, T=T)
ElectricalResistivity(Material, T=)Electrical resistivity, from the built-in data.
  • Material — material name
  • T= — temperature
Example: rho_e = ElectricalResistivity(Copper, T=T)
UltimateStress(Material, T=)Ultimate tensile stress in MPa.
  • Material — material name
  • T= — temperature
Example: S_u = UltimateStress(Aluminum_alloy_6061T6, T=T)
UltimateStressComp(Material, T=)Ultimate compressive stress in MPa.
  • Material — material name
  • T= — temperature
Example: S_uc = UltimateStressComp(Aluminum_alloy_6061T6, T=T)
UltimateStressShear(Material, T=)Ultimate shear stress in MPa.
  • Material — material name
  • T= — temperature
Example: S_us = UltimateStressShear(Aluminum_alloy_6061T6, T=T)
YieldStress(Material, T=)Yield stress in MPa.
  • Material — material name
  • T= — temperature
Example: S_y = YieldStress(Aluminum_alloy_6061T6, T=T)
YieldStressShear(Material, T=)Shear yield stress in MPa.
  • Material — material name
  • T= — temperature
Example: S_ys = YieldStressShear(Aluminum_alloy_6061T6, T=T)
VaporPressure(Fluid, T=)Vapour pressure of a liquid of the Incompressible library at T, in the file's pressure unit.
  • Fluid — liquid name
  • T= — temperature
Example: P_v = VaporPressure(Therminol_66, T=T)

Psychrometrics (AirH2O: P= and two of T=, w=, R=, D=, B=, h=, v=; per kg of dry air)

FunctionWhat it does, its parameters, an example
HumRat(AirH2O, T=, P=, R=)Humidity ratio w, kg water per kg dry air.
  • AirH2O — moist air
  • T= — first input besides P: T=, w=, R=, D=, B=, h=, v=
  • P= — total pressure
  • R= — second input, e.g. relative humidity 0..1
Example: w_1 = HumRat(AirH2O, T=T_1, P=P_atm, R=0.5)
RelHum(AirH2O, T=, P=, w=)Relative humidity, 0..1.
  • AirH2O — moist air
  • T= — first input besides P
  • P= — total pressure
  • w= — second input, e.g. humidity ratio
Example: phi_2 = RelHum(AirH2O, T=T_2, P=P_atm, w=w_1)
WetBulb(AirH2O, T=, P=, R=)Thermodynamic wet-bulb temperature.
  • AirH2O — moist air
  • T= — first input besides P
  • P= — total pressure
  • R= — second input
Example: T_wb = WetBulb(AirH2O, T=30, P=101.325, R=0.4)
DewPoint(AirH2O, T=, P=, R=)Dew-point temperature.
  • AirH2O — moist air
  • T= — first input besides P
  • P= — total pressure
  • R= — second input
Example: T_dp = DewPoint(AirH2O, T=T_1, P=P_atm, w=w_1)
(T, v, h, s, u, w, R, B, D) = PsychProps(AirH2O, T=, P=, R=)Every psychrometric property of a moist-air state at once; AirH2O may be left out. Empty output places are skipped.
  • AirH2O — optional: moist air
  • T= — first input besides P
  • P= — total pressure
  • R= — second input
  • T — output: dry-bulb temperature
  • v — output: volume per kg dry air
  • h — output: enthalpy per kg dry air
  • s — output: entropy per kg dry air
  • u — output: internal energy per kg dry air
  • w — output: humidity ratio
  • R — output: relative humidity
  • B — output: wet bulb
  • D — output: dew point
Example: (T, v, h, s, u, w, R, B, D) = PsychProps(AirH2O, T=25, P=101.325, R=0.5)

Property routines with several outputs and NASA data

FunctionWhat it does, its parameters, an example
(T, P, v, h, s, u, x) = RealThermoProps(Fluid$, T=, P=)The thermodynamic properties of a real-fluid state at once; an output that is also an input is not set again.
  • Fluid$ — fluid name
  • T= — first state input
  • P= — second state input
  • T — output: temperature
  • P — output: pressure
  • v — output: specific volume
  • h — output: enthalpy
  • s — output: entropy
  • u — output: internal energy
  • x — output: quality
Example: (T, P, v_1, h_1, s_1, u_1, x_1) = RealThermoProps(Water, T=T_1, P=P_1)
(T, P, v, h, s, u) = IdealGasThermoProps(Fluid$, T=, P=)The thermodynamic properties of an ideal-gas state at once.
  • Fluid$ — ideal-gas name
  • T= — first state input
  • P= — second state input
  • T — output: temperature
  • P — output: pressure
  • v — output: specific volume
  • h — output: enthalpy
  • s — output: entropy
  • u — output: internal energy
Example: (T, P, v_1, h_1, s_1, u_1) = IdealGasThermoProps(CO2, T=T_1, P=P_1)
(cp, h, s) = NASA(Name$, T)NASA polynomial data of a species, T in K and molar SI results (kJ/(kmol*K), kJ/kmol) whatever the unit system.
  • Name$ — NASA species, e.g. 'CO2', 'C(gr)'
  • T — temperature, K
  • cp — output: molar cp
  • h — output: molar enthalpy
  • s — output: molar entropy (at 1 bar)
Example: (cp, h, s) = NASA('CO2', 1500)
(cp, h, s) = NASA_Units(Name$, T)As NASA, with T and the results in the file's units.
  • Name$ — species name
  • T — temperature in the file's unit
  • cp — output: cp
  • h — output: enthalpy
  • s — output: entropy
Example: (cp, h, s) = NASA_Units('H2O', T_g)

Lithium bromide-water (fixed units: C, kPa, % LiBr, kJ/kg)

FunctionWhat it does, its parameters, an example
X_LiBr('SI', T, P)Equilibrium LiBr mass fraction (%) of the solution at T (C) and P (kPa).
  • 'SI' — unit system: only 'SI' is supported
  • T — solution temperature, C
  • P — pressure, kPa
Example: X_strong = X_LiBr('SI', T_gen, P_high)
T_LiBr('SI', P, X)Equilibrium solution temperature (C) at P (kPa) and X (% LiBr), Dühring relation.
  • 'SI' — unit system: only 'SI'
  • P — pressure, kPa
  • X — LiBr mass fraction, %
Example: T_abs = T_LiBr('SI', P_low, X_weak)
P_LiBr('SI', T, X)Equilibrium vapour pressure (kPa) at T (C) and X (% LiBr).
  • 'SI' — unit system: only 'SI'
  • T — solution temperature, C
  • X — LiBr mass fraction, %
Example: P_g = P_LiBr('SI', T_gen, X_strong)
H_LiBr('SI', T, X)Solution enthalpy (kJ/kg) at T (C) and X (% LiBr), ASHRAE polynomial.
  • 'SI' — unit system: only 'SI'
  • T — temperature, C
  • X — LiBr mass fraction, %
Example: h_5 = H_LiBr('SI', T_5, X_strong)
Cp_LiBr('SI', T, X)Solution specific heat (kJ/(kg*K)) at T (C) and X (% LiBr).
  • 'SI' — unit system: only 'SI'
  • T — temperature, C
  • X — LiBr mass fraction, %
Example: c_sol = Cp_LiBr('SI', T, X)
S_LiBr('SI', T, X)Solution entropy (kJ/(kg*K)) at T (C) and X (% LiBr); only differences are meaningful.
  • 'SI' — unit system: only 'SI'
  • T — temperature, C
  • X — LiBr mass fraction, %
Example: s_5 = S_LiBr('SI', T_5, X_strong)
V_LiBr('SI', T, X)Solution specific volume (m³/kg) at T (C) and X (% LiBr).
  • 'SI' — unit system: only 'SI'
  • T — temperature, C
  • X — LiBr mass fraction, %
Example: v_sol = V_LiBr('SI', T, X)

Chemical equilibrium and combustion (Gibbs minimisation; reactants as 'CH4:1 O2:2 N2:7.52')

FunctionWhat it does, its parameters, an example
EqMoleFraction(Reactants$, Species, T=, P=)Mole fraction of a product species in the equilibrium mixture at T and P; h= instead of T= gives the adiabatic state.
  • Reactants$ — reactant moles, e.g. 'CH4:1 O2:2 N2:7.52'
  • Species — product species, e.g. CO
  • T= — temperature (or h=, enthalpy per kg)
  • P= — pressure (1 atm when left out)
Example: y_CO = EqMoleFraction('CH4:1 O2:2 N2:7.52', CO, T=2000, P=101.325)
EqTemperature(Reactants$, h=, P=)Temperature of the equilibrium mixture with enthalpy h (per kg): the adiabatic flame temperature when h is the reactants' enthalpy.
  • Reactants$ — reactant moles, e.g. 'CH4:1 O2:2 N2:7.52'
  • h= — mixture enthalpy per kg
  • P= — pressure
Example: T_ad = EqTemperature(R$, h=ReactantEnthalpy(R$, T=25), P=101.325)
EqEnthalpy(Reactants$, T=, P=)Enthalpy per kg of the equilibrium mixture at T and P.
  • Reactants$ — reactant moles
  • T= — temperature
  • P= — pressure
Example: h_prod = EqEnthalpy('CH4:1 O2:2 N2:7.52', T=1500, P=101.325)
ReactantEnthalpy(Reactants$, T=)Enthalpy per kg of the unreacted mixture at T.
  • Reactants$ — reactant moles
  • T= — temperature
Example: h_react = ReactantEnthalpy('CH4:1 O2:2 N2:7.52', T=25)

Conjugate Bayesian updates (eqs-core/src/bayes/conjugate.rs; level in %, or a fraction ≤ 1)

FunctionWhat it does, its parameters, an example
(a_post, b_post, mean, low, high) = BetaUpdate(a, b, successes, trials, level)A beta(a, b) prior on a probability updated by binomial counts: beta(a + successes, b + trials − successes), its mean and the equal-tailed credible interval at level %.
  • a — prior a > 0 (1 for a flat prior)
  • b — prior b > 0
  • successes — number of successes (or failures counted)
  • trials — number of trials
  • level — credible level in %, e.g. 95
  • a_post — output: posterior a
  • b_post — output: posterior b
  • mean — output: posterior mean
  • low — output: lower end
  • high — output: upper end
Example: (a_p, b_p, p_fail, p_lo, p_hi) = BetaUpdate(1, 1, 3, 20, 95)
(mu_post, sd_post, low, high) = NormalUpdate(mu0, sd0, xbar, sd, n, level)A normal prior on a mean updated by n measurements of known sd averaging xbar (the precisions 1/sd² add), with the credible interval at level %.
  • mu0 — prior mean
  • sd0 — prior sd > 0
  • xbar — mean of the measurements
  • sd — sd of one measurement > 0
  • n — number of measurements
  • level — credible level in %
  • mu_post — output: posterior mean
  • sd_post — output: posterior sd
  • low — output: lower end
  • high — output: upper end
Example: (mu, sd, lo, hi) = NormalUpdate(50, 10, 47.3, 2, 8, 95)
(shape_post, rate_post, mean, low, high) = GammaPoissonUpdate(shape, rate, events, exposure, level)A rate (events per hour, per km …) with a gamma(shape, rate) prior updated by a count of events over an exposure: gamma(shape + events, rate + exposure), its mean and the credible interval at level %.
  • shape — prior shape > 0
  • rate — prior rate > 0 (in exposure units)
  • events — events counted
  • exposure — hours, km … observed
  • level — credible level in %
  • shape_post — output: posterior shape
  • rate_post — output: posterior rate
  • mean — output: posterior mean rate
  • low — output: lower end
  • high — output: upper end
Example: (k, r, lambda, lo, hi) = GammaPoissonUpdate(2, 1000, 4, 3500, 95)

Other functions

FunctionWhat it does, its parameters, an example
ChangeFileDir$(Path$, Dir$)The file of the path moved into folder Dir$.
  • Path$ — a path
  • Dir$ — folder
Example: f$ = ChangeFileDir$('run.csv', ModelFileDir$)
ChangeFileExt$(Path$, Ext$)The path with its extension replaced by Ext$ (give the dot).
  • Path$ — a path
  • Ext$ — new extension, e.g. '.csv'
Example: csv$ = ChangeFileExt$(ModelFileName$, '.csv')
Chr$(code)The character with this code (0 … 255).
  • code — character code
Example: deg$ = Chr$(176)
Concat$(a$, b$, ...)The texts joined together (any number of them).
  • a$ — first text
  • b$ — second text
  • ... — more texts
Example: F$ = Concat$('R', '134a')
Copy$(s$, start, count)Part of the text: count characters from the 1-based start (to the end when count is left out).
  • s$ — text
  • start — first character, 1-based
  • count — optional: number of characters
Example: y$ = Copy$(date$, 7, 4)
Date$Today's date as mm/dd/yyyy (UTC), the order Date() reads back.
Example: today$ = Date$
DateTime$Date and time now, 'mm/dd/yyyy hh:mm:ss' (UTC).
Example: stamp$ = DateTime$
Delete$(s$, start, count)The text with count characters removed from the 1-based start.
  • s$ — text
  • start — first character removed, 1-based
  • count — number of characters removed
Example: s$ = Delete$('R-134a', 2, 1)
FluidType$(Fluid)The kind of fluid: 'Ideal', 'Real', 'Incompressible', 'Brine', 'Mixture' (NH3H2O) or 'Psychrometric' (AirH2O).
  • Fluid — fluid name
Example: k$ = FluidType$(F$)
Insert$(a$, s$, pos)a$ inserted into s$ before the 1-based position pos.
  • a$ — text to insert
  • s$ — text inserted into
  • pos — position, 1-based
Example: s$ = Insert$('-', 'R134a', 2)
Kelvin_bei`(x)Derivative d bei(x)/dx of the Kelvin function bei.
  • x — argument ≥ 0
Example: db = Kelvin_bei`(2)
Kelvin_ber`(x)Derivative d ber(x)/dx of the Kelvin function ber (Kelvin_ber'(x) is accepted too).
  • x — argument ≥ 0
Example: db = Kelvin_ber`(2)
Kelvin_kei`(x)Derivative d kei(x)/dx of the Kelvin function kei.
  • x — argument > 0
Example: dk = Kelvin_kei`(2)
Kelvin_ker`(x)Derivative d ker(x)/dx of the Kelvin function ker.
  • x — argument > 0
Example: dk = Kelvin_ker`(2)
Lookup$(Table$, row, col)The text of a lookup-table cell ('' when empty).
  • Table$ — lookup table name
  • row — row number, 1-based
  • col — column name or number
Example: F$ = Lookup$('Fuels', 2, 'Name')
Lookup$Row(Table$, col, s$)The 1-based row whose cell in column col holds the text s$ (case ignored); 0 when none.
  • Table$ — lookup table name
  • col — column name or number
  • s$ — text to find
Example: r = Lookup$Row('Fuels', 'Name', 'Methane')
LookupColName$(Table$, col)The name of a lookup-table column ('??' when there is none).
  • Table$ — lookup table name
  • col — column number
Example: c$ = LookupColName$('Data', 2)
LookupColUnits$(Table$, col)The unit of a lookup-table column ('??' when there is no such column).
  • Table$ — lookup table name
  • col — column name or number
Example: u$ = LookupColUnits$('Data', 'T')
LookupTabName$(n)The name of the n-th lookup table ('' when there are fewer).
  • n — table number, 1-based
Example: t$ = LookupTabName$(1)
LowerCase$(s$)The text in lower case.
  • s$ — text
Example: L$ = LowerCase$(name$)
ModelFileDir$The model file's folder, ending in a separator.
Example: out$ = Concat$(ModelFileDir$, 'results.csv')
ModelFileName$The full path of the model file.
Example: f$ = ModelFileName$
Phase$(Fluid, T=, P=)The phase of a state as text: 'supercritical', 'superheated', 'saturated', 'liquid', 'solid', 'ideal gas', 'incompressible solid' or 'incompressible liquid'.
  • Fluid — fluid name
  • T= — first state input (T=, P=, h=, s=, u=, v=, x=)
  • P= — second, independent state input
Example: ph$ = Phase$(Water, T=T_1, P=P_1)
Replace$(a$, b$, s$)s$ with its first occurrence of a$ (case ignored) replaced by b$.
  • a$ — text to find
  • b$ — replacement
  • s$ — text searched
Example: f$ = Replace$('.csv', '.txt', file$)
ShortFileName$(Path$)The file name of a path without its folder.
  • Path$ — a path
Example: n$ = ShortFileName$(ModelFileName$)
String$(x, format$)A number as text: 'A' automatic (whole numbers without decimals, else 6 significant figures), 'Fn' n decimals, 'En' exponent form, 'Gn' engineering form.
  • x — number (a known constant)
  • format$ — optional: 'A', 'F2', 'E3', 'G3' …
Example: label$ = Concat$('T = ', String$(T_1, 'F1'))
TableName$The name of the Parametric table being solved ('' in a plain solve).
Example: t$ = TableName$
TableTabName$(n)The name of the n-th Parametric table; 0 gives the table being solved.
  • n — table number, 1-based, or 0
Example: t$ = TableTabName$(0)
Time$The time now as hh:mm:ss (UTC).
Example: now$ = Time$
TimeStamp$(File$)When the file was last changed, as DateTime$ writes it ('' when there is no such file); relative names are in the model's folder.
  • File$ — file name or path
Example: t$ = TimeStamp$('data.csv')
Trim$(s$)The text without leading and trailing spaces.
  • s$ — text
Example: n$ = Trim$(raw$)
UnitsOf$(X)The unit the solution gives variable X (worked out after the solve).
  • X — a variable
Example: u$ = UnitsOf$(P_1)
UnitSystem$(Kind$)The file's unit for a kind of quantity: 'Temperature' → 'C', 'Pressure' → 'kPa', 'Energy' → 'kJ/kg', also 'Entropy', 'Volume', 'Density', 'Mass' (Mass/Molar), 'Trig' (Deg/Rad); anything else gives 'SI' or 'Eng'.
  • Kind$ — 'Temperature', 'Pressure', 'Energy', 'Entropy', 'Volume', 'Density', 'Mass', 'Trig'
Example: T_unit$ = UnitSystem$('Temperature')
UpperCase$(s$)The text in upper case.
  • s$ — text
Example: U$ = UpperCase$(name$)

Statements and settings

The words of the language, as the editor completes them at the start of a line, and the settings a file can carry.

Statements

FormWhat it does
s1 = state(Water, P=10 kPa, x=0)a state: s1.h, s1.s … are its properties
default T_in = 20 °Ca value a study, a slider or the optimiser may replace
guess T_out = 100 °Cthe solver's start value
function f(a, b) [-> (x, y)] … endcode that runs step by step; call it (x, y) = f(1, 2)
component hx(m, cp) -> (Q) … endequations solved with the model
subprogram s(a) -> (x) … endequations solved on their own for each call
endcloses function, component, for, if, case, when, after solve
return expra function's result
if c then a else ba choice in an equation (end closes an if block in a function)
then
else
elseif c then
for i in 1..N … endequations for each i; sum(x[i] for i in 1..N)
in
repeat … until x > 5a loop in a function
until x > 5ends a repeat loop when true
after solve … endsolved after the rest; sum_sweep(Q) after a study
initial T = 90 °Cthe start value of der(T)
simulate time from 0 to 3600 step 10 record Ta time run
stop when T < 40 °Cends the time run early
method bdf2trapezoid, bdf1 … bdf5, adaptive
sweep T_in from 20 to 80 step 10a study: points 7, or in [20, 40, 60]; two sweeps make a grid
plot Q, eta vs T_in title 'Duty'drawn after the study
maximize f over x in 0..1 subject to g <= 2optimisation
minimize f over x in 0..1optimisation
uncertainty of q given x ± 0.5, y ± 5%uncertainty propagation
units SI °C kPa kJ mass degreesthe unit system
use heat_transfera shipped library
include 'parts.eqs'a file of yours
check eta = 0.42 ± 1%an expected value
report 'The efficiency is {eta:3}.'a line of the report
key Q 'heat duty'a key result
mixture flue = N2:0.75, CO2:0.25an ideal-gas mixture
constant n = 20a constant of the file

Settings

LineWhat it does
units SI °C kPa kJ mass degreesunits for properties and trig (also radians, molar, °F, bar, MPa …)
use heat_transfera shipped library: fins, Nusselt, effectiveness-NTU, radiation
include 'parts.eqs'a file of yours
mixture flue = N2:0.75, CO2:0.1, H2O:0.1, O2:0.05an ideal-gas mixture (mole fractions; add mass)
refcalcmixture ng C1:0.9 C2:0.07 C3:0.03a Peng-Robinson mixture from a RefCalc server
refcalc 'http://localhost:8091'the RefCalc server, in quotes (default localhost:8080)
checkunits offno unit check until checkunits on
report 'The result is {x:3}.'report summary with live values
check x = 1.5 ± 1%expected value for eqs check (relative with %, else absolute)
varinfo x units=kPaa variable's unit and display format
defineunits kJ/h 0.000277778 kWa new unit as a factor times an existing one
guess x = 5start value
0 <= x <= 100bounds
exchangerate 1 EUR = 4.97 RONties two currencies: the unit check compares them and convert(EUR, RON) gives the rate
simulate t from 0 to 10 step 0.01 record yder(x) notation: integration variable, start, end, step, the columns of the time table
initial x = 1the start value of a der() state
integraltable t:0.1 yintegral(): the time march step and columns
integralautostep Min=1e-4 Max=0.5 Reduce=1e-3 Increase=1e-5adaptive step
stop when y < 0.05end the march when true
method bdf2stiff problems: backward difference of order 1-5 (bdf1 … bdf5); also trapezoid, adaptive
when h < 0 reinit v = -0.8*van event: the state jumps when the condition becomes true
when Re < 2300conditional equations: the lines up to otherwise hold when true, the rest up to end otherwise; chosen by the solution
otherwisethe other branch of a when block
case designthe equations of one case up to end; use case design chooses it
use case designthe case to solve
complex onevery variable complex; 4i, j, polar()
maximize f over x in 0..5also minimize; add subject to g <= 1 and method golden|quadratic|conjugate-directions|variable-metric|nelder-mead|direct|genetic; n in 1..20 integer keeps n a whole number
subject to V >= 0.001a condition on any computed quantity during an optimisation or Min/Max (<=, >=, =)
uncertainty of f given x ± 0.1or x ± 5% relative to the value
connect pump.out boiler.instream connection: pump.out.x = boiler.in.x for every field x both use; ': T, P' to choose
newplot Table='Table 1' X='m' Y='Q' Title='Duty' Lines=1 Symbols=1a plot drawn after the table runs (also XMin/XMax/YMin/YMax/XLog/YLog/Grid/Rows=1..10/Kind=bar|polar/Legend)
overlayplot Title='Duty' X='m' Y='T_out' RightAxis=1adds curves to the plot with that title
propertyplot Water T-s 2 100 1000 0 1 1 Name='Cycle'a property plot after the solve with the state points: Fluid Type (T-s, P-h, T-v, T-rho, P-v, h-s, T-h, P-T, psychrometric) N1 values N2 values [H] DEF DoQLines TMin TMax PMin PMax; a brine: Fluid Property N C… TMin TMax
modifyaxis Y Name='Cycle' 0 T_max 0 50 Linear 1an axis of a plot: Min Max (numbers or variables) AutoScale Interval Linear|Log Grids
savetable 'Arrays' 'file.csv'after the solve: a table to a file (.csv, .txt, .dat); 'Lookup 1', 'Parametric:Table 1', 'Integral'; /R2..5 /C1..3 rows and columns, /T transpose, /Q no quotes, /N /E lookup-text header, /A append
savelookup 'Table' 'file.csv'a lookup table to a file after the solve
exporttext 'file.txt' S$[1..N]strings to a file, one per line (/A appends)
importtext 'file.txt' /skiplines=1 S$[1..N]whole lines of a file into string variables, before the solve
exportplot 'plot.png' 1 /R=2a plot saved after the solve (.png, .jpg, .svg; by name or number; /R resolution 0-4)
clearparametric 'Table 1' /A /R1..10clear a parametric table's computed cells (all with /A) before the solve
savevarinfo 'model.var'every variable's unit and format as varinfo lines after a solve (include reads them)

Property calls at a glance

The forms the editor completes; the full descriptions are in the function tables above.

CallResult
enthalpy(Fluid, T=, P=)kJ/kg
entropy(Fluid, T=, P=)kJ/(kg*K)
intenergy(Fluid, T=, P=)kJ/kg
temperature(Fluid, P=, h=)
pressure(Fluid, T=, s=)
density(Fluid, T=, P=)kg/m^3
volume(Fluid, T=, P=)m^3/kg
quality(Fluid, P=, h=)0..1 in the dome
cp(Fluid, T=, P=)kJ/(kg*K)
cv(Fluid, T=, P=)
viscosity(Fluid, T=, P=)Pa*s
conductivity(Fluid, T=, P=)W/(m*K)
prandtl(Fluid, T=, P=)
soundspeed(Fluid, T=, P=)m/s
t_sat(Fluid, P=)saturation temperature
p_sat(Fluid, T=)saturation pressure
eos_tmin(Fluid)equation-of-state limits: also eos_tmax, eos_pmax
gwp(Fluid)global warming potential (100 yr); also odp
joulethomson(Fluid, T=, P=)dT/dP at constant enthalpy
gibbs(Fluid, T=, P=)Gibbs free energy; also helmholtz
t_crit(Fluid)
p_crit(Fluid)
molarmass(Fluid)kg/kmol
EqMoleFraction('CH4:1 O2:2 N2:7.52', CO, T=, P=)chemical equilibrium (Gibbs minimisation): mole fraction of a product; h= instead of T= for the adiabatic state
EqTemperature('CH4:1 O2:2 N2:7.52', h=, P=)equilibrium (adiabatic flame) temperature for the mixture enthalpy h
EqEnthalpy('CH4:1 O2:2 N2:7.52', T=, P=)enthalpy of the equilibrium mixture, per kg
ReactantEnthalpy('CH4:1 O2:2 N2:7.52', T=)enthalpy of the unreacted mixture, per kg
humrat(AirH2O, T=, P=, R=)humidity ratio
relhum(AirH2O, T=, P=, w=)
wetbulb(AirH2O, T=, P=, R=)
dewpoint(AirH2O, T=, P=, R=)

Menu commands

Every command of the menu bar, with its keyboard shortcut. Ctrl+Shift+P opens the command search, which finds any of them by name; on the Mac, Cmd stands for Ctrl.