Skip to main content

Crate ries_rs

Crate ries_rs 

Source
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:

§Low-Level API

Building blocks for custom implementations:

  • Expression - Symbolic expression representation
  • Symbol - Individual symbols (constants, operators)
  • evaluate() - Evaluate expressions with derivatives

§Modules

  • eval - Expression evaluation with automatic differentiation
  • expr - Expression representation and manipulation
  • gen - 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§

FastMatchConfig
Configuration for fast match filtering
IntegerRelation
Result of PSLQ integer relation search
MatchInfo
Match result information
MatchMetrics
Metrics computed for a match
PslqConfig
PSLQ algorithm configuration
Report
A categorized report of matches
ReportConfig
Configuration for report generation
RunManifest
Complete manifest of a search run
SearchConfigInfo
Search configuration summary
StabilityAnalyzer
Analyze stability of matches across multiple runs
StabilityConfig
Stability ladder configuration
StabilityResult
Result of stability analysis
SymbolTable
Immutable per-run symbol configuration
UserConstantInfo
User constant information
VerificationResult
Result of high-precision verification

Enums§

Preset
Available built-in presets
ReportDisplayFormat
Display format for expressions (matches main.rs DisplayFormat)
StabilityClass
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 = RHS for x, returning a new expression for x.
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