- Basic syntax: similar to MATLAB and other computer-algebra languages
- Function reference: trig, logarithms, matrix ops, and more
- Units reference: all listed units are supported in the platform
Pulling data from other widgets
These functions let you read values from lookup widgets, tables, and other fields.L(): Lookup reference
UseL() to read a value from a lookup or shared lookup widget.
- columnIndex is 0-based (left-most column =
0) - The row comes from the user’s selection, or the lookup’s default row (also 0-based from the top)
member, and multiply by elastic modulus E:
T(): Internal table reference
UseT() inside a table widget to reference cells in that same table, typically in a computed column.
- Row and column indices are 0-based
rowIndex()andcolIndex()are built-in properties of each cell and can be used on their own or insideT()
matrixSubset(): Extract from a matrix
Extract one or more elements from a matrix (table or computed field).- rowIndex and columnIndex are 1-based (unlike
L()andT())
LC_str:
vectorSubset(): Extract from a vector
Extract a single element from a vector.- elementIndex is 1-based
firstQuarterBM:
col(): Extract a column (as a row matrix)
Returns an entire column as a row matrix[[a, b, c]]. Useful for server-returned data.
- columnIndex is 1-based
column() with the same syntax, but it returns a column matrix [[a], [b], [c]] instead.
Example: Find the maximum value in column 6 of a remote result:
interpolate(): Interpolate from 2D or 3D data
Interpolate a value from tabulated data. X-coordinates (and Y-coordinates for 3D) must be in ascending order.2D data
Example:
3D data
Built-in Math.js matrix helpers
column()
row()
Iterating over a set of data
setSum(): Summation over a range
Sum an expression over an integer range, like Σ in mathematics.fromandtoare inclusive- The last argument is the loop variable name (as a string)
PL across all rows:
vectorSubset(size(PL), 1) gives the number of rows, and j steps from 1 to that count.
iterate(): Build an array by looping
LikesetSum, but returns an array of results instead of a single sum. You control the step size.
fromandtoare inclusive
r:
deepReplace(): Find-and-replace inside a structure
Performs a string find-replace deep inside a matrix, object, or other nested structure. Commonly used in upgrade mappings.L to L_total inside a supports table:
mapObject(): Map over object entries
Works like Math.jsmap(), but iterates over object key-value pairs instead of matrix rows.
Related Math.js functions
matrixFromFunction()
Generate a matrix by evaluating a function at each coordinate:iterate(), but the loop variable i is a coordinate array, not a simple integer.
map()
Apply a function to every element of a matrix (same size in, same size out):toArray()
Convert a matrix to a plain array:Solvers
solveSecant(): Secant method root finder
Finds the root of a single-variable equation using the secant method. Provide two initial guesses and the solver iterates until convergence or until it hits the iteration limit.Example 1: Neutral axis location
Findkd where force equilibrium equals zero:
Example 2: Shortest unbraced length
When moment capacity equals a target value, rearrange to f(x) = 0 and solve forx (representing unbraced length L_yr):
Sheet state
presetCode()
Returns the preset code used to open the sheet, as a string.unitSystem()
Returns the current unit system as a string ("FPS" or "MKS").
Formatting strings
defaultFormat(): Standard number format
Applies the Calcs.com standard number format so templates round consistently.print(): String templates
Concatenate a formatted string with variable substitution. Useful for export labels and diagram text.Miscellaneous
maxIndex() / minIndex()
Return the 1-based index of the maximum or minimum value in an array.ln(): Natural logarithm
Math.js renders natural logs asln() but does not provide an ln() function. Use either:
isIncluded()
Check whether a value exists in an array.Conditional logic in equations
Math.js supports the ternary operator? : for inline conditionals inside a single expression:
Checks
I(): Indicator function
Returns1 if the condition is true, 0 if false. Useful as an on/off switch inside equations.
I() acts like a conditional gate. The term only contributes when its condition is true.
Deprecated functions
x(): Field reference (deprecated)
Previously required to reference another widget. Now use the reference ID directly:`M*`
x(, true): Inputs-only table reference (deprecated)
Previously returned only input columns from a table to avoid circular references. Better reference patterns are now available.isNumber() (deprecated)
Use Math.jsisNumeric() instead.