The Calcpad language

Description

Calcpad uses a simple programming language for the development of engineering worksheets. It mostly includes mathematical expressions, mixed with text/Html comments. Some advanced options for conditional execution, iterations, units and numerical methods are also available. Detailed description is provided in the user manual. Bellow, you can find a quick reference guide:

Expressions

Constants

Real

All real values are stored in double precision floating point fields. They can range from -1.7976931348623157E+308 to 1.7976931348623157E+308. The smallest nonzero value is 4.94065645841247E-324. Smaller values are considered exactly zero. You can use the following input formats:

FormatPositiveNegative
Integer34-34
Decimal3.45-3.45
Fraction3/4-3/4
Exponential3.4*10^5-3.4*10^5

The last two formats are nothing but simple expressions.

Complex

Complex numbers are represented by a couple of values ±a ± bi, where “a” is the real part, and “bi” is called “imaginary”. The imaginary unit in Calcpad is entered as 1i. It is defined so that (1i)^2 = -1. You must switch to “Complex” mode in order to use complex numbers.

Predefined

There are four predefined constants that are stored as named variables:
e = 2.71828182845905 – the base of the natural logarithms (Euler’s number);
π = 3.14159265358979 – (Pi) the ratio of circumference to diameter of a circle;
i = 1i – the imaginary unit.
ei = e·i;
πi = π·i.

Variables

Variable names can contain Latin and Greek letters, digits, commas “,”, underscores “_” and some special symbols: ” ′, ″,  ‴, ⁗, ø, Ø, °, ∡”. The first character must be a letter. The underscore is used to start a subscript. Variables are created by assigning a value, e.g.:
a_1 = 2

Operators

You can use the following operators with Calcpad:

SymbolDescription
!factorial
^exponent
/division
÷division bar
*multiplication
subtraction
+addition
\integer division
modulo (reminder)
equal
unequal
<less than
>greater than
less or equal
greater or equal
logical “and”
logical “or”
logical “xor”
=assignment
 ?input field

Instead of special symbols for comparison operators , , , you can use C/C++ style shortcuts, respectively: ==, !=, <=, >=.

Functions

Built-in

The following functions are predefined and can be used directly:

