Custom functions available in Calcs.com for equation writing and widget data access
integer
reference ID:string
reference ID:index = 0
for the left-most column of the tableData comprising the lookup widget, increasing by 1 as we go right in the tableData columns.
Example usage
The example below is from steelComplexBeam.json
:
attributes.equation[0].result
is referencing the 7th Index (8th countable column) of the "member"
shared table lookup widget.
rowIndex()
and each column of the table has an inherent colIndex()
.If we are referring to rows as they are created for the first column in the table:steelComplexBeam.json
to calculate deflection limits in a table:
T(rowIndex(), 0)
and T(rowIndex(), 1)
.
target_matrix
is the field reference function that calls a matrix by its reference IDrowIndex
is an integer or array that describes the row for extraction. This, unlike the other index types, start at index=1
columnIndex
is an integer or array that describes the column for extraction. This, unlike the other index types, start at index=1
vector
is the vector as a result of a field reference function callelementIndex
is an integer index of the element required for extraction (starting at index=0)elementIndex
is actually 1-based.column()
, with the same syntax. The only functional difference between the two is that col()
returns a row matrix ([[a, b]]
) while column()
returns a column matrix ([[a], [b]]
).col(matrix, columnIndex)
matrix
is the matrix called by the field reference functioncolumnIndex
is the index of the column required for extraction. Unlike most indexing, this starts at index=1
2D Data Interpolation
xMatrix
is a 1xN matrix from which values will be returnedxLoc
is a scalar number at which interpolation should be performedxCoords
is an N-length array of the possible X-coordinates"log"
, if present, means to use a logarithmic rather than linear interpolationxCoords = [1, 2, 3]
and xMatrix = [0, 5, 10]
, asking for the value at xLoc = 4
would give a value of 10.3D Data Interpolation
xyMatrix
is an MxN matrix from which values will be returnedxLoc
is a scalar number at which interpolation should be performed along the x-axisxCoords
is an N-length array of the possible X-coordinatesyLoc
is a scalar number at which interpolation should be performed along the y-axisyCoords
is an M-length array of the possible Y-coordinates"log"
, if present, means to use a logarithmic rather than linear interpolationfrom
is an integer value that describes the lower bound of the sum function. Note that for sums, the from
is included in the sumto
is an integer value that describes the upper bound of the sum function. Note that for sums, the to
is included in the summath
is the mathematical expression that will be summed in the setSum operation. The key variable is exchanged in this equation to be equal to the variable declared in the last argument of setSum
"variable"
is the variable that goes from from
to to
in the summation.setSum
function, however the step of the iterated variable can be controlled to a greater detail and the output of the iteration is not a single summed value, but an array of values as a result of the iteration.
from
is an integer value that describes the lower bound of the iteration. Note that this value is included in the iterationto
is an integer value that describes the upper bound of the iteration. Note that this value is included in the iterationstep
is a float value that describes the step size for the iteration.expression
is any mathematical expression used for the iterative processvariable
is the variable that is iterated that must exist in the expressiondataStructure
is any type of data structure - a matrix, object/dictionary, etcfindString
is a string to find anywhere in the structurereplaceString
is the string to replace it withobject
is any object/dictionaryfunction
is a function of the key AND the value for each entry, equal to an object with the new key and value. For example: f(key, value) = {key: concat(key, "_2"), value: 2 * value}
guess0
is the first guess for the value of fnEquation
’s independent variable (must use the same unit too)guess1
is the second guess for the value of fnEquation
’s independent variable (must use the same unit too)convergenceCriterion
is a value, in the same unit as fnEquation
’s independent variable, which defines when the result has been found to have sufficient accuracy (i.e. [iteration n] - [iteration n-1] < convergenceCriterion
)maxIters
is a unitless integer setting the maximum number of iterations to perform in searching for the resultfnEquation
is any mathematical equation, written as a function of a single variable (e.g. f(n) = n^2
), for which a root will be foundpresetCode()
unitSystem()
defaultFormat(number)
number
is whatever number you want to display in a stringsigFigs
(default = 3) is an integer that defines the number of significant figures to round tointRange
(default = [0, 1000]) is a 1x2 array of integers or null
that defines a range within which to display the exact (unrounded) integer valuemaxIndex(array)
minIndex(array)
ln()
as a function even though it renders a base e logarithm as “ln()”. So we created the function.
log(x)
without EXPLICITLY specifying the base as log(x, base)
. A class 3 bug previously resulted due to confusion about the default base.ln(x)
or log(x, e)
.
vec = [1, 2, 3, 4, 5]
, then isIncluded(1, vec)
will return true
.
condition
is a mathematical equality or inequality that must return a TRUE or FALSE output. If a TRUE output is observed, the function resolves to a value of 1. If a FALSE output is observed, the function resolves to a value of 0.pfcAngle.json
. The indicator functions when multiplied by a certain value given the condition acts like on and off switches for parts of the equation.
M_u
) or using it within backticks (e.g. `M*`
).null
value. The inherent math.js isNumeric()
function works better for most use cases.