kmath/docs/expressions.md

25 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2019-02-13 14:55:44 +03:00
# Expressions
2024-03-27 09:11:12 +03:00
Expressions is a feature, which allows constructing lazily or immediately calculated parametric mathematical
expressions.
2019-02-13 14:55:44 +03:00
The potential use-cases for it (so far) are following:
* lazy evaluation (in general simple lambda is better, but there are some border cases);
* automatic differentiation in single-dimension and in multiple dimensions;
* generation of mathematical syntax trees with subsequent code generation for other languages;
2024-03-27 09:11:12 +03:00
* symbolic computations, especially differentiation (and some other actions with `kmath-symja` integration with
Symja's `IExpr`—integration, simplification, and more);
* visualization with `kmath-jupyter`.
2019-02-13 14:55:44 +03:00
2024-03-27 09:11:12 +03:00
The workhorse of this API is `Expression` interface, which exposes
single `operator fun invoke(arguments: Map<Symbol, T>): T`
method. `ExpressionAlgebra` is used to generate expressions and introduce variables.
2019-02-13 14:55:44 +03:00
Currently there are two implementations:
* Generic `ExpressionField` in `kmath-core` which allows construction of custom lazy expressions
2024-03-27 09:11:12 +03:00
* Auto-differentiation expression in `kmath-commons` module allows using full power of `DerivativeStructure`
from commons-math. **TODO: add example**