NameDescription
abs(x)absolute value (modulus) |x|
sin(x)sine
cos(x)cosine
tan(x)tangent = sin(x)/cos(x), for each x, k=1, 2, 3…
csc(x)cosecant = 1 / sin(x)
sec(x)secant = 1 / cos(x)
cot(x)cotangent = cos(x) / sin(x), for each x ≠ π/2 + kπ, k=1, 2, 3…
asin(x)inverse sine, defined for -1 ≤ x ≤ 1
acos(x)inverse cosine, defined for -1 ≤ x ≤ 1
atan(x)inverse tangent
atan2(x; y)the angle which tangent is y/x
acsc(x)inverse cosecant = asin(1/x)
asec(x)inverse secant = acos(1/x)
acot(x)inverse cotangent = atan(1/x)
sinh(x)hyperbolic sine = (exex) / 2
cosh(x)hyperbolic cosine = (ex + ex) / 2
tanh(x)hyperbolic tangent = (exex) / (ex + ex)
csch(x)hyperbolic cosecant = 1 / sinh(x)
sech(x)hyperbolic secant = 1 / cosh(x)
coth(x)hyperbolic cotangent = 1 / tanh(x) = (ex + ex)/  (exex), for x ≠ 0
asinh(x)inverse hyperbolic sine = ln(x + √(x2 + 1)), for -∞ ≤ x ≤ +∞
acosh(x)inverse hyperbolic cosine = ln(x + √(x + 1)·√(x – 1)), for x ≥ 1
atanh(x)inverse hyperbolic tangent = 1/2·ln[(1 + x) / (1 – x)],
for -1 < x < 1
csc(x)inverse hyperbolic cosecant = asinh(1/x)
sec(x)inverse hyperbolic secant = acosh(1/x)
acoth(x)inverse hyperbolic cotangent
= atanh(1/x) = 1/2·ln[(x + 1) / (x – 1)], for |x| > 1
log(x)decimal logarithm (with base 10), for each x > 0
ln(x)natural logarithm (with base e ≈ 2.7183), for each x > 0
log_2(x)binary logarithm (with base 2)
exp(x)exponential function = ex
sqr(x) or sqrt(x)square root (√x), defined for each x ≥ 0
cbrt(x)cubic root (³√x)
root(x; n)n-th root (nx)
round(x)rounds to the nearest integer
floor(x)rounds to the smaller integer
ceiling(x)rounds to the greater integer
trunc(x)rounds to the nearest integer towards zero
mod(x; y)the reminder of an integer division
gcd(x; y)the greatest common divisor of two integers
lcm(x; y)the least common multiple of two integers
re(a + bi)the real part of a complex number, re(a + bi) = a
im(a + bi)the imaginary part as a real number, im(a + bi) = b
abs(a + bi)complex number modulus = sqrt(a^2 + b^2)
phase(x)complex number phase (argument) = atan2(a; b)
min(x; y; z…)the smallest of multiple values
max(x; y; z…)the greatest of multiple values
sum(x; y; z…)sum of multiple values = x + y + z
sumsq(x; y; z…)sum of squares = x² + y² + z²…
srss(x; y; z…)square root of sum of squares = sqrt(x² + y² + z²…)
average(x; y; z…)average of multiple values = (x + y + z…)/n
product(x; y; z…)product of multiple values = x·y·z
mean(x; y; z…)geometric mean = n-th root(x·y·z…)
take(na; bc…)returns the n-th element from the list
line(xa; bc…)linear interpolation
spline(xa; bc…)Hermite spline interpolation
if(cond;
val-if-true;
val-if-false)
conditional evaluation
switch(
cond1; value1;
cond2; value2; …; default)
selective evaluation
not(x) logical “not”
and(x; y; z…)logical “and”
or(x; y; z…)logical “or”
xor(x; y; z…)logical “xor”
sign(x)sign of a number = -1, if x < 0;
1, if x > 0;
0 if x = 0.
random(x)random number between 0 and x
vector(n)creates an empty vector with length n
fill(v; x)fills vector v with value x
range(x1; xn; step)creates a vector with values spanning from x1 to xn with step step
len(v)returns the length of vector v
size(v)the actual size of vector v (the index of the last non-zero element)
resize(v; n)sets a new length n of vector v
join(M; v; x…)creates a vector by joining the arguments: matrices, vectors and scalars
slice(v; i1; i2)returns the part of vector v bounded by indexes i1 and i2 inclusive
first(v; n)the first n elements of vector v
last(v; n)the last n elements of vector v
extract(v; vi)extracts the elements from v which indexes are contained in vi
sort(v)sorts the elements of vector v in ascending order
rsort(v)sorts the elements of vector v in descending order
order(v)the indexes of vector v, arranged by the ascending order of its elements
revorder(v)the indexes of vector v, arranged by the descending order of its elements
reverse(v)a new vector containing the elements of v in reverse order
count(v; x; i)the number of elements in v, after the i-th one, that are equal to x
search(v; x; i)the index of the first element in v, after the i-th one, that is equal to x
find_ne(v; x; i) or
find_eq(v; x; i)
the indexes of all elements in v, after the i-th one, that are = x
find_ne(v; x; i)the indexes of all elements in v, after the i-th one, that are ≠ x
find_lt(v; x; i)the indexes of all elements in v, after the i-th one, that are < x
find_le(v; x; i)the indexes of all elements in v, after the i-th one, that are ≤ x
find_gt(v; x; i)the indexes of all elements in v, after the i-th one, that are > x
find_ge(v; x; i)the indexes of all elements in v, after the i-th one, that are ≥ x
lookup(a; b; x) or
lookup_eq(a; b; x)
all elements in a for which the respective elements in b are = x
lookup_ne(a; b; x)all elements in a for which the respective elements in b are ≠ x
lookup_lt(a; b; x)all elements in a for which the respective elements in b are < x
lookup_le(a; b; x)all elements in a for which the respective elements in b are ≤ x
lookup_gt(a; b; x)all elements in a for which the respective elements in b are > x
lookup_ge(a; b; x)all elements in a for which the respective elements in b are ≥ x
norm_1(v)L1 (Manhattan) norm of vector v
norm(v) or
norm_2(v) or
norm_e(v)
L2 (Euclidean) norm of vector v
norm_p(v; p)Lp norm of vector v
norm_i(v)L∞ (infinity) norm of vector v
unit(v)the normalized vector v (with L2 norm = 1)
dot(a; b)scalar (dot) product of two vectors a and b
cross(a; b)cross product of two vectors a and b (with length 2 or 3)
matrix(m; n)creates an empty matrix with dimensions mn
identity(n)creates an identity matrix with dimensions nn
diagonal(n; d)creates a nn diagonal matrix and fills the diagonal with value d
column(m; c)creates a column matrix with dimensions m⨯1, filled with value c
utriang(n)creates an upper triangular matrix with dimensions nn
ltriang(n)creates a lower triangular matrix with dimensions nn
symmetric(n)creates a symmetric matrix with dimensions nn
vec2diag(v)creates a diagonal matrix from the elements of vector
vec2row(v)creates a row matrix from the elements of vector
vec2col(v)creates a column matrix from the elements of vector
join_cols(c1; c2; c3…)creates a new matrix by joining column vectors
join_rows(r1; r2; r3…)creates a new matrix by joining row vectors
augment(A; B; C…)creates a new matrix by appending matrices A; B; C side by side
stack(A; B; C…)a new matrix by stacking matrices A; B; C one below the other
n_rows(M)number of rows in matrix M
n_cols(M)number of columns in matrix M
mresize(M; m; n)sets new dimensions m and n for matrix M
mfill(M; x)fills matrix M with value x
fill_row(M; i; x)fills the i-th row of matrix M with value x
fill_col(M; j; x)fills the j-th column of matrix M with value x
copy(A; B; i; j)copies all elements from A to B, starting from indexes i and j of B
add(A; B; i; j)adds all elements from A to those of B, starting from indexes i and j of B
row(M; i)extracts the i-th row of matrix M as a vector
col(M; j)extracts the j-th column of matrix M as a vector
extract_rows(M; vi)extracts the rows from matrix M whose indexes are contained in vector ⃗vi
diag2vec(M)extracts the diagonal elements of matrix M to a vector
submatrix(M;
i1; i2; j1; j2)
extracts a submatrix of M, bounded by rows i1 and i2 and columns j1 and j2, incl.
sort_cols(M; i)sorts the columns of M based on the values in row i in ascending order
rsort_cols(M; i)sorts the columns of M based on the values in row i in descending order
sort_rows(M; j)sorts the rows of M based on the values in column j in ascending order
rsort_rows(M; j)the rows of M based on the values in column j in descending order
order_cols(M; i)the indexes of the columns of M based on the ordering of the values from row i in ascending order
revorder_cols(M; i)the indexes of the columns of M based on the ordering of the values from row i in descending order
order_rows(M; j)the indexes of the rows of M based on the ordering of the values in column j in ascending order
revorder_rows(M; j)the indexes of the rows of M based on the ordering of the values in column j in descending order
mcount(M; x)number of occurrences of value x in matrix M
msearch(M; x; i; j)vector with the two indexes of the first occurrence of x in matrix M, starting from indexes i and j
mfind(M; x) or
mfind_eq(M; x)
the indexes of all elements in M that are = x
mfind_ne(M; x)the indexes of all elements in M that are ≠ x
mfind_lt(M; x)the indexes of all elements in M that are < x
mfind_le(M; x)the indexes of all elements in M that are ≤ x
mfind_gt(M; x)the indexes of all elements in M that are > x
mfind_ge(M; x)the indexes of all elements in M that are ≥ x
hlookup(M; x; i1; i2) or
hlookup_eq(M; x; i1; i2)
the values from row i2 of M, for which the elements in row i1 are = x
hlookup_ne(M; x; i1; i2)the values from row i2 of M, for which the elements in row i1 are ≠ x
hlookup_lt(M; x; i1; i2)the values from row i2 of M, for which the elements in row i1 are < x
hlookup_le(M; x; i1; i2)the values from row i2 of M, for which the elements in row i1 are ≤ x
hlookup_gt(M; x; i1; i2)the values from row i2 of M, for which the elements in row i1 are > x
hlookup_ge(M; x; i1; i2)the values from row i2 of M, for which the elements in row i1 are ≥ x
vlookup(M; x; i1; i2) or
vlookup_eq(M; x; i1; i2)
the values from column j2 of M, for which the elements in column j1 are = x
vlookup_ne(M; x; i1; i2)the values from column j2 of M, for which the elements in column j1 are ≠ x
vlookup_lt(M; x; i1; i2)the values from column j2 of M, for which the elements in column j1 are < x
vlookup_le(M; x; i1; i2)the values from column j2 of M, for which the elements in column j1 are ≤ x
vlookup_gt(M; x; i1; i2)the values from column j2 of M, for which the elements in column j1 are > x
vlookup_ge(M; x; i1; i2)the values from column j2 of M, for which the elements in column j1 are ≥ x
hprod(A; B)Hadamard product of matrices A and B
fprod(A; B)Frobenius product of matrices A and B
kprod(A; B)Kronecker product of matrices A and B
mnorm_1(M)L1 norm of matrix M
mnorm(M) or
mnorm_2(M)
L2 norm of matrix M
mnorm_e(M)Frobenius norm of matrix M
mnorm_i(M)L∞ norm of matrix M
cond_1(M)condition number of M based on the L1 norm
cond(M) or
cond_2(M)
condition number of M based on the L2 norm
cond_e(M)condition number of M based on the Frobenius norm
cond_i(M)condition number of M based on the L∞ norm
det(M)determinant of matrix M
rank(M)rank of matrix M
trace(M)trace of matrix M
transp(M)transpose of matrix M
adj(M)adjugate of matrix M
cofactor(M)cofactor matrix of M
eigenvals(M)eigenvalues of matrix M
eigenvecs(M)eigenvectors of matrix M
eigen(M)eigenvalues and eigenvectors of matrix M
cholesky(M)Cholesky decomposition of a symmetric, positive-definite matrix M
lu(M)LU decomposition of matrix M
qr(M)QR decomposition of matrix M
svd(M)singular value decomposition of M
inverse(M)inverse of matrix M
lsolve(A; b)solves the system of linear equations Ax = b using LDLT decomposition for symmetric matrices, and LU for non-symmetric
clsolve(A; b)solves the linear matrix equation Ax = b with symmetric, positive-definite coefficient matrix A using Cholesky decomposition
msolve(A; B)solves the generalized matrix equation AX = B using LDLT decomposition for symmetric matrices, and LU for non-symmetric
cmsolve(A; B)solves the generalized matrix equation AX = B with symmetric, positive-definite coefficient matrix A using Cholesky decomposition
take(x; y; M)returns the element of matrix M at indexes x and y
line(x; y; M)double linear interpolation from the elements of matrix M based on the values of x and y
spline(x; y; M)double Hermite spline interpolation from the elements of matrix M based on the values of x and y

