Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Bringing the math tools of Python to the command-line

Project description

Bringing the math tools of Python to the command-line

Doing math on the command-line is hard. Integer math can be done with BASH, but the only utility around for floating-point math is bc, and that can be confusing with its scale and precision. What if you want the power of Python’s math, perhaps programmatically? Enter: pmath.


Basic input:

$ pmath '3 + 4'
$ echo '3+4' | pmath
$ pmath <<< 3+4
$ pmath 'x=3;x+2'

You can set the output format with a -f switch:

$ pmath -f .4f <<< pow(2000, 1/3)
$ pmath -f .4f <<< sin(pi/2)

Enabling complex math operations is straightforward with -c:

$ pmath -c <<< exp(1j*pi).real
$ pmath -f.2f -c 'ang=3*pi/4; exp(1j*ang)'


Running pip install pmath will install the command-line utility.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pmath, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size pmath-0.3.linux-x86_64.tar.gz (3.6 kB) File type Dumb Binary Python version any Upload date Hashes View
Filename, size pmath-0.3.tar.gz (3.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page