GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PMATH (1)

.ds Aq ’

NAME

pmath - simple command line interface to Math::Cephes

CONTENTS

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 the Term::ReadKey and Term::ReadLine::Perl or Term::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 as airy($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 do



     pmath> sin($PI/2)
            1
     pmath> asin(%)
            1.570796
     pmath>



The number of decimal places displayed can be set to j using setprec 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, or exit.

The Math::Cephes module has some support for handling fractions and complex numbers through the Math::Cephes::Fraction and Math::Cephes::Complex modules. For fractions, one can use the fract() 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.
Search for    or go to Top of page |  Section 1 |  Main Index


perl v5.20.3 PMATH (1) 2012-10-23

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.