Custom

You can define custom functions of multiple arguments:
f(x; y; z; ...) = expression

Function names are subjected to the same rules as variable names (see above).

Plotting

There are several different plotting commands:
$Plot{y(x) @ x = a : b} – plots the function y(x) within the interval [a; b].
$Plot{y1(x) & y2(x) & ... @ x = a : b} – plots several functions y1(x), y2(x), etc. in a single plot.
$Plot{x(t) | y(t) @ t = a : b} – plots a curve where both x(t) and y(t) are functions of a single parameter t.
$Plot{x1(t) | y1(t) & x2(t) | y2(t) & ... @ t = a : b}
plots several parametric curves on a single plot.
$Map{f(x; y) @ x = a : b & y = c : d} – plots a function of two variables as a color/grayscale map.

The step between nodes for the $Map command in px is specified by setting the PlotStep variable. By setting PlotSVG = 1 (or any nonzero value) you can make Calcpad to use vector (SVG) format for function plots. Otherwise, the raster PNG format is used.

Size of plot area

You can specify the size of the plot area in pixels by defining the PlotWidth and PlotHeight variables, e.g.:

PlotWidth = 400
PlotHeight = 250

The above values are the default ones.

Numerical and iterative procedures

You can use numerical methods for problems that do not have a closed form solution:
$Root{f(x) = const @ x = a : b} – finds the root of the equation f(x) = const within the interval [a; b], using modified Anderson Bjork method.
$Root{f(x) @ x = a : b} – finds the root of the equation f(x) = 0.
$Find{f(x) @ x = a : b} – finds the point where the function crosses the abscissa (it is not required to be a root).
$Inf{f(x) @ x = a : b} – finds the minimum value f_inf of the function f(x), using the golden section search method. The location of minimum on the abscissa is stored in the x_inf variable.
$Sup{f(x) @ x = a : b} – finds the maximum value f_sup of the function f(x), using the golden section search method. The location of maximum on the abscissa is stored in the x_sup variable.
$Area{f(x) @ x = a : b} – finds the definite integral of the function f(x) in the interval [a; b], using the adaptive Gauss-Lobatto rule.
$Integral{f(x) @ x = a : b} – finds the definite integral of the function f(x) in the interval [a; b], using the double exponential Tanh-Sinh quadrature.
$Slope{f(x) @ x = a} – finds the slope of the tangent to f(x) at point x = a.
$Sum{f(k) @ k = a : b} – sums the values of f(x) for all integer values of k between a and b.
$Product{f(k) @ k = a : b} – multiplies the values of f(x) for all integer values of k between a and b.

