-
-
06 May 2016 15:18:54 UTC
- Distribution: Math-Cephes
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues (4)
- Testers (1980 / 10 / 0)
- Kwalitee
Bus factor: 1- 70.44% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (305.54KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
pmath - simple command line interface to Math::Cephes
SYNOPSIS
bash> pmath Interactive interface to the Math::Cephes module. TermReadLine enabled. Type 'help' or '?' for help. pmath> setprec 4 display set to 4 decimal places pmath> cos($PI) -1.0000 pmath> acos(%) 3.1416 pmath> q bash>
DESCRIPTION
This script provides a simple command line interface to the
Math::Cephes
module. If available, it will use theTerm::ReadKey
andTerm::ReadLine::Perl
orTerm::ReadLine::GNU
modules to provide command line history and word completion.Typing
help
or?
alone will provide a list of help topics grouped by major category name.help category
will provide a listing and short description of each function within the named category.help function
will provide a description and synopsis of the named function.Entering an expression that returns a single value, such as
sin($x)
, or one that returns multiple values, such asairy($x)
, will result in all return values being printed. The last (successful) single value returned is saved as the%
symbol (as in Maple), so that one can dopmath> sin($PI/2) 1 pmath> asin(%) 1.570796 pmath>
The number of decimal places displayed can be set to
j
usingsetprec j
:pmath> setprec 8 display set to 8 decimal places pmath> $PI 3.14159265 pmath>
Multiple statements can be entered on a line, such as pmath> $x=1; $y=exp($x); printf("\texp(%5.2f)=%5.2f\n",$x,$y); exp( 1.00)= 2.72 pmath>
or on multiple lines using
\
as a continuation signal:pmath> $x = 1; \ $y = exp($x); \ printf("exp(%5.2f)=%5.2f\n", $x, $y); exp( 1.00)= 2.72 pmath>
To quit the program, enter
q
,quit
, orexit
.The
Math::Cephes
module has some support for handling fractions and complex numbers through theMath::Cephes::Fraction
andMath::Cephes::Complex
modules. For fractions, one can use thefract()
function to create a fraction object, and then use these in a fraction routine:pmath> $f=fract(1,3); $g=fract(4,3); $f->radd($g); 5/3 pmath> mixed(%) 1 2/3 pmath>
Similarly, for complex numbers one can use the
cmplx()
function to create a complex number object, and then use these in a complex number routine:pmath> $f=cmplx(1,3); $g=cmplx(4,3); $f->cadd($g); 5+6 i pmath>
See Math::Cephes::Polynomial for an interface to some polynomial routines, and Math::Cephes::Matrix for some matrix routines.
BUGS
Probably. Please report any to Randy Kobes <randy@theoryx5.uwinnipeg.ca>
SEE ALSO
Math::Cephes, Math::Cephes::Fraction, Math::Cephes::Complex, Math::Cephes::Polynomial and Math::Cephes::Matrix.
COPYRIGHT
This script is copyrighted, 2000, 2002, by Randy Kobes. It may be distributed under the same terms as Perl itself.
Module Install Instructions
To install Math::Cephes, copy and paste the appropriate command in to your terminal.
cpanm Math::Cephes
perl -MCPAN -e shell install Math::Cephes
For more information on module installation, please visit the detailed CPAN module installation guide.