Elementary functions
Elementary functions simplify when their arguments provide enough exact information.
All routed through the auto-simplifying builders, so the result is in
canonical ASAE form (e.g. sqrt(x) is stored as x^(1/2), known special
values collapse).
sin#
Explicit context
fun sin(argument: UniffiExpression): UniffiExpressioncos#
Explicit context
fun cos(argument: UniffiExpression): UniffiExpressiontan#
Explicit context
fun tan(argument: UniffiExpression): UniffiExpressionsec#
Explicit context
fun sec(argument: UniffiExpression): UniffiExpressioncsc#
Explicit context
fun csc(argument: UniffiExpression): UniffiExpressioncot#
Explicit context
fun cot(argument: UniffiExpression): UniffiExpressionarcsin#
Explicit context
fun arcsin(argument: UniffiExpression): UniffiExpressionarccos#
Explicit context
fun arccos(argument: UniffiExpression): UniffiExpressionarctan#
Explicit context
fun arctan(argument: UniffiExpression): UniffiExpressionarcsec#
Explicit context
fun arcsec(argument: UniffiExpression): UniffiExpressionarccsc#
Explicit context
fun arccsc(argument: UniffiExpression): UniffiExpressionarccot#
Explicit context
fun arccot(argument: UniffiExpression): UniffiExpressionThe principal value is arctan(1/x), with arccot(0) = pi/2. Over the reals it lies in
(-pi/2, 0) for negative x and in (0, pi/2] otherwise, so it jumps at zero; in the complex
plane its branch cut is the closed segment of the imaginary axis from -i to i.
sinh#
Explicit context
fun sinh(argument: UniffiExpression): UniffiExpressioncosh#
Explicit context
fun cosh(argument: UniffiExpression): UniffiExpressiontanh#
Explicit context
fun tanh(argument: UniffiExpression): UniffiExpressionsech#
Explicit context
fun sech(argument: UniffiExpression): UniffiExpressioncsch#
Explicit context
fun csch(argument: UniffiExpression): UniffiExpressioncoth#
Explicit context
fun coth(argument: UniffiExpression): UniffiExpressionarcsinh#
Explicit context
fun arcsinh(argument: UniffiExpression): UniffiExpressionarccosh#
Explicit context
fun arccosh(argument: UniffiExpression): UniffiExpressionarctanh#
Explicit context
fun arctanh(argument: UniffiExpression): UniffiExpressionarcsech#
Explicit context
fun arcsech(argument: UniffiExpression): UniffiExpressionarccsch#
Explicit context
fun arccsch(argument: UniffiExpression): UniffiExpressionarccoth#
Explicit context
fun arccoth(argument: UniffiExpression): UniffiExpressionexp#
Explicit context
fun exp(argument: UniffiExpression): UniffiExpressionThe natural exponential.
log#
Explicit context
fun log(
argument: UniffiExpression,
base: UniffiExpression?,
): UniffiExpressionNatural logarithm; with base given, log(x)/log(base).
sqrt#
Explicit context
fun sqrt(argument: UniffiExpression): UniffiExpressionPrincipal square root, stored as x^(1/2).
root#
Explicit context
fun root(
radicand: UniffiExpression,
index: UniffiExpression,
): UniffiExpressionPrincipal n-th root, stored as x^(1/n).
abs#
Explicit context
fun abs(argument: UniffiExpression): UniffiExpressionThe absolute value. It folds to x or -x whenever the sign of x is decided by the exact real
order procedure — the same decided class evaluate_truth reports on — so abs(sqrt(5) - 2)
becomes sqrt(5) - 2 rather than staying wrapped. A sign the procedure cannot prove leaves the
call symbolic; signum folds on exactly the same reach.
floor#
Explicit context
fun floor(argument: UniffiExpression): UniffiExpressionceiling#
Explicit context
fun ceiling(argument: UniffiExpression): UniffiExpressionconjugate#
Explicit context
fun conjugate(argument: UniffiExpression): UniffiExpressionComplex conjugate.
factorial#
Explicit context
fun factorial(argument: UniffiExpression): UniffiExpressionbinomial#
Explicit context
fun binomial(
upper: UniffiExpression,
lower: UniffiExpression,
): UniffiExpressionBinomial coefficient C(n, k).
min#
Explicit context
fun min(arguments: List<UniffiExpression>): UniffiExpressionMinimum of the arguments (variadic in Python; a JS array in WASM).
max#
Explicit context
fun max(arguments: List<UniffiExpression>): UniffiExpressionMaximum of the arguments (variadic in Python; a JS array in WASM).
Example#
absolute_value#
Explicit context
fun absoluteValue(argument: UniffiExpression): UniffiExpressionCalling forms
Expression method: UniffiExpression.absoluteValue
fun absoluteValue(): UniffiExpressionThe absolute value , spelled in full. It is the same operation as
abs; the two names exist because abs is the spelling the Python and
JavaScript hosts use for their own built-in, and the full name is the spelling
the mobile hosts generate.