Author image Zane C. Bowers-Hadley

NAME

Math::Giac - A perl interface to giac, a CAS(Computer Algebra System)

VERSION

Version 0.0.1

SYNOPSIS

    use Math::Giac;

    my $giac;
    eval( {
       $giac=$Math::Giac->new;
    } );
    if ( $@ ){
        die("Failed to locate the giac binary");
    }

    my $results=$giac->run('sin(x)+cos(pi)-3');
    print $results."\n";

    $results=$giac->run('mathml(sin(x)+cos(pi)-3)');
    print $results."\n";

    $giac->set_vars({ A=>2 });
    my $results=$giac->run('sin(A)+cos(pi)-3');

METHODS

new

This initiates the object.

This also checks to make sure that giac is in the path. If that check fails, it will die.

    my $giac;
    eval( {
       $giac=$Math::Giac->new;
    } );
    if ( $@ ){
        die("Failed to locate the giac binary");
    }

run

This returns the respected string after putting together a variable list.

The final output is what is returned, or $output[ $#output - 1 ], assuming it is a single line one. Otherwise it works backwards to find a match.

This will remove the " from the start and return of the return, which gets added for with latex or mathml.

This will die on a non-zero exit or no string being specified.

    my $results=$giac->run('sin(x)+cos(pi)-3');
    print $results."\n";

    $results=$giac->run('mathml(sin(x)+cos(pi)-3)');
    print $results."\n";

vars_clear

Removes any set variables.

As long as new was successfully called, this won't error.

    $giac->vars_clear;

vars_set

Sets the variables.

xsThis requires one argument, which is a hash reference.

VARIABLE HANDLING

Lets say the variable hash below is passed.

    {
        A=>1,
        B=>3,
    }

Then the resulting code will be as below.

    A:=1
    B:=3

Then requested item to run is then added to the end. So if we are running 'sin(pi)+A' then we will have the item below.

    A:=1
    B:=3
    sin(pi)+A

AUTHOR

Zane C. Bowers-HAdley, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-math-giac at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-Giac. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Math::Giac

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by Zane C. Bowers-HAdley.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)