Skip to content
Symi Docs
Rust

The Rust manual covers the recommended facade. The complete native crate is documented in the native Rust API reference.

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#

api::Session method

pub fn sin(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::sin

pub fn sin(&self) -> Result<Expression, ApiError>

cos#

api::Session method

pub fn cos(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::cos

pub fn cos(&self) -> Result<Expression, ApiError>

tan#

api::Session method

pub fn tan(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::tan

pub fn tan(&self) -> Result<Expression, ApiError>

sec#

api::Session method

pub fn sec(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::sec

pub fn sec(&self) -> Result<Expression, ApiError>

csc#

api::Session method

pub fn csc(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::csc

pub fn csc(&self) -> Result<Expression, ApiError>

cot#

api::Session method

pub fn cot(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::cot

pub fn cot(&self) -> Result<Expression, ApiError>

arcsin#

api::Session method

pub fn arcsin(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arcsin

pub fn arcsin(&self) -> Result<Expression, ApiError>

arccos#

api::Session method

pub fn arccos(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arccos

pub fn arccos(&self) -> Result<Expression, ApiError>

arctan#

api::Session method

pub fn arctan(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arctan

pub fn arctan(&self) -> Result<Expression, ApiError>

arcsec#

api::Session method

pub fn arcsec(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arcsec

pub fn arcsec(&self) -> Result<Expression, ApiError>

arccsc#

api::Session method

pub fn arccsc(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arccsc

pub fn arccsc(&self) -> Result<Expression, ApiError>

arccot#

api::Session method

pub fn arccot(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arccot

pub fn arccot(&self) -> Result<Expression, ApiError>

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#

api::Session method

pub fn sinh(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::sinh

pub fn sinh(&self) -> Result<Expression, ApiError>

cosh#

api::Session method

pub fn cosh(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::cosh

pub fn cosh(&self) -> Result<Expression, ApiError>

tanh#

api::Session method

pub fn tanh(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::tanh

pub fn tanh(&self) -> Result<Expression, ApiError>

sech#

api::Session method

pub fn sech(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::sech

pub fn sech(&self) -> Result<Expression, ApiError>

csch#

api::Session method

pub fn csch(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::csch

pub fn csch(&self) -> Result<Expression, ApiError>

coth#

api::Session method

pub fn coth(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::coth

pub fn coth(&self) -> Result<Expression, ApiError>

arcsinh#

api::Session method

pub fn arcsinh(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arcsinh

pub fn arcsinh(&self) -> Result<Expression, ApiError>

arccosh#

api::Session method

pub fn arccosh(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arccosh

pub fn arccosh(&self) -> Result<Expression, ApiError>

arctanh#

api::Session method

pub fn arctanh(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arctanh

pub fn arctanh(&self) -> Result<Expression, ApiError>

arcsech#

api::Session method

pub fn arcsech(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arcsech

pub fn arcsech(&self) -> Result<Expression, ApiError>

arccsch#

api::Session method

pub fn arccsch(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arccsch

pub fn arccsch(&self) -> Result<Expression, ApiError>

arccoth#

api::Session method

pub fn arccoth(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::arccoth

pub fn arccoth(&self) -> Result<Expression, ApiError>

exp#

api::Session method

pub fn exp(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::exp

pub fn exp(&self) -> Result<Expression, ApiError>

The natural exponential.

log#

api::Session method

pub fn log(
    &self,
    argument: &Expression,
    base: Option<&Expression>,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::log

pub fn log(
    &self,
    base: Option<&Expression>,
) -> Result<Expression, ApiError>

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

sqrt#

api::Session method

pub fn sqrt(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::sqrt

pub fn sqrt(&self) -> Result<Expression, ApiError>

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

root#

api::Session method

pub fn root(
    &self,
    radicand: &Expression,
    index: &Expression,
) -> Result<Expression, ApiError>

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

abs#

api::Session method

pub fn abs(&self, argument: &Expression) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::abs

pub fn abs(&self) -> Result<Expression, ApiError>

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#

api::Session method

pub fn floor(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::floor

pub fn floor(&self) -> Result<Expression, ApiError>

ceiling#

api::Session method

pub fn ceiling(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::ceiling

pub fn ceiling(&self) -> Result<Expression, ApiError>

conjugate#

api::Session method

pub fn conjugate(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::conjugate

pub fn conjugate(&self) -> Result<Expression, ApiError>

Complex conjugate.

factorial#

api::Session method

pub fn factorial(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>

binomial#

api::Session method

pub fn binomial(
    &self,
    upper: &Expression,
    lower: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::binomial

pub fn binomial(
    &self,
    lower: &Expression,
) -> Result<Expression, ApiError>

Binomial coefficient C(n, k).

min#

api::Session method

pub fn min<'a, IteratorType>(
    &self,
    arguments: IteratorType,
) -> Result<Expression, ApiError>
where
    IteratorType: IntoIterator<Item = &'a Expression>,

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

max#

api::Session method

pub fn max<'a, IteratorType>(
    &self,
    arguments: IteratorType,
) -> Result<Expression, ApiError>
where
    IteratorType: IntoIterator<Item = &'a Expression>,

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

Example#

This family is not part of the recommended symi::api facade in this release. Call it through the native modules in the native Rust API reference.

absolute_value#

api::Session method

pub fn absolute_value(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>
Calling forms

api::Expression method: api::Expression::absolute_value

pub fn absolute_value(&self) -> Result<Expression, ApiError>

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.

Additional API#

call_builtin#

api::Session method

pub fn call_builtin<'a, IteratorType>(
    &self,
    function: BuiltinFunction,
    arguments: IteratorType,
) -> Result<Expression, ApiError>
where
    IteratorType: IntoIterator<Item = &'a Expression>,

Applies a typed built-in function after validating every expression argument.

signum#

api::Session method

pub fn signum(
    &self,
    argument: &Expression,
) -> Result<Expression, ApiError>

Provides the signum operation on this native type.

BuiltinFunction#

api re_export

pub use crate::function::BuiltinFunction;

Public native enumeration named builtin_function.

FunctionIdentifier#

api re_export

pub use crate::function::FunctionIdentifier;

Public native enumeration named FunctionIdentifier.