RustedSciThe 0.3.29

Rust framework for symbolic and numerical computing: symbolic calculations, nonlinear systems, IVP and BVP for ODE, optimization, fitting and more
Documentation
use RustedSciThe::symbolic::symbolic_engine::Expr;

fn main() {
    // Test individual power expression
    let x = Expr::Var("x".to_string());
    let y = Expr::Var("y".to_string());
    
    // Simple power: (x + 1)^(y/2)
    let base = x.clone() + Expr::Const(1.0);
    let exp = y.clone() / Expr::Const(2.0);
    let power = base.pow(exp);
    
    println!("=== Simple Power ===");
    println!("{}", power.pretty_print());
    
    // Power in addition: x + (x + 1)^(y/2)
    let addition = x.clone() + power.clone();
    println!("\n=== Power in Addition ===");
    println!("{}", addition.pretty_print());
    
    // The problematic case: x/y + (y/2)^(x+1)
    let left_div = x.clone() / y.clone();
    let right_base = y.clone() / Expr::Const(2.0);
    let right_exp = x.clone() + Expr::Const(1.0);
    let right_power = right_base.pow(right_exp);
    let complex_expr = left_div + right_power;
    
    println!("\n=== Complex Expression ===");
    println!("{}", complex_expr.pretty_print());
}