Skip to main content

Crate ocas

Crate ocas 

Source
Expand description

oCAS — open Computer Algebra System.

This crate is the top-level Rust API for oCAS. It re-exports the public items from the lower-level crates so that most users only need one import:

use ocas::prelude::*;

Backends (GMP, MPFR, FLINT, LLVM, Python, GPL) are opt-in via feature flags to keep the default build portable, including on Windows MSVC where GMP is not readily available.

Modules§

normalize
Normalization for Atom expression trees.
prelude
Convenience prelude that brings commonly used oCAS types and functions into scope.
simplify
Rule-based simplification for oCAS.

Structs§

Arena
A bump-allocated region of memory.
Assumptions
A set of assumptions about a symbolic variable.
Atom
A reference to an expression node allocated in an arena.
AtomArena
A context that allocates Atoms in an Arena.
Bindings
A collection of wildcard bindings produced by a successful match.
Complex
A complex number whose real and imaginary parts live in a base domain.
ComplexDomain
The complex domain over a base domain D.
DenseUnivariatePolynomial
A dense univariate polynomial with coefficients in a domain D.
DiophantineSolution
A solution to a linear Diophantine equation ax + by = c.
ExpressionEvaluator
A compiled expression ready for numeric evaluation.
FiniteField
A prime finite field $\mathbb{Z}/p\mathbb{Z}$.
FiniteFieldElement
An element of a prime finite field.
FunctionMap
A map of named functions that can be called during evaluation.
Grevlex
Graded reverse lexicographic ordering: first by total degree descending, then reverse lexicographic.
GroebnerBasis
A Gröbner basis for a polynomial ideal.
Integer
Arbitrary-precision integer backed by num-bigint.
IntegerDomain
The integer domain.
Lex
Lexicographic ordering: compare exponents left-to-right.
Matrix
A dense matrix with elements from a EuclideanDomain.
Rational
Arbitrary-precision rational number backed by num-rational.
RationalDomain
The rational number domain.
RationalPolynomial
A rational polynomial $\frac{\text{num}}{\text{den}}$ over a domain D.
RealBall
A real ball: midpoint with radius.
RealBallDomain
The real ball domain.
RootInterval
A real interval known to contain exactly one root.
Rule
A rewrite rule.
SparseMultivariatePolynomial
A sparse multivariate polynomial with coefficients in a domain D and monomial ordering O.
Symbol
An interned symbolic name (variable, function, or constant).
SymbolAssumptions
A mapping from symbol names to their domain and assumptions.

Enums§

Assumption
A single predicate that can be asserted about a symbolic variable.
AtomNode
The concrete data stored for each expression node.
EvalTree
An owned intermediate representation of a symbolic expression.
EvaluationError
Errors that can occur during expression evaluation.
Instr
An internal, index-based instruction executed by super::ExpressionEvaluator.
Instruction
A public, self-documenting instruction.
MatchError
Errors that can occur during matching.
MatrixError
Errors that can occur during matrix operations.
OcasError
The primary error type returned by oCAS operations.
ParseError
Errors that can occur while parsing an expression.
Pattern
A pattern that can be matched against an Atom.
Slot
A named slot in the evaluator stack.
SolveError
Errors that can occur when solving equations.
WildcardLevel
The scope of a wildcard match.

Traits§

Domain
A coefficient domain for generic computer-algebra routines.
EuclideanDomain
Marker trait for domains that support exact division with remainder.
EvaluationDomain
Trait for types that can serve as evaluation domains.
MonomialOrder
A monomial ordering determines how terms are sorted and compared.
PowfExtension
Extension to EvaluationDomain for floating-point exponentiation.

Functions§

apart
Perform partial fraction decomposition of num / den.
buchberger
Convenience: compute a Gröbner basis and inter-reduce it.
diff
Differentiate expr with respect to var.
integrate
Integrate expr with respect to var.
match_pattern
Match a pattern against an atom, returning bindings on success.
monomial_are_coprime
Return true if the two monomials are coprime (no variable appears in both).
monomial_divides
Check whether monomial a divides monomial b: a[i] >= b[i] for all i.
monomial_lcm
Compute the least common multiple of two monomials: element-wise max.
parse
Parse an expression string into an Atom.
simplify
Simplify an atom using the supplied rewrite rules.
solve_diophantine
Solve the linear Diophantine equation a*x + b*y = c.
solve_linear_integer
Solve a linear system of equations over the integers.
solve_linear_rational
Solve a linear system of equations over the rational numbers.
solve_polynomial_system
Solve a system of polynomial equations using Gröbner bases.
substitute
Replace every occurrence of var inside expr with replacement.
taylor
Compute the Taylor expansion of expr around point with respect to var, up to the given order (inclusive).
transform

Type Aliases§

Result
A convenient result type for oCAS operations.