lie-rs
A Rust library for Lie series and Baker-Campbell-Hausdorff computations.
Overview
- Baker-Campbell-Hausdorff (BCH) series computation
- Lie series representation and manipulation
- Generic numeric types (rationals, floats, integers)
Quick Start
Add this to your Cargo.toml:
[]
= "0.1.0"
Basic BCH Computation
use *;
use ;
// Create a BCH series generator for 2 generators up to degree 5
let basis = new;
let generator = new;
// Generate the BCH series
let bch_series = generator.generate_lie_series;
println!;
// Print the first few terms
for in bch_series.iter.take
Working with Rational Arithmetic
use *;
use ;
use Ratio;
// Use exact rational arithmetic for precise computation
let basis = new;
let generator = new;
let bch_series: = generator.generate_lie_series;
// All coefficients are exact rational numbers
for in bch_series.iter
Creating and Manipulating Lie Series
use *;
use *;
// Create a custom Lie series with basis and coefficients
let word1 = try_from.unwrap;
let word2 = try_from.unwrap;
let word12 = try_from.unwrap;
let basis = vec!;
let coefficients = vec!;
let series = new;
println!;
// Series support algebraic operations
let doubled = &series + &series; // Addition
println!;
Computing Commutators in Lie Series
use *;
use ;
use Commutator;
// Create two simple Lie series
let x = try_from.unwrap;
let y = try_from.unwrap;
let x_series = new;
let y_series = new;
// Compute the commutator [x, y]
let commutator_series = x_series.commutator;
println!;
Key Types
LieSeriesGenerator: Trait for generating Lie series from various inputsBchSeriesGenerator: Specialized generator for Baker-Campbell-Hausdorff computationsLieSeries<T, U>: Generic container for Lie algebraic seriesRootedTree<T>: Trees used for BCH computations