You can use this command to define your own function for calculation of factorial and binomial coefficients:

F(n) = $Product{k @ k = 1 : n}
C(n; k) = $Product{(i + n - k)/i @ i = 1 : k}

$Repeat{f(k) @ k = a : b} – calculates f(x) repeatedly for all integer values of k between a and b.
$Repeat{x = f(x; k) @ k = a : b} – similar to the above, but sores the result into a variable to be used for the next iteration.

Precision – sets the relative precision for numerical methods [10-2; 10-16] (default is 10-12)

Units of measurement

Calcpad supports the use of physical units in the calculations. Just write the units next to the respective values. You can also specify target units for the result, separated by a vertical bar at the end:

1.23m + 35cm + 12mm|cm

The above expression will evaluate to 159.2 cm. Version 3.0 supports metric, imperial and US units.

Metric units (SI and compatible):

Physical propertyUnits of measurement
Dimensionless%, ‰, ‱, pcm, ppm, ppb, ppt, ppq;
Angles°, ′, ″, deg, rad, grad, rev
Massg (gram), hg, kg, t, kt, Mt, Gt, dg, cg, mg, μg, ng, pg, Da (Dalton), u
Lengthm (meter), km, dm, cm, mm, μm, nm, pm, AU (astronomical unit), ly (light year)
Times (second), ms, μs, ns, ps, min, h, d
FrequencyHz (Hertz), kHz, MHz, GHz, THz, mHz, μHz, nHz, pHz, rpm (rotations per minute)
Speedkmh (km per hour)
Electric currentA (Ampere), kA, MA, GA, TA, mA, μA, nA, pA
Temperature°C (degree Celsius), Δ°C (difference of one °C), K (Kelvin)
Amount of substancemol (mole)
Luminous intensitycd (candela)
Areaa (are), daa (decare), ha (hectare)
VolumeL (liter), mL, cL, dL, hL
ForceN (Newton), daN, hN, kN, MN, GN, TN, dyn, gf, kgf, tf
MomentNm (Newton-meter), kNm
PressurePa (Pascal), daPa, hPa, kPa, MPa, GPa, TPa, dPa, cPa, mPa, μPa, nPa, pPa, bar, mbar, μbar, atm, at, Torr, mmHg;
ViscosityP (Poise), cP, St (Stokes), cSt
Energy, workJ (Joule), kJ, MJ, GJ, TJ, mJ, μJ, nJ, pJ, Wh, kWh, MWh, GWh, TWh, cal, kcal, erg, eV, keV, MeV, GeV, TeV, PeV, EeV;
PowerW (Watt), kW, MW, GW, TW, mW, μW, nW, pW, hpM, ks;
Electric chargeC (Coulomb), kC, MC, GC, TC, mC, μC, nC, pC, Ah, mAh
PotentialV (Volt), kV, MV, GV, TV, mV, μV, nV, pV
CapacitanceF (Farad), kF, MF, GF, TF, mF, μF, nF, pF
ResistanceΩ (Ohm), , , , , , μΩ, ,
ConductanceS (Siemens), kS, MS, GS, TS, mS, μS, nS, pS
Magnetic fluxWb (Weber), kWb, MWb, GWb, TWb, mWb, μWb, nWb, pWb
Magnetic flux densityT (Tesla), kT, MT, GT, TT, mT, μT, nT, pT
InductanceH (Henry), kH, MH, GH, TH, mH, μH, nH, pH
Luminous fluxlm (lumen)
Illuminancelx (lux)
RadioactivityBq (Becquerel), kBq, MBq, GBq, TBq, mBq, μBq, nBq, pBq, Ci, Rd;
Absorbed doseGy (Gray), kGy, MGy, GGy, TGy, mGy, μGy, nGy, pGy;
Equivalent doseSv (Sievert), kSv, MSv, GSv, TSv, mSv, μSv, nSv, pSv;
Catalytic activitykat (katal)

