Changes compared to Calcpad VM 7.7.3
table function displays a matrix as a formatted table. Seven styles, cell alignment, merged cells and colors. Tables are exported to Word, LaTeX and Markdown.$Line, $Fill, $Smooth, $Bar, $Column, $Scatter, $Pie, $Donut, $Radar, $Bubble and the combined $Chart.Plot.* options add titles, axis labels, legends, logarithmic and reversed axes, limits, steps, grid spacing, and series colors and line styles. They replace the old PlotWidth, PlotHeight… variables.pv, fv, pmt, nper, rate, ipmt, ppmt, npv, irr and mirr. They work like the Excel functions.CP. functions for the thermophysical properties of more than 100 fluids and of humid air, calculated by the included CoolProp library, e.g. CP.Props("D"; "T"; 25°C; "P"; 1atm; "Water"). Inputs with units are converted to SI.log1p and ln1p stay accurate when x is small. geomean returns the geometric mean.3.4e+6). Numbers in bases 2 to 16 for input (FF_16) and output (x:_2, #format _16).*.tex file with native LaTeX math, or as a *.zip with the images for Overleaf. The CLI supports it too.#Header keyword puts the report into your company header template. Project, client, date and other fields are filled from macros and can be edited in the output.Plot., Table., Color., Style., CP. and HTML tags. Strings and number bases are highlighted.'"Title. Function names are case sensitive. mean is now the arithmetic mean. See Upgrading from 7.7.3.Some changes in 8.00 can affect existing worksheets. Check the following before you run older files:
| Change | Version 7.7.3 | Version 8.00 |
|---|---|---|
| Headings | "Title |
'"Title: a single quote, then a double quote, at the start of the line. Text in double quotes is now a string, so an old-style heading is reported as an unclosed string. |
| Function names | Built-in names were not case sensitive: Sin(x) and SIN(x) worked. |
All function names are case sensitive and all built-in functions are lower case. Sin(x) is undefined, unless you define it as a custom function. |
mean |
Geometric mean | Arithmetic mean (an alias of average). Use geomean for the geometric mean. |
| Plot settings | Variables PlotWidth, PlotHeight, PlotSVG, PlotAdaptive, PlotPalette, PlotSmooth, PlotShadows, PlotLightDir and PlotStep |
Options Plot.Width, Plot.Height, Plot.Svg, Plot.Adaptive, Plot.Palette, Plot.Smooth, Plot.Shadows, Plot.LightDirection and Plot.MapStep. The old variables no longer affect plots. |
| Default plot size | 400 × 250 px | 500 × 300 px |
| Comments | Text in single or double quotes | Only single quotes start a comment. To include a single quote in a comment, type it twice: ''. |
All examples that come with the program have been updated to the new syntax.
When you open an older file, headings in the form "Title and the old plot variables, e.g. PlotWidth, are automatically converted to '"Title and Plot.Width. The same applies to included files and to the command line interpreter.
LICENSE.TXT, also available as HTML).THIRD-PARTY-NOTICES.TXT file lists the third-party components and their license terms, including the CoolProp library and the spell checking dictionaries.#def syntax is unchanged. The new names avoid confusion with the new string values.Calcpad can now work with text values. A string is enclosed in double quotes: "text". To include a double quote in a string, type it twice: "say ""hi""". A string can contain any characters, including |, : and ;, but it must end on the same line.
s = "Hello" t = join(left(s; 1); "."; mid(s; 2; 4)) ucase(t) = "H.ELLO"
String results are displayed in quotes, except in #val mode. HTML inside a string is displayed as text and is not interpreted. Custom functions can accept and return strings.
| Function | Description |
|---|---|
str(x) | Converts x to text, as it is displayed in the output, including the units |
val(s) | Converts the text s to a number with optional units, e.g. val("1.5 kN/m^2") |
val(M) | Converts the string elements of a vector or matrix to numbers |
len(s) | Number of characters |
join(s₁; s₂; s₃…) | Joins texts and values into a single text |
join(M; colsep; rowsep) | Joins the elements of a vector or matrix into a text |
left(s; n), right(s; n), mid(s; i; n) | Parts of the text |
trim(s), ltrim(s), rtrim(s) | Remove leading and/or trailing spaces |
ucase(s), lcase(s), tcase(s), scase(s) | Upper, lower, title and sentence case. They work with all Unicode letters. |
instr(s; t; i) | Position of t in s, starting from i (optional, 1 by default), or 0 if t is not found |
replace(s; a; b) | Replaces all occurrences of a with b |
split(s; sep) | Splits a text into a vector of strings |
split(s; colsep; rowsep) | Splits a text into a matrix of strings |
table(M; nhrows; nhcols) | Displays a matrix as a table (see Tables) |
If an argument should be text but is not, it is converted with str first, e.g. left(12345; 3) = "123". Positions are counted from 1.
+ concatenates two strings: "Hello" + ", " + "world".≡ ≠ < > ≤ ≥ compare strings by Unicode code, case sensitive, and return 1 or 0. You can use them in #if, if(), logical expressions and solver blocks."12" + 1 returns an error. Use str or val to convert. Other operators and most math functions do not accept strings.b = [1; "abc"; 2m]. Indexing, assignment, the structural functions and the lookup functions work with string elements.+ and the comparison operators work element by element: ["a"; "b"] + "!" = ["a!" "b!"], and sum(v ≡ "a") counts the matches.sort, rsort, order, revorder, search, count, find…, lookup…, and the matrix and table versions, such as sort_rows, mfind…, vlookup… and hlookup…. Strings are compared in the same way as with < and ≡. A string cannot be compared with a number, so the compared elements must be either all strings or all numbers: lookup(names; values; "B2").You can enter a string in an input field: s = ?{"abc"}. A question mark inside a string does not create an input field.
table(M; nhrows; nhcols) displays the matrix M as a table, with nhrows header rows and nhcols header columns (1 and 0 by default). The cells can contain strings, numbers and values with units. The table appears in place of the equation. It is exported as a Word table, as a LaTeX table and as a Markdown table in the text output.
M = ["Section"; "Force, kN"; "Force, kN"; "η"|"Section"; "Fx"; "Fy"; "η"|"B1"; 12.5; 4.2; 0.62|"B2"; 18; 6.75; 0.88] Table.Style = TableStyle.Rules Table.MergeHeaders = 1 table(M; 2; 1)
val(T) returns the data as a matrix.+ and the comparison operators to the body cells if they are strings. Tables cannot be used in arithmetic.| Option | Description |
|---|---|
Table.Style | TableStyle.Bordered (default), Rules, Lines, Striped, Zebra, Boxed or Banner |
Table.CellAlign, Table.HeadAlign | Align.Left, Align.Center or Align.Right. Use one value for all columns, or a vector with one value per column. |
Table.MergeCells | [i1; j1; i2; j2], or a matrix with one range per row |
Table.MergeHeaders | Merges adjacent header cells with equal text |
Table.CellColor, Table.CellFill, Table.AltColor, Table.AltFill, Table.HeadColor, Table.HeadFill | Text and background colors of the cells, the alternate rows and the headers. Use a color name, e.g. Color.SteelBlue, or a hex code, e.g. "#4682B4". |
An option stays in effect until you change it. Auto restores an option's default, and Table.Reset() resets all options.
Data charts display values that are already stored in vectors and matrices. They do not evaluate expressions. The general format is:
$Line{y1 & y2 & … @ xl = labels}
| Command | Chart |
|---|---|
$Line | Lines through the points |
$Fill | Filled areas below the lines |
$Smooth | Smooth lines through the points |
$Bar | Horizontal bars |
$Column | Vertical columns |
$Scatter | Points only |
$Pie, $Donut | Pie or donut chart, one ring per series |
$Radar | Radar (spider) chart |
$Bubble | Bubbles with different sizes: x|y|d, y|d or y |
$Chart | Combined chart. Each series can have its own type: $Chart{column: P & line: T @ xl = months} |
y, a pair of vectors x|y, a matrix Y with one series per row, or X|Y. The values can have units, but they must be consistent.@ is optional. It sets the category labels from a vector of strings or numbers.Plot.Stack, Plot.Dots, Plot.DataTags and Plot.DropLines. Plot.FlipAxes makes the category axis vertical.months = ["Jan"; "Feb"; "Mar"; "Apr"; "May"; "Jun"]
T_1 = [2; 4; 9; 14; 19; 23]
T_2 = [-1; 1; 6; 12; 16; 20]
Plot.Legend = 1
Plot.Series1.Name = "2025"
Plot.Series2.Name = "2026"
$Line{T_1 & T_2 @ xl = months}
Plot options are special variables whose names start with Plot.. They apply to function plots ($Plot, $Map) and to data charts. An option stays in effect for all the plots that follow. Auto restores an option's default, and Plot.Reset() resets all options. You can also read options in expressions, e.g. w = Plot.Width.
| Option | Description |
|---|---|
Plot.Width, Plot.Height | Size of the plot area in pixels (500 × 300 by default) |
Plot.Title, Plot.LabelX, Plot.LabelY | Plot title and axis labels (strings) |
Plot.Legend | Shows a legend with the series names |
Plot.LogX, Plot.LogY | Logarithmic axes |
Plot.ReverseX, Plot.ReverseY, Plot.ReverseZ | Reversed axes, or reversed values and colors in $Map |
Plot.FlipAxes | Swaps the axes: x becomes vertical |
Plot.Limits, Plot.MinX… Plot.MaxZ | Axis limits, all at once or separately |
Plot.Step, Plot.StepX, Plot.StepY | Steps between the axis numbers, for both axes or separately |
Plot.Grid, Plot.GridX, Plot.GridY | Grid line spacing, for both axes or separately |
Plot.FormatXAxis, Plot.FormatYAxis | Number format of the axis labels, as for the results, e.g. "F2" or "0.##_2" |
Plot.Svg, Plot.Adaptive | Vector (SVG) or raster (PNG) output, and adaptive plotting of functions |
Plot.Series1… Plot.Series10 .Name, .Color, .Style, .Thickness | Name, color (Color.Tomato or "#RRGGBB"), line style (Style.Solid, Dash, LongDash, Dot, DashDot, DashDotDot) and relative thickness of each series |
Plot.Palette, Plot.Shadows, Plot.Smooth, Plot.LightDirection, Plot.MapStep | Surface map settings. The palette can be set by name, e.g. Palette.Rainbow, and the light direction by Direction.NorthEast, etc. |
Plot.Stack, Plot.Dots, Plot.DataTags, Plot.DropLines | Data chart options (see above) |
All arguments must be unitless, except the amplitude φ of the elliptic integrals, which follows the current angle units. In complex mode, the special functions also accept complex arguments. The orders of Bessel functions must be real, and integer orders must be integers.
| Group | Functions |
|---|---|
| Gamma and beta | gamma, gammaln, digamma, polygamma, gammainc_ (lower), gammainc‾ (upper), beta, betainc |
| Error function and Fresnel integrals | erf, erfc, erfinv, erfcinv, dawsonf, fresnelc, fresnels |
| Exponential, logarithmic, sine and cosine integrals | ei, li, si, ci, shi, chi |
| Elliptic integrals | elliptick, elliptice, ellipticp, ellipticf, ellipticei, ellipticpi |
| Jacobi elliptic functions | jacobiam, jacobisn, jacobicn, jacobidn, jacobics, jacobicd, jacobidc, jacobisc, jacobisd, jacobids, jacobins, jacobinc, jacobind |
| Bessel functions | besselj0, besselj1, bessely0, bessely1, besseljn, besselyn, besseljv, besselyv, besseljv′, besselyv′; spherical: besseljs, besselys, besseljs′, besselys′ |
| Modified Bessel functions | besseli0, besseli1, besselk0, besselk1, besselin, besselkn, besseliv, besselkv, besseliv′, besselkv′ |
| Airy functions | ai, bi, ai′, bi′ |
| Zeta and Lambert W | zeta, eta, lambertw |
| Group | Functions |
|---|---|
| Descriptive statistics | median, quantile(…; p), stdev, variance, skew, kurt. They accept lists of values, vectors and matrices, as sum does. Sample formulas (n − 1) are used, as in Excel. |
| Two samples and ranks | covar(a; b), correl(a; b), linreg(x; y) → [a; b], ranks(v), frequency(v; bins) |
| Combinatorics | combin(n; k), permut(n; k) |
| Probability distributions (pdf, cdf, inv) | Normal: normpdf, normcdf, norminv; lognormal: logn…; Student's t: t…; χ²: chi2…; Gumbel: gumbel…; Weibull: wbl…; binomial: binopdf, binocdf; Poisson: poisspdf, poisscdf |
The normal, Gumbel and Weibull distributions accept a variable and parameters with consistent units.
| Function | Description |
|---|---|
pv(rate; nper; pmt; [fv]; [type]) | Present value |
fv(rate; nper; pmt; [pv]; [type]) | Future value |
pmt(rate; nper; pv; [fv]; [type]) | Periodic payment |
nper(rate; pmt; pv; [fv]; [type]) | Number of periods |
rate(nper; pmt; pv; [fv]; [type]; [guess]) | Interest rate per period |
ipmt, ppmt(rate; per; nper; pv; [fv]; [type]) | Interest and principal parts of a payment |
npv(rate; x; y; z…), irr(x; y; z…), mirr(x; y; z…; fr; rr) | Net present value, internal rate of return, modified IRR |
The functions take their arguments in the same order as in Excel. Rates can be given in %, and amounts can have any consistent units, e.g. currency units. Cash paid out is negative.
The new CP. functions return the thermophysical properties of more than 100 pure fluids, of mixtures, of incompressible fluids and solutions, and of humid air. The properties are calculated by the CoolProp library (CoolProp.dll, version 8.0.0), which is included with Calcpad.
| Function | Description |
|---|---|
CP.Props(Output; Name1; Prop1; Name2; Prop2; Fluid) | Property of a fluid at the state given by two state variables |
CP.Props1(Fluid; Output) | Property that does not depend on the state, e.g. "Tcrit" |
CP.HAProps(Output; Name1; Prop1; Name2; Prop2; Name3; Prop3) | Property of humid air at the state given by three state variables |
CP.Phase(Name1; Prop1; Name2; Prop2; Fluid) | Phase at the given state, as text, e.g. "liquid" |
CP.SaturationAncillary(Fluid; Output; Q; Input; Value) | Saturation property from the ancillary equations, for liquid (Q = 0) or vapor (Q = 1) |
CP.GetFluidParamString(Fluid; Param) | Information about a fluid, e.g. "aliases", "CAS" or "ASHRAE34" |
CP.GetGlobalParamString(Param) | CoolProp information, e.g. "version" or "FluidsList" |
CP.GetParamIndex(Name) | Index of a CoolProp parameter |
CP.GetParameterInformationString(Key; Info) | Information about a parameter, for Info = "IO", "short", "long" or "units" |
CP.SetReferenceStateD(Fluid; T; RhoMolar; h0; s0) | Sets the reference state of a fluid by temperature, molar density, enthalpy and entropy |
CP.SetReferenceStateS(Fluid; ReferenceState) | Sets a predefined reference state: "IIR", "ASHRAE", "NBP", "DEF" or "RESET" |
ρ = CP.Props("D"; "T"; 25°C; "P"; 1atm; "Water")
h = CP.Props("H"; "T"; 200°C; "P"; 10bar; "Water")|kJ/kg
T_dp = CP.HAProps("D"; "T"; 25°C; "P"; 1atm; "R"; 50%)|°C
CP. and are case sensitive. The fluids, the outputs and the state variables are strings. The available names are listed in the CoolProp documentation."W" is the humidity ratio, "R" is the relative humidity and "D" is the dew point temperature.Examples\Physics\CoolProp: a T-s diagram of water, an h-s (Mollier) diagram of steam, a p-h diagram of R134a with a refrigeration cycle, a psychrometric chart, a Rankine cycle, a generalized compressibility chart, vapor pressure curves, the anomalous properties of water and an overview of the functions.log1p(x) and ln1p(x) return the decimal and natural logarithm of 1 + x. They stay accurate for small |x|, where computing 1 + x first loses precision.geomean(…) returns the geometric mean. mean(…) is now an alias of average(…).Numbers can be entered in floating point format: 3.4e+6 is the same as 3.4*10^6.
To enter a number in base 2 to 16, add an underscore and the base after the digits: 10001001_2, 777_8, 0FF_16. Fractions are supported: 101.01_2 = 5.25. The output shows the base as a subscript, followed by the decimal value.
To display a result in another base, add _n at the end of the format string or the target units:
| Code | Result |
|---|---|
137:_2 | 100010012 |
255:_16 | FF16 |
5.25:0.00_2 | 101.012 |
5:D8_2 | 000001012 |
5500mm|m_2 | 101.12 m |
To use a base for the whole worksheet, write #format _16, or combine it with a format string: #format 0.00_2.
'"Heading. Like a comment, it ends at the next single quote or at the end of the line.''.'<span class="ok">' work as before.Write the #Header keyword to put the report inside your own page header, for example a company title block with a logo. The header is an HTML template, Documents\Calcpad\Template\header.html. The report is placed in the first cell of the template's table body.
Project$, Client$, Problem$, Date$, Page$, JobNo$, Revision$, DesignBy$ and CheckedBy$. Each one goes into the template element with the matching id.#def definitions in the code.Documents\Calcpad\Template\Template.docx. The header values fill its custom document properties, and Page$ sets the number of the first page.#Header together with all the field definitions.*.tex document. The equations are converted to native LaTeX math, so you can edit them further.name_images folder next to the *.tex file. Save as LaTeX zip file packs the document and the images into one *.zip archive, e.g. for upload to Overleaf.-shell-escape option. Both are available on Overleaf.table are exported as LaTeX tables.CP. functions. You select the fluids, properties and other fixed values from lists, grouped into pure fluids, incompressible fluids and solutions, and mixtures. You can hover the mouse over a value to see its description and units. Input values can be entered with or without units. The arguments are checked while you type, e.g. whether the two inputs make a valid pair or the mole fractions of a mixture sum to 1. Invalid arguments are outlined in red, and the resulting expression is previewed at the bottom.Plot., Plot.Series1., Table., TableStyle., Align., Color., Style., Palette., Direction. or CP. opens the list of valid members. Colors are shown with swatches and line styles with previews. In comments, < opens a list of HTML tags, and a space inside a tag opens a list of its attributes. At the start of a $Chart series, it lists the series types.FF_16), target units with a base (|m_2), CP. functions, $Chart series types and the new '" headings.Calcpad checks the spelling of comments and strings. Misspelled words are underlined with a red wavy line. A line is checked when you leave it, together with the syntax highlighting.
%AppData%\Calcpad\UserDictionary.txt and apply to all languages.*.aff and *.dic files, e.g. from LibreOffice) to the dictionaries folder of Calcpad.*.tex or *.zip output file, e.g. Cli.exe input.cpd output.tex."…" no longer starts a comment.