Crate giacrs

Crate giacrs 

Source
Expand description

§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.

Modules§

combinatory
Combinatory analysis https://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/en/cascmd_en/node55.html
context
A giac Context to keep variables
gen
A Gen object representing an expression
integers
Integers and gaussians integers https://www-fourier.ujf-grenoble.fr/~parisse/giac/doc/en/cascmd_en/node27.html
options
Edit giac contexts options
types
Internal giac types and enums

Structs§

GiacString
Represents all string created from giac. You should use this type if possible to avoid a copy, as a conversion to a rust string needs to copy the entire string.

Enums§

GiacError
Represents errors returned by any call to a giac function