Imperial/USCS units:

Physical propertyUnits of measurement
Massgr (grain), dr (drachm), oz (ounce), lb (pound), kip (kilopound), st (stone), qr (quarter), cwt (hundredweight), cwt_UK, cwt_US, ton, ton_UK, ton_US, slug
Lengthth (thou), in (inch), ft (foot), yd (yard), ch (chain), fur (furlong), mi (mile), ftm (fathom), cable, nmi (nautical mile), li (link), rod, pole, perch, lea (league)
Speedmph (miles per hour), knot
Temperature°F (degree Fahrenheit), Δ°F (difference of one °F), R (Rankine)
Arearood, ac (acre)
Volume (fluid)fl_oz (fluid ounce), gi (gill), pt (pint), qt (quart), gal (gallon), bbl (barrel), bu (bushel, dry)
fl_oz_UK, gi_UK, pt_UK, qt_UK, gal_UK, bbl_UK, bu_UK
fl_oz_US, gi_US, pt_US, qt_US, gal_US, bbl_US, bu_US
Forceozf (ounce-force), lbf (pound-force), kipf (kilopound-force), tonf (ton-force), pdl (poundal)
Pressureosi (ounce per sq. inch), osf (ounce per sq. foot), psi, psf, ksi, ksf, tsi, tsf, inHg

