Skip to main content

Crate symbolica

Crate symbolica 

Source
Expand description

Symbolica is a blazing fast computer algebra system.

Its main features are:

  • Easily create and manipulate expressions in Rust and Python
  • Fast code generation (C++/ASM/SIMD/CUDA) for expression evaluation
  • Fast multivariate polynomial arithmetic
  • Pattern matching and expression transformation
  • Mixed exact and numerical computations with error propagation
  • Handling and compression of very large expressions

For example:

use symbolica::{atom::AtomCore, parse, symbol};

fn main() {
    let input = parse!("x^2*log(2*x + y) + exp(3*x)");
    let a = input.derivative(symbol!("x"));
    println!("d/dx {} = {}:", input, a);
}

The main object to represent a general expressions is Atom. Most operations on Atom are implemented as methods on the AtomCore trait. The Symbol struct is used to represent variables or named functions, potentially with additional properties, such as symmetries (see atom::SymbolAttribute).

Instead of using general expressions, you can use more restricted formats such as MultivariatePolynomial, UnivariatePolynomial and RationalPolynomial which have optimized methods.

To use Symbolica’s exact numbers, see Integer, Rational, and FiniteField. For evaluations with floating point numbers, see Float, F64 and ErrorPropagatingFloat.

For linear algebra, use Matrix or Vector.

Check out the guide for more information, examples, and additional documentation.

Re-exports§

pub use graphica as graph;

Modules§

apipython_export
Contains various API bindings.
atom
Defines the core structures and functions for handling general mathematical expressions.
coefficient
Defines and handles coefficients of Symbolica expressions.
combinatorics
Provides combinatorial utilities for generating combinations, permutations, and partitions of sets.
domains
Defines core algebraic traits and data structures.
evaluate
Evaluation of expressions.
id
Methods related to pattern matching and replacements.
numerical_integration
Methods for numerical integration of black-box functions.
parser
Parsing of general expressions.
poly
Defines polynomials and series.
printer
Methods for printing atoms and polynomials.
solve
Solve systems of equations.
state
Manage global state and thread-local workspaces.
streaming
Methods for streaming large expressions to disk.
tensors
Methods for tensor manipulation and linear algebra.
transformer
Defines transformations uses to manipulate expressions.
utils
Utility traits and structures.

Macros§

activate_oem_license
Activate an OEM license key. Regular users should call LicenseManager::set_license_key instead.
create_hyperdual_from_components
Create a new hyperdual number, from a specification of the components. The first components must be the real value and the single derivatives of the variables in order.
create_hyperdual_from_depths
Create a new hyperdual number, with a given derivative depth per variable.
create_hyperdual_single_derivative
Create a new hyperdual number, with only single derivatives and with $var variables.
error
Write an error messages using tracing. Initializes a default tracing subscriber on the first call if GlobalSettings::initialize_tracing is true.
function
Create a new function by providing its name as the first argument, followed by the list of arguments. This macro uses FunctionBuilder.
get_symbol
Looks up a symbol by its name without creating it. Use symbol! to define new symbols.
hide_namespace
Hide the current namespace when printing an atom.
info
Write info messages using tracing. Initializes a default tracing subscriber on the first call if GlobalSettings::initialize_tracing is true.
namespace
Get the current namespace, based on the location of the macro invocation.
parse
Parse an atom from a string. Use parse_lit! to parse from literal code and try_parse! for fallible parsing.
parse_lit
Parse an atom from literal code. Use parse! to parse from a string. Any new symbols are defined in the current namespace. Use try_parse_lit for fallible parsing.
symbol
Create a new symbol or fetch the existing one with the same name. If no namespace is specified, the symbol is created in the current namespace. Use get_symbol! to only fetch existing symbols.
symbol_group
Define new symbols that depend on each other for their custom normalization/derivatives etc. For a fallible version, see try_symbol_group!.
tag
Create a tag in the current project namespace if no explicit namespace is set. This macro can be used in the symbol! macro:
try_parse
Try to parse an atom from a string. This is a fallible version of the parse! macro.
try_parse_lit
Try to parse an atom from literal code. Use parse_lit! for parsing that panics on an error.
try_symbol
Try to create a new symbol or fetch the existing one with the same name. This is a fallible version of the symbol! macro.
try_symbol_group
A fallible version of the symbol_group! macro.
warn
Write warning messages using tracing. Initializes a default tracing subscriber on the first call if GlobalSettings::initialize_tracing is true.

Structs§

GlobalSettings
Global settings for Symbolica.
LicenseManager
Manage the license of the Symbolica instance.

Statics§

GLOBAL_SETTINGS
Global settings for Symbolica.