Skip to content
Symi Docs
Swift
On this page

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) -> UniffiExpression
Calling forms

Expression method: UniffiExpression.sin

func sin() -> UniffiExpression

cos#

Explicit context

func cos(argument: UniffiExpression) -> UniffiExpression
Calling forms

Expression method: UniffiExpression.cos

func cos() -> UniffiExpression

tan#

Explicit context

func tan(argument: UniffiExpression) -> UniffiExpression

sec#

Explicit context

func sec(argument: UniffiExpression) -> UniffiExpression

csc#

Explicit context

func csc(argument: UniffiExpression) -> UniffiExpression

cot#

Explicit context

func cot(argument: UniffiExpression) -> UniffiExpression

arcsin#

Explicit context

func arcsin(argument: UniffiExpression) -> UniffiExpression

arccos#

Explicit context

func arccos(argument: UniffiExpression) -> UniffiExpression

arctan#

Explicit context

func arctan(argument: UniffiExpression) -> UniffiExpression

arcsec#

Explicit context

func arcsec(argument: UniffiExpression) -> UniffiExpression

arccsc#

Explicit context

func arccsc(argument: UniffiExpression) -> UniffiExpression

arccot#

Explicit context

func arccot(argument: UniffiExpression) -> UniffiExpression

The 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) -> UniffiExpression

cosh#

Explicit context

func cosh(argument: UniffiExpression) -> UniffiExpression

tanh#

Explicit context

func tanh(argument: UniffiExpression) -> UniffiExpression

sech#

Explicit context

func sech(argument: UniffiExpression) -> UniffiExpression

csch#

Explicit context

func csch(argument: UniffiExpression) -> UniffiExpression

coth#

Explicit context

func coth(argument: UniffiExpression) -> UniffiExpression

arcsinh#

Explicit context

func arcsinh(argument: UniffiExpression) -> UniffiExpression

arccosh#

Explicit context

func arccosh(argument: UniffiExpression) -> UniffiExpression

arctanh#

Explicit context

func arctanh(argument: UniffiExpression) -> UniffiExpression

arcsech#

Explicit context

func arcsech(argument: UniffiExpression) -> UniffiExpression

arccsch#

Explicit context

func arccsch(argument: UniffiExpression) -> UniffiExpression

arccoth#

Explicit context

func arccoth(argument: UniffiExpression) -> UniffiExpression

exp#

Explicit context

func exp(argument: UniffiExpression) -> UniffiExpression
Calling forms

Expression method: UniffiExpression.exp

func exp() -> UniffiExpression

The natural exponential.

log#

Explicit context

func log(
    argument: UniffiExpression,
    base: UniffiExpression?,
) -> UniffiExpression

Natural logarithm; with base given, log(x)/log(base).

sqrt#

Explicit context

func sqrt(argument: UniffiExpression) -> UniffiExpression
Calling forms

Expression method: UniffiExpression.sqrt

func sqrt() -> UniffiExpression

Principal square root, stored as x^(1/2).

root#

Explicit context

func root(
    radicand: UniffiExpression,
    index: UniffiExpression,
) -> UniffiExpression

Principal n-th root, stored as x^(1/n).

abs#

Explicit context

func abs(argument: UniffiExpression) -> UniffiExpression

The 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) -> UniffiExpression

ceiling#

Explicit context

func ceiling(argument: UniffiExpression) -> UniffiExpression

conjugate#

Explicit context

func conjugate(argument: UniffiExpression) -> UniffiExpression

Complex conjugate.

factorial#

Explicit context

func factorial(argument: UniffiExpression) -> UniffiExpression

binomial#

Explicit context

func binomial(
    upper: UniffiExpression,
    lower: UniffiExpression,
) -> UniffiExpression

Binomial coefficient C(n, k).

min#

Explicit context

func min(arguments: [UniffiExpression]) -> UniffiExpression

Minimum of the arguments (variadic in Python; a JS array in WASM).

max#

Explicit context

func max(arguments: [UniffiExpression]) -> UniffiExpression

Maximum of the arguments (variadic in Python; a JS array in WASM).

Example#

absolute_value#

Explicit context

func absoluteValue(argument: UniffiExpression) -> UniffiExpression
Calling forms

Expression method: UniffiExpression.absoluteValue

func absoluteValue() -> UniffiExpression

The absolute value ∣x∣|x|, 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.

Symi documentation · Swift