Custom units: .Name = expression.

Comments

Everything inside a Calcpad script is considered to be math expressions unless it is enclosed by quotes. Then it is treated as comments. You can use them to add contents to your calculation notes, such as titles, text, images, tables etc.

Comments can be enclosed in double (“) or single (‘) quotes. Double quotes are used for “titles” and single quotes for ‘normal text’. You can have several expressions in a single line, separated by comments. The closing quote is not required if there is nothing else in the line.

Comments can contain plain text as well as Html, CSS, JS (jQuery), SVG, etc. for providing rich formatting and user experience for your calculation notes. For example, you can use Html to fold part of the content:

'<div class="fold">
"This is a folded content
'This line is hidden until you unfold it
'</div>

Program flow control

You can split the flow of your calculation notes depending on certain intermediate values. It will not only use different formulas for calculations, but it can also display different text and images in your report.
You can use the following patterns:

Conditions

#If condition1
    'code if condition1 is true
#Else If condition2
    'code if condition2 is true
#Else If condition3
    ...
#Else
    'code if non of the conditions is true
#end if

Shorter forms are also possible:

#If condition
    'code if condition is true
#Else
    'code if conditions is false
#end if

or:

#If condition
    'code if condition is true
#end if

Loops

Simple:

#Repeat n
    'Put some code here
#Loop

Here n is the number of iterations and not the counter. If you need a counter, you can use a #For-#Loop block or define it as follows:

i = 0
#Repeat n
    i = i + 1
    'Put some code here
#Loop

With conditional break or continue:

#Repeat
   'Put some code here
    #If condition
        #Break or #Continue
    #End if
    'Some more code
#Loop

With counter:

#For counter = start : end
    'Put some code here
#Loop

With condition:

#While condition
    'Put some code here
#Loop

Modules and macros/string variables

Modules:

#Include filename – incudes external file/module
#Local – starts a local section in a module (not to be included)
#Global – starts a global section in a module (to be included)

Inline string variable:

#def variable_name$ = content

Multiline string variable:

#def variable_name$
    content line 1
    content line 2
    ...
#end def

Inline macro:

#def macro_name$(param1$; param2$; ...) = content

Multiline macro:

#def macro_name$(param1$; param2$; ...)
    content line 1
    content line 2
    ...
#end def

Output control

You can control the visibility of your code in the output using the following keywords:
#Hide – hide the contents after the current line;
#Pre – show the contents in input form mode only (see “Input forms” bellow) and hide it otherwise;
#Post – show the contents in calculated mode only and hide it in input form mode;
#Show – always show the contents (revoke all other commands);

You can also modify the rendering style of the calculations as follows:
#Val – shows only the result as a single value;
#Equ – shows the complete equation and the result;
#Noc – shows only the equation without the result (no-calculations).

Additionally, you can control the variable substitution behavior by using the following switches:
#nosub – do not substitute variables (no substitution);
#novar – show equations only with substituted values (no variables);
#varsub – show equations with variables and substituted values (default).

The following keywords control if long equation will be split or wrapped if do not fit on the line:
#split – split equations that do not fit on a single line;
#wrap – wrap equations that do not fit on a single line (default);

The next three keywords allows you to select the default units for angles inside your calculation notes:
#deg – assumes that angles are in degrees: sin(90) = 1;
#rad – assumes that angles are in radians: sin(π/2) = 1;
#gra – assumes that angles are in grades: sin(100) = 1;

Rounding options:
#round n – rounds the output to n digits after the decimal point;

Breakpoints for step-by-step execution:
#pause – calculates to the current line and waits for the user to resume manually;
#input – renders an input form to the current line and waits for user input.

These settings affect all calculations after the current line.