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
func sin(argument: UniffiExpression) -> UniffiExpressioncos#
Explicit context
func cos(argument: UniffiExpression) -> UniffiExpressiontan#
Explicit context
func tan(argument: UniffiExpression) -> UniffiExpressionsec#
Explicit context
func sec(argument: UniffiExpression) -> UniffiExpressioncsc#
Explicit context
func csc(argument: UniffiExpression) -> UniffiExpressioncot#
Explicit context
func cot(argument: UniffiExpression) -> UniffiExpressionarcsin#
Explicit context
func arcsin(argument: UniffiExpression) -> UniffiExpressionarccos#
Explicit context
func arccos(argument: UniffiExpression) -> UniffiExpressionarctan#
Explicit context
func arctan(argument: UniffiExpression) -> UniffiExpressionarcsec#
Explicit context
func arcsec(argument: UniffiExpression) -> UniffiExpressionarccsc#
Explicit context
func arccsc(argument: UniffiExpression) -> UniffiExpressionarccot#
Explicit context
func 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
func sinh(argument: UniffiExpression) -> UniffiExpressioncosh#
Explicit context
func cosh(argument: UniffiExpression) -> UniffiExpressiontanh#
Explicit context
func tanh(argument: UniffiExpression) -> UniffiExpressionsech#
Explicit context
func sech(argument: UniffiExpression) -> UniffiExpressioncsch#
Explicit context
func csch(argument: UniffiExpression) -> UniffiExpressioncoth#
Explicit context
func coth(argument: UniffiExpression) -> UniffiExpressionarcsinh#
Explicit context
func arcsinh(argument: UniffiExpression) -> UniffiExpressionarccosh#
Explicit context
func arccosh(argument: UniffiExpression) -> UniffiExpressionarctanh#
Explicit context
func arctanh(argument: UniffiExpression) -> UniffiExpressionarcsech#
Explicit context
func arcsech(argument: UniffiExpression) -> UniffiExpressionarccsch#
Explicit context
func arccsch(argument: UniffiExpression) -> UniffiExpressionarccoth#
Explicit context
func arccoth(argument: UniffiExpression) -> UniffiExpressionexp#
Explicit context
func exp(argument: UniffiExpression) -> UniffiExpressionThe natural exponential.
log#
Explicit context
func log(
argument: UniffiExpression,
base: UniffiExpression?,
) -> UniffiExpressionNatural logarithm; with base given, log(x)/log(base).
sqrt#
Explicit context
func sqrt(argument: UniffiExpression) -> UniffiExpressionPrincipal square root, stored as x^(1/2).
root#
Explicit context
func root(
radicand: UniffiExpression,
index: UniffiExpression,
) -> UniffiExpressionPrincipal n-th root, stored as x^(1/n).
abs#
Explicit context
func 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
func floor(argument: UniffiExpression) -> UniffiExpressionceiling#
Explicit context
func ceiling(argument: UniffiExpression) -> UniffiExpressionconjugate#
Explicit context
func conjugate(argument: UniffiExpression) -> UniffiExpressionComplex conjugate.
factorial#
Explicit context
func factorial(argument: UniffiExpression) -> UniffiExpressionbinomial#
Explicit context
func binomial(
upper: UniffiExpression,
lower: UniffiExpression,
) -> UniffiExpressionBinomial coefficient C(n, k).
min#
Explicit context
func min(arguments: [UniffiExpression]) -> UniffiExpressionMinimum of the arguments (variadic in Python; a JS array in WASM).
max#
Explicit context
func max(arguments: [UniffiExpression]) -> UniffiExpressionMaximum of the arguments (variadic in Python; a JS array in WASM).
Example#
absolute_value#
Explicit context
func absoluteValue(argument: UniffiExpression) -> UniffiExpressionCalling forms
Expression method: UniffiExpression.absoluteValue
func 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.