hcpy 5

A console-based RPN calculator
hcpy is a yet another RPN calculator, written in Python.

Developer comments

I use this calculator for quick answers to arithmetic problems. Here are some examples that show some features:

 python hc.py
 > 1 2 +
 x: 3
 > deg 17.7 tan 23.45M *
 x: 7,484,000.
 > engsi
 x: 7.484 M
 > sig 1Jan2009 10 +
 x: 11Jan2009:00:00
 > now
 x: 9Feb2009:08:57:33.0
 > pi Q
 x: 3 16/113
 > mix
 x: 355/113
 > 1/2 14.134725i + zeta
 x: 0.00000 00176 7 - 0.00000 01110i
 > 60 width brief 10000 fac
 x: 284625968091705451890641...00000000000000000000000000
 > R
 x: 2.846e+35659
 > 100 prec 100 dig i i pow R
 x: 0.20787 95763 50761 90854...13 97886 00277 86542 60353

 
The program is run by running the hc.py file. The > is the calculator's prompt. The first example shows simple addition. The input is parsed on whitespace.

The second example sets the calculator's angle mode to degrees, takes the tangent of 17.7 degrees, then multiplies it by 23.45x106; note that SI prefixes are allowed as substitutes for exponents. The output demonstrates that 4 significant figures are being used and that comma delimiting is turned on. The engsi command shows switching the display to show numbers in engineering mode with SI abbreviations for magnitude. The sig on the next line switches back to significant figure display.

The next example shows the date/time that is 10 days after 1Jan2009. Dates/times are just real numbers (astronomical Julian day numbers) behind the scenes and arithmetic with the other types of numbers can be done. The calculator knows the dates now and today.

pi Q converts the constant pi to a rational number to the current display precision (the QQ command converts them to the current full real number precision). Rationals can be displayed as either proper or improper fractions; the display is toggled by the mixed command. The use of mix demonstrates that the calculator's commands can be shortened as long as the abbreviation is unique. Since rationals use pythons arbitrary-size integers, rational arithmetic is exact.

The next example is a little more complex (pun intended). It shows the evaluation of the Riemann zeta function at its first nontrivial zero. The decimal fraction output is spaced at every 5 digits (also part of the comma delimiting feature).

The next example changes the width of the output screen and turns on brief mode, which forces the output to fit on one line. The factorial of 10,000 is calculated exactly. The R command converts it to a real number, which shows it has more than 35,000 digits.

The last example shows switching to 100 digits of real number precision and displaying 100 digits. The number displayed is ii (e-pi/2), but shortened to fit in the 60 column screen width.

Main features:

  • Simple console-based interface, no mouse or GUI needed
  • Basic scientific calculator functionality similar to HP calculators
  • Perform precise calculations when needed
  • Easy to extend
  • Flexibility in formatted output

last updated on:
February 11th, 2009, 16:21 GMT
price:
FREE!
developed by:
someonesdad1
homepage:
code.google.com
license type:
BSD License 
category:
ROOT \ Science and Engineering \ Mathematics
hcpy
Download Button

In a hurry? Add it to your Download Basket!

user rating 1

1.0/5
 

0/5

Rate it!

Add your review!

SUBMIT