Skip to main content
An activity equation is written in TrueMath’s expression syntax. This page covers the building blocks and how value types combine when an equation runs. For the full operator list and ordering, see Operators and precedence; for the built-in functions, see the Function library.

Literals

  • Numbers42, 3.14, -7.2. Scientific notation uses e: 1.5e-3 is 0.0015.
  • Numbers with units — a unit literal wrapped in backticks (see Units in equations).
  • Tables — bracketed lists: [1; 2; 3]. See Tables.

Units in equations

A unit used as a literal must be wrapped in backticks, so it reads as a unit and not a variable name. Both simple and compound units work:
The backticks are required: without them, m, yr, or USD is parsed as a variable name. See Unit numbers. This applies only inside equations. In structured-text input a value is not an expression, so units are written plainly — 30 yr, no backticks.

Variables

A variable name starts with a letter and contains letters, digits, and underscores: rate, home_price, term. Variable names are case insensitive and will be lowercased automatically. In an equation, a variable refers to one of the domain’s variables.
Changing a name here does not rename a variable — a name that doesn’t match an existing one creates a new variable. To rename, edit the key in the variable’s details. See Key and labels.

Constants

Operators

Arithmetic + - * / ^, comparison == != < > <= >=, and logical && || !. Group with parentheses to control evaluation order:
See Operators and precedence for the full list and ordering.

Functions

Call a function by name with arguments separated by semicolons:
Function names are case-insensitive (sqrt, SQRT, and Sqrt are equivalent). See the Function library.

Assignment

= binds the result of an expression to a variable:
Do not confuse = with ==: = assigns a value to a variable, while == tests whether two values are equal inside a condition. They are not interchangeable. See Operators and precedence.
The argument separator and the table/row separator are both the semicolon (;). Commas are not used in equations.

Combining types

Equations operate on three value types: scalar numbers, unit numbers, and tables. When an operation combines values, TrueMath applies consistent rules — and rejects combinations that are not meaningful.

Numbers

  • Scalar with scalar → scalar.
  • Compatible units → converted to a common unit and combined.
  • Incompatible units → rejected, because the dimensions differ.
  • Multiplication and division combine dimensions — a length multiplied by a length is an area; a length divided by a time yields a velocity; a currency divided by an volume yields a cost-per-volume. See Units.

Tables

  • Table with scalar → the scalar is applied to every cell. [1; 2; 3] * 2 is [2; 4; 6].
  • Table with table → element-wise, and the tables must have the same shape. [1; 2] + [3; 4] is [4; 6].
  • Mismatched shapes → rejected.
Empty cells in a table are treated as having no value and are skipped by aggregating functions.

What is not coerced

TrueMath does not silently coerce across incompatible dimensions or mismatched table shapes. These produce an error rather than a wrong answer — keeping with the principle that “close” is not acceptable. See Guarantees.