giacrs

Crates.iogiacrs
lib.rsgiacrs
version0.1.3
created_at2025-01-12 17:30:22.224688+00
updated_at2025-01-18 18:23:32.539165+00
descriptionBindings to the giac/xcas library
homepage
repositoryhttps://github.com/supersurviveur/giacrs
max_upload_size
id1513460
size67,387
Julien THILLARD (supersurviveur)

documentation

README

Giacrs

Bindings to the Giac library used in xcas.

This library is under developpment. Feel free to contribute !

Usage

[dependencies]
giacrs = "0.1.3"

You must have the giac library installed on your system:
You can use pacman -S giac on Arch Linux.

Examples

Here is an example of how to use the Giacrs library:

use giacrs::{
    context::{release_globals, Context},
    gen::Gen,
    GiacError,
};

fn main() -> Result<(), GiacError> {
    let ctx = Context::new();

    // Create a polynomial and factorize it
    let e = Gen::from_str("x^4", &ctx)?;
    let f = ctx.eval("x^5")?;
    let mut g = e.clone() * &f;
    g /= &e;
    println!("{}", g.factor(&ctx)?);

    // Compute the determinant of a matrix
    let mat = Gen::from_str("[[1,2],[3,4]]", &ctx)?;
    println!("{}", mat.det(&ctx)?.to_int()?);

    // Release giac globals variables to avoid memory leaks
    release_globals();
    Ok(())
}

Contributing

See CONTRIBUTING.md for more information on how to contribute.

Commit count: 5

cargo fmt