Joel Berger > Math-Mathematica > Math::Mathematica

Download:
Math-Mathematica-0.002.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.002   Source  

NAME ^

Math::Mathematica - A Simple PTY connection to Wolfram's Mathematica

SYNOPSIS ^

 use Math::Mathematica;
 my $math = Math::Mathematica->new;
 my $result = $math->evaluate('Integrate[Sin[x],{x,0,Pi}]'); # 2

DESCRIPTION ^

Although there are more clever mechanisms to interact with Wolfram's Mathematica (namely MathLink) they are very hard to write. Math::Mathematica simply starts a PTY, runs the command line math program, and manages input/output via string transport. While a MathLink client for Perl would be ideal, this module gets the job done.

This module does not contain a Mathematica interpreter. Mathematica must be installed on the computer before installing/using Math::Mathematica.

METHODS ^

new

Constructor method. Takes hash or hashreference of options:

evaluate

Takes a string to pass to the Mathematica interpreter for evaluation. Returns a string of results. Prompt makers are stripped from the result.

log

If the log constructor option was set, this accessor will contain the full I/O log of the PTY connection, including Mathematica prompts.

pty

Accessor method which returns the active IO::Pty::Easy object. This object will be closed when the Math::Mathematica object is destroyed.

SEE ALSO ^

IO::Pty::Easy
IO::Pty

SOURCE REPOSITORY ^

http://github.com/jberger/Math-Mathematica

AUTHOR ^

Joel Berger, <joel.a.berger@gmail.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2012 by Joel Berger

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Mathematica, MathLink and Wolfram are trademarks of Wolfram Research, Inc. http://www.wolfram.com

syntax highlighting: