|
Math::Yacas - Perl interface to YACAS |
Math::Yacas - Perl interface to YACAS (Yet Another Computer Algebra System)
Note: If you know how to adapt this module for another platform, contact me please (Yacas is multi-platform). For Win32 system, Yacas is provided as a dynamically linked library; therefore it's easy to integrate it in another application.
use Math::Yacas 'Evaluate'; print Evaluate "Integrate(x) Ln(x)"; # print: x*Ln(x)-x;
Yacas (Yet Another Computer Algebra System) is a small and highly flexible general-purpose computer algebra system and programming language. Yacas is multi-platform and is distributed under the GNU General Public License (GPL). This module provides an interface to Yacas and permits to do symbolic and numeric calculations in a Perl script.
There are only three functions: Evaluate() , Output() and LastErrorMsg() .
LastErrorMsg() returns the error message.
use Math::Yacas ':all';
print Evaluate "Taylor(x, 0, 5) Sin(x)";
# prints: x-x^3/6+x^5/120;
print "\n", Evaluate "PrettyForm(%)";
# prints: True;
print Output();
# prints: 3 5
# x x
# x - -- + ---
# 6 120
LastErrorMsg() ;
A very simple script to use Yacas interactively in a console:
#!/usr/bin/perl -w
use strict;
use Math::Yacas ':all';
print "*** This is Yacas 1.0.55\nIn> ";
while (<STDIN>) {
chomp;
last if $_ eq 'quit';
next unless $_;
my $r = Evaluate($_);
if (defined($r)) {
print Output() if Output();
print "Out> $r\nIn> ";
}
else {
print LastErrorMsg(), "In> ";
}
}
None by default.
The Yacas home page : http://yacas.sourceforge.net/
Yacas documentation : http://yacas.sourceforge.net/manindex.html
J-L Morel <jl_morel@bribes.org>
Copyright (c) 2003 J-L Morel. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
Math::Yacas - Perl interface to YACAS |