A high-performance evolutionary algorithm system for discovering mathematical expressions by repeatedly applying the EML operator to find target numeric values. This project combines a Python GUI with a multi-threaded Rust backend to search for mathematical expressions in real-time.
The EML Operator (eml(x, y) = e^x - ln(y)) is applied to pairs of values in a "gene pool" to evolve new mathematical expressions. The system treats this as a phylogenetic search problemβstarting with initial constants, it discovers new values through operator composition, building a library of "species" (named constants).
- Real-time visualization of the search process via a Tkinter GUI
- Multi-threaded backend leveraging all CPU cores for parallel computation
- Milestone tracking that automatically identifies and catalogs significant discoveries (like e β 2.71828)
- Phylogenetic library maintaining a history of discovered constants and their relationships
- Cross-platform support (Windows, macOS, Linux)
βββββββββββββββββββββββββββββββββββββββββββ
β Python Frontend (Tkinter) β
β β’ Interactive button interface β
β β’ Real-time milestone display β
β β’ Phylogenetic library sidebar β
ββββββββββββββββββ¬βββββββββββββββββββββββββ
β (subprocess)
β (stdout streaming)
β
βββββββββββββββββββββββββββββββββββββββββββ
β Rust Backend (Multi-threaded) β
β β’ Parallel brute-force search β
β β’ Thread-safe gene pool β
β β’ Real-time result streaming β
βββββββββββββββββββββββββββββββββββββββββββ
The Python frontend launches the Rust backend as a subprocess and communicates via:
Command-line arguments:
backend.exe <target_real> <target_imag> <name1> <value1> <name2> <value2> ...
stdout protocol:
THREAD_LIVE: Core Nβ Thread startup notificationDEBUG: ...β Periodic progress updates (every 1M combinations)MILESTONE: name = eml(a,b)β New significant value discoveredFINAL: eml(a,b)β Target found! Search complete
The core mathematical function:
eml(x, y) = e^x - ln(y)
Where:
- e is Euler's number (β 2.71828)
- ^ is exponentiation
- ln is the natural logarithm
- x, y are Complex64 numbers
Validation: If |y| < 1e-9, the function returns NaN (to avoid undefined logarithm).
Operator Visualization/
βββ main.py # Python GUI frontend
βββ backend/
β βββ Cargo.toml # Rust project manifest
β βββ src/
β β βββ main.rs # Multi-threaded search engine
β βββ target/release/
β βββ backend.exe # Compiled binary (Windows)
βββ operator/ # Python virtual environment
β βββ pyvenv.cfg
β βββ Lib/site-packages/ # Installed Python packages
β βββ Scripts/ # Virtual environment scripts
βββ EML Operator.pdf # Reference research paper (arXiv)
- Python 3.11+ (virtual environment already configured in
operator/) - Rust 1.70+ (if building the backend)
- Windows/macOS/Linux (cross-platform support)
-
Ensure dependencies are installed (already configured in the
operator/venv):cd "C:\Users\vedro\Documents\Development\Operator Visualization" .\operator\Scripts\Activate.ps1
-
Build the Rust backend (skip if binary already compiled):
cd backend cargo build --release cd ..
-
Run the Python frontend:
python main.py
-
Usage:
- Click operator buttons (
+ - * / ln(x)) to start a search - Watch real-time milestone discoveries in the display panel
- The phylogenetic library builds up on the right sidebar
- Results show the discovered formula when found
- Click operator buttons (
The application includes default test values:
- x = 0.577215 (Euler-Mascheroni constant Ξ³)
- y = 1.282427 (Khinchin's constant, approximately)
Target values calculated from these:
"+": x + y β 1.859642"-": x - y β -0.705212"*": x Γ y β 0.740728"/": x Γ· y β 0.450122"ln(x)": ln(x) β -0.549765
The search process works as follows:
- Random Selection: Randomly pick two species from the gene pool
- Computation: Apply
eml(species_a, species_b) - Target Check: If result β target (within 1e-5), announce
FINAL - Milestone Detection: If result β e or β 0, add as new species in pool
- Pool Growth: Periodically add new computed values to the pool
- Repeat: Continue until target found or termination
- Shared State: Gene pool managed via
Arc<RwLock<Vec<Species>>> - Atomic Flag:
is_foundflag prevents wasted computation after success - Per-Core Seeding: Each thread uses unique LCG seeds for reproducible randomness
- Scaling: Automatically spawns threads for all available CPU cores
| Component | Technology | Version |
|---|---|---|
| Frontend | Python, Tkinter, NumPy | 3.14 |
| Backend | Rust | 2021 edition |
| Complex Math | num-complex |
0.4 |
| CPU Detection | num_cpus |
1.13 |
| Build System | Cargo | (integrated) |
| Virtual Environment | venv | (configured) |
The operator/ venv includes additional packages for extended functionality:
- Manim β Mathematical animation visualization
- Plotly β Interactive data visualization
- SciPy β Scientific computing
- NumPy β Numerical computing
- Pillow β Image processing
- PyDub β Audio processing
- Modern GL β Graphics rendering
- And many more (full list in
operator/Lib/site-packages/)
def run_rust_stream(self, op):
target_val = self.get_target_for_op(op)
cmd = [path_to_backend, str(target_val), "0.0"]
for name, val in self.library.items():
cmd.extend([name, str(val)])
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, ...)
for line in process.stdout:
if line.startswith("MILESTONE:"):
# Parse and update UI
elif line.startswith("FINAL:"):
# Display resultfn eml(x: Complex64, y: Complex64) -> Complex64 {
if y.norm() < 1e-9 { return Complex64::new(f64::NAN, f64::NAN); }
x.exp() - y.ln()
}
while !found.load(Ordering::Relaxed) {
let (a, b) = randomly_select_two_species();
let result = eml(a.value, b.value);
if (result - target).norm() < 1e-5 {
println!("FINAL: eml({},{})", a.name, b.name);
found.store(true, Ordering::SeqCst);
}
}The paper referenced in EML Operator.pdf (arXiv identifier) describes the theoretical foundation for this evolutionary operator approach. The "phylogenetic" terminology stems from treating mathematical expression discovery as an evolutionary tree growth problem.
- Parallelization: Utilizes all available CPU cores for maximum throughput
- Memory Efficiency: Gene pool management with read-write locks eliminates memory contention
- Streaming Updates: Real-time stdout feedback provides responsive UI updates
- Cross-platform Randomness: Deterministic LCG-based RNG ensures reproducible searches
cd backend
cargo build --releaseThe release binary is placed at backend/target/release/backend.exe (Windows) or backend/target/release/backend (Unix).
The theoretical framework for this work is outlined in the referenced arXiv paper. The EML operator provides an interesting mechanism for evolutionary symbolic computation.
Status: Active development
Last Updated: May 2026