Expand description
§RIES-RS: Find algebraic equations given their solution
A Rust implementation of Robert Munafo’s RIES (RILYBOT Inverse Equation Solver).
Given a numeric target value, RIES searches for algebraic equations
that have the target as a solution. For example, given π, it finds
equations like x = π, x² = 10, sin(πx) = 0, etc.
§Features
- Parallel search using Rayon for multi-core speedup
- Automatic differentiation for Newton-Raphson refinement
- User-defined constants and functions via profiles
- Multiple output formats: default, pretty (Unicode), Mathematica, SymPy
- Complexity scoring to find simplest equations first
§Quick Start
use ries_rs::{search, GenConfig};
let config = GenConfig::default();
let matches = search(2.5, &config, 10);
// Should find equations like x = 5/2, x-2 = 1/2, etc.
assert!(!matches.is_empty());§Command-Line Usage
# Find equations for π
ries-rs 3.141592653589793
# Higher search level (more results)
ries-rs 2.5 -l 5
# Restrict to algebraic solutions
ries-rs 1.41421356 -a§API Levels
The library provides three API levels:
§High-Level API
Simple functions for common use cases:
search()- Find equations for a target value
§Mid-Level API
Configuration and control structures:
GenConfig- Configure expression generationSearchConfig- Configure search behaviorMatch- A matched equation
§Low-Level API
Building blocks for custom implementations:
Expression- Symbolic expression representationSymbol- Individual symbols (constants, operators)evaluate()- Evaluate expressions with derivatives
§Modules
eval- Expression evaluation with automatic differentiationexpr- Expression representation and manipulationgen- Expression generation- [
metrics] - Match scoring and categorization pool- Bounded priority pool for match collection- [
precision] - Precision abstraction for numeric types profile- Profile file support for configuration- [
report] - Categorized match output - [
search] - Search algorithms and matching symbol- Symbol definitions and type system- [
thresholds] - Named threshold constants udf- User-defined functions
Re-exports§
pub use search::search;pub use eval::EvalContext;pub use eval::EvalError;pub use eval::EvalResult;pub use eval::DEFAULT_TRIG_ARGUMENT_SCALE;pub use expr::Expression;pub use expr::OutputFormat;pub use gen::expression_respects_constraints;pub use gen::ExpressionConstraintOptions;pub use gen::GenConfig;pub use profile::Profile;pub use profile::UserConstant;pub use search::Match;pub use search::SearchConfig;pub use search::SearchContext;pub use search::SearchStats;pub use symbol::NumType;pub use symbol::Symbol;pub use udf::UserFunction;
Modules§
- eval
- Expression evaluation with automatic differentiation
- expr
- Expression representation and manipulation
- gen
- Expression generation
- pool
- Bounded priority pool for streaming match collection
- profile
- Profile file support for RIES configuration
- search
- Search and matching algorithms
- symbol
- Symbol definitions for RIES expressions
- udf
- User-defined functions for RIES
Structs§
- Fast
Match Config - Configuration for fast match filtering
- Integer
Relation - Result of PSLQ integer relation search
- Match
Info - Match result information
- Match
Metrics - Metrics computed for a match
- Pslq
Config - PSLQ algorithm configuration
- Report
- A categorized report of matches
- Report
Config - Configuration for report generation
- RunManifest
- Complete manifest of a search run
- Search
Config Info - Search configuration summary
- Stability
Analyzer - Analyze stability of matches across multiple runs
- Stability
Config - Stability ladder configuration
- Stability
Result - Result of stability analysis
- Symbol
Table - Immutable per-run symbol configuration
- User
Constant Info - User constant information
- Verification
Result - Result of high-precision verification
Enums§
- Preset
- Available built-in presets
- Report
Display Format - Display format for expressions (matches main.rs DisplayFormat)
- Stability
Class - Stability classification for a match
Constants§
- DEGENERATE_
DERIVATIVE - Threshold below which derivative is considered degenerate
- EXACT_
MATCH_ TOLERANCE - Tolerance for considering a match “exact”
- NEWTON_
TOLERANCE - Convergence tolerance for Newton-Raphson iteration
Functions§
- canonical_
expression_ key - Generates a canonical string key for an expression to identify equivalent forms.
- find_
fast_ match - Try to find a fast exact match for the target value
- find_
fast_ match_ with_ context - Try to find a fast exact match for the target value using an explicit evaluation context.
- find_
integer_ relation - Search for integer relations using PSLQ algorithm
- find_
rational_ approximation - Find rational approximation using continued fractions
- format_
stability_ report - Format stability results for display
- format_
verification_ report - Format verification results for display
- print_
presets - Print available presets (for –list-presets)
- solve_
for_ x_ rhs_ expression - Solves an equation
LHS = RHSforx, returning a new expression forx. - verify_
matches_ highprec - Fallback for non-highprec builds
- verify_
matches_ highprec_ with_ trig_ scale - Fallback for non-highprec builds with explicit trig scaling.
Type Aliases§
- Complexity
- Type alias for complexity scores