PowerCalc is a calculator app inspired by the Hewlett-Packard calculators, using the RPN system. It is available as an Android app here.
Be warned: if you are looking for a "normal" calculator and you have no idea how an HP calculator works or what Reverse Polish Notation (RPN) is, then you may need a couple of hours to get used to the new way of thinking when operating this calculator. However, many who use RPN prefer how this system makes it easier to organize a calculation, store intermediate results, and (importantly) to make programs.
In this document, buttons are indicated with black background, like + , and output/display contents are indicated with a gray background, like 3.14 . In the button sequence of an example, a number with a gray background, like -2 , can also mean a "finished entered number" as a short-hand for all the buttons that would be required to enter the number. See the section on Entering numbers below.
(After writing this, I realize that some of the content is best viewed in a large browser, not in a mobile browser. Especially some parts where I have attempted to out-smart the limited Google Sites formatting options by using "tab stops" to create tables and matrix formulas.)
When you first open the app, you'll notice two things:
A blank gray area divided into lines. This area is called "the stack", and it is where results are displayed.
Lots of buttons. Pressing the buttons affects what is going on in the stack.
The stack contains numbers, either input values or calculation results. It grows from the bottom. If you start to enter a number with the buttons 1 .. 9 , the new number will go into the lowest element on the stack, and the other contents of the stack move up one place. Traditionally, the lowest stack element is called x, the one above x is called y, and above y is z. Further elements are numbered 3, 4, 5.. up to 15. (This means that x is actually the 0'th element, and that there are 16 stack elements in total.)
Empty stack elements behave as zero. If you perform an operation that involves a stack element that isn't "there", you will get the same result as if it contained 0 .
The stack can be scrolled up and down, you can pinch to zoom, you can swipe left and right between different stacks and you can press and hold to bring up a menu, e.g. to copy a result to the clipboard.
The stack also has a thin line at the very top, with indicators displaying the current calculator state.
The buttons perform operations on the stack. Some operations involve only one number, such as x² . When pressing this button, the number in x will be squared. Other operations involve two numbers, such as + . When pressing this button, x and y are added together, and the result is placed in x. Anything above y on the stack will drop down one level. This method of calculating is called RPN, described below.
Many buttons are yellow. This means that pressing the button will not perform an immediate operation, but will make a new set of buttons available. The new buttons may be presented in a pop-up sub-menu, or they may replace the buttons already visible.
Remember this: A long press on any button displays a help pop-up for that button.
If you press a button you didn't mean to, just move away before releasing. (There is also an undo button under the stack sub-menu that can undo anything that has happened on the stack.)
Entering numbers is much like on other calculators, except for a couple of details. The number buttons, 1 .. 9 and . , work in the obvious way. When you want to enter a minus sign or an exponent, in most situations it only makes sense to do one or the other. Therefore, the two have been combined into the button -/e . If you press the button at the start of a number, you get a minus sign, if you press it in the middle of a number you get an exponent. While entering numbers, the button ⬅ will remove the last digit entered. Let's see how it works with some button presses:
Buttons: 3 . 1 4 ⬅ -/e -/e 4 5
Display: 3_ 3._ 3.1_ 3.14_ 3.1_ 3.1·10_ 3.1·10⁻_ 3.1·10⁻⁴_ 3.1·10⁻⁴⁵_
When you are done entering a number, if you want to perform an operation on the number you can press the operation button immediately. For instance, pressing 2 x² will calculate 4 . However, some operations like + require more than one entered number before it can work! In that situation, the ENTER⬆ button can be used to finish a number that is being entered and fix it on the stack. After this, pressing more number buttons will start to enter the next number. To calculate 2+3, for instance, you have to press 2 ENTER⬆ 3 + . For more details on how this works, see the RPN section below.
In the following, a short-hand description for entering numbers will be used. Instead of displaying the whole button sequence for entering a number, e.g. -/e 3 . 1 4 1 5 9 ENTER⬆ it will be assumed that you know how to enter a number. In an example button sequence below, the number entering buttons may instead be replaced by the number itself, as it would appear on the screen after entering it, like this: -3.14159 . Several numbers in a row implies that you press ENTER⬆ between them, for instance -2 2 means that you should enter two numbers on the stack. (However, as explained in the RPN section below, the second 2 will in most cases not require pressing ENTER⬆ before the next operation.)
Pressing ENTER⬆ when the calculator is not in number entry mode will duplicate the lowest stack element.
Pressing ⬅ when the calculator is not in number entry mode will remove the lowest stack element.
Pressing x≷y when there are more than two stack elements will exchange the two lowest stack elements.
If you pressed the wrong buttons, remember stack undo . More stack related operations are located in the stack menu.
Setting the calculator to hexadecimal mode ( mode HEX ) displays additional number entry buttons A .. F . At the same time, there isn't room for the . button any more. The new button -.e must be used instead to enter both sign, radix point and exponent. If you press this button and don't get the input you want (you wanted an exponent but got a radix point), press it again and the input will change. See the section on Binary representation below to learn how the -/e and -.e buttons work in binary modes.
Reverse Polish Notation, also called postfix notation, is a mathematical notation in which operators follow their operands (e.g. 3 7 +). This is in contrast to the common infix notation, in which operators are placed between their operands (3 + 7). Using RPN in a calculator has several advantages, for instance that it does not require the use of parentheses or a final = button press to calculate the result. From the 1970s, Hewlett-Packard started using RPN in all their calculators.
The framework for implementing RPN is a stack of numbers. The stack is initially empty, and when you type a number the stack grows upwards with the latest entered number at the bottom of the stack. If you start to enter another number, the numbers already on the stack jump up to make room for the new number. To make the stack shrink, you can either clear the lowest element on the stack using the ⬅ button, or you can combine the two lowest elements on the stack using a mathematical operation.
The lowest element on the stack is called "x". In operations with one argument, such as sin , x is used as input and is replaced by the result. The rest of the stack remains the same. The element above x on the stack is called "y". In operations with two arguments, such as + , - , × and ÷ , the x and y stack elements are removed from the stack and the result is placed on the stack instead, as the new x. The rest of the stack moves down one step. Sometimes the element above y is called "z".
For instance, to calculate 3+7, one would press the following sequence of buttons: 3 ENTER⬆ 7 + . The result, 10, will now be the lowest element on the stack, ready for further calculations.
To calculate 3×(2+4), one would press the following sequence of buttons: 3 ENTER⬆ 2 ENTER⬆ 4 + × . What? This is where it is tempting to stop, thinking it would be better with a calculator that allowed 3 × ( 2 + 4 ) = . However, if you want to unlock the power of RPN you must let it grow on you. Also, if you noticed, the RPN calculation above required one less button press!
Let's see what the display will look like as you enter the sequence of buttons above, assuming that you start with an empty stack:
Buttons: 3 ENTER⬆ 2 ENTER⬆ 4 + ×
Stack:
z: 3.00
y: 3.00 3.00 2.00 3.00
x: 3_ 3.00 2_ 2.00 4_ 6.00 18.00
Notice that you don't need to press ENTER⬆ after the 4 (but you could), because the following + operation makes it clear that you are finished entering the number. As you press + , the 2 and the 4 are added to produce 6, and the 3 jumps down, ready for the × operation.
A more thorough RPN tutorial can be found here, except that the ENTER⬆ key works as in the more modern HP RPL system.
Many people have asked why I didn't make a normal calculator. The reason is, "because I wanted an RPN calculator". I made the calculator mostly for myself, to calculate stuff. However, there is a deeper reason, because "why did I want an RPN calculator?" What is the thing that I like about RPN? I guess, having both used RPN calculators for programming, and also having made the program that is this calculator app, the answer that emerges is: "programming". With a stack-based framework, it is remarkably easy to create a system that is programmable, even Turing-complete. Even though the "program" is basically a glorified playback mechanism, executing the button presses as they were entered, it is quite easy to create complex programs that generate beautiful math. Take a look at some of the programming examples.
If you swipe the stack view to the left, an empty area with a big + button appears. If you press it, a new stack window appears. Now you can swipe right and left to switch between stacks. Each stack has its own memory, statistics and financial modules, however programs are shared between stacks. Each stack has its own mode settings, so you can have one stack in decimal mode and another in hexadecimal mode. Results can be copied between stacks by press and holding a stack element and selecting copy or paste . If you need to transfer the whole stack, or memory, statistics or finance contents between stacks, use mode state and the desired copy or paste button.
The calculator has many customizable settings. In the mode menu, you can change the number display format in various ways, selecting the number of decimals visible, select dot or comma for decimal point, select thousands separator, and select binary, octal, decimal or hexadecimal base for number display. The stack demonstration above was made with mode FIX 2 , for instance.
The following indicators are displayed above the stack contents:
DEG , RAD , GON : Indicates the current angular unit used in calculations such as sin . Change with trig DRG .
FIX , SCI , ENG : Indicates that a special number display format is selected. Change with mode : normal , FIX , SCI , ENG .
BIN , OCT , HEX : Indicates that a base different than 10 is used in number display. Change with mode : BIN , OCT , DEC , HEX .
BGN : Indicates that "beginning of month" payments are selected in finance calculations. Change with finance END/BGN .
PROG : Indicates that a program is being recorded. Change with prog : new , edit , finish .
M : Indicates that values are stored in memory. Change with STO , mem : M⬅ .
Σ : Indicates that values are stored in statistics. Change with Σ+ , stat : Σ- , Σ⬅ .
F : Indicates that values are stored in finance. Change with finance : STO , F⬅ .
The calculator implements infinities and NaN following the IEEE754 standard. It is impossible to enter abnormal numbers through the buttons, but they are easily obtained by calculation, like 0 1/x . If an operation produces a result larger than the largest representable number, an infinity value is generated, and ∞ or -∞ is displayed. If an operation produces a result smaller than the smallest representable number, zero is generated. To be able to use such an "underflow" result properly in further calculations, the number -0 may also be produced. If an operation is undefined, a "not-a-number" value is produced and NaN is displayed.
Abnormal numbers are often fine to use in further calculations. In many cases where the final result would be meaningful, abnormal numbers accomplish this. For instance, tan⁻¹(∞)=π/2, 1/∞=0, etc. In most cases where the final result is not meaningful, a NaN will be produced. Additionally, NaN is used to indicate "bad input parameters" or "failure to obtain a valid result" from an algorithm implemented in the calculator, e.g. factorizing a number that is too large.
Examples of operations with abnormal results are:
1 / 0 = ∞
1 + ∞ = ∞
∞ + ∞ = ∞
1 × ∞ = ∞
∞ × ∞ = ∞
0 / 0 = NaN
0 × ∞ = NaN
∞ / ∞ = NaN
∞ - ∞ = NaN
1 / ∞ = 0
-1 × 0 = -0
Any operation involving NaN produces NaN, except NaN to the power of 0:
NaN^0 = 1
The calculator creates complex numbers automatically when you try to use the √x operation on a negative number, or when another operation requires a complex result. Alternatively, a complex number can be created from x and y using the cplx r➡z operation.
Most operations that logically extend to complex arguments have been implemented for complex numbers, i.e. all basic operations, all math operations except Δ% , and all trig operations. For convenience, some integer operations like rounding and truncation work on the real and imaginary part of the complex number separately.
All stack and memory operations handle complex numbers transparently. Financial and statistical modules cannot store complex numbers, so with these modules only the real part of the numbers are stored/used. Any operations that are undefined for complex numbers or that have not been implemented yet, results in NaN when used with complex input(s).
Complex numbers are unordered (like the value NaN), i.e. you cannot say in a general way that "this complex number is less than that complex number". Consequently, any comparison operations (e.g. x<y? when programming) behave as if the condition does not hold if any of the arguments are complex. Similarly, min or max operations will result in NaN.
Complex operations work strictly in radians, so when the input is complex (i.e. it has a non-zero imaginary part), operations involving the angle of the complex number (i.e. most trigonometric and power functions) will automatically cause a switch from degrees DEG or gons GON to radians RAD .
Matrices can be created using the matrix : ➡row , ➡col and ➡A operations or by using the operations concat and stack to combine two normal numbers. (That is the stack button in the matrix menu, not the yellow stack menu button.)
As an example, we will build the following matrix using three different methods (explicitly showing all the button presses for clarity):
⎡ 1 3 5 ⎤
⎢ 2 4 6 ⎥
⎣ 7 8 9 ⎦
The first method is using only concat and stack to build row vectors piece by piece and stacking them:
1 ENTER⬆ 3 concat 5 concat 2 ENTER⬆ 4 concat 6 concat stack 7 ENTER⬆ 8 concat 9 concat stack
The second method is building the row vectors directly using ➡row [1×3] and stacking them:
1 ENTER⬆ 3 ENTER⬆ 5 ➡row [1×3] 2 ENTER⬆ 4 ENTER⬆ 6 ➡row [1×3] 7 ENTER⬆ 8 ENTER⬆ 9 ➡row [1×3] stack stack
The third method is entering the all the 9 numbers of the matrix and building the matrix in one go using ➡A [3×3] , like this:
1 ENTER⬆ 3 ENTER⬆ 5 ENTER⬆ 2 ENTER⬆ 4 ENTER⬆ 6 ENTER⬆ 7 ENTER⬆ 8 ENTER⬆ 9 ENTER⬆ ➡A [3×3]
Since the stack is 16 elements high, the last method is limited to matrices with 16 elements. Try the different methods and see what happens. Matrices are displayed on one stack line as e.g. M:[3×4] . This indicates a matrix of 3 rows and 4 columns. With a matrix on the stack you can press and hold the stack element containing the matrix and select inspect to see the matrix contents. This pop-up matrix view can be panned and pinch-zoomed (horizontal pinch resizes the cells, vertical pinch resizes the numbers).
Most operations that logically extend to matrix arguments have been implemented for matrices, i.e. operations such as + , 1/x and x² , even yˣ for square matrices and integer x.
All stack and memory operations handle matrices transparently. Financial and statistical modules cannot store matrices, so with these modules a matrix is treated as NaN. Any operations that are undefined for matrices (or that have not been implemented yet), results in NaN when used with matrix input(s).
Matrices can contain complex numbers and some complex operations are supported. Matrices can not contain numbers with units, and not other matrices. If a result produces a 1×1 matrix, it is automatically converted to a normal (or complex) number.
Large matrices may be demanding on the system (i.e. you phone). When creating especially large matrices you may experience "Out of memory error". Also, operations on large matrices may be hopelessly slow. There may also be a limit to how much matrix data the calculator can save when you exit. If the calculator misbehaves, it may be necessary to clear all stored data associated with the app.
Numbers with units can be created by entering a normal number and setting a unit using one of the operations ×unit or ÷unit (i.e. unit-multiply and unit-divide respectively). Scientific constants will automatically appear with their correct SI unit, unless you change the setting in the mode menu.
For instance, pressing 3 unit ×unit m ÷unit s , will display the value 3 m/s . To convert this to miles per hour you press ➡unit speed mph .
Unit arithmetic works for most operations that logically extend to arguments with units, i.e. operations such as + , 1/x and x² , even yˣ and ˣ√y for integer x. Matrices can not have units, but complex numbers can (e.g. when calculating electric potential, V).
All stack and memory operations handle units transparently. Financial and statistical modules cannot store units so with these modules the units are ignored. In operations that are undefined for units or that have not been implemented yet, the units are also ignored.
The calculator supports many different units, also different units for the same physical property. For instance, there are 16 different units for length. All units are composed of, and can be reduced to 9 base units; length, mass, time, temperature, current, luminous intensity, angle, currency, and the chemical unit "mol".
A particular unit may contain several base units raised to varying powers (e.g. "m/s²"), and for each base unit a particular unit variant (e.g. "kg" or "lb" for mass) will be in use. A unit may also contain higher order units. A higher order unit is a unit that represents a composite of more than one base unit, but cannot be decomposed to the base units without a conversion. For instance, an "acre" represents "length" raised to the power of 2, but it is not composed of any particular "length" unit such as "m". Consequently, to calculate the square root of an acre, the calculator must convert it to "ft²" first (choosing "ft", because "acre" is also an imperial unit). As with the base units, there can be variants of a higher order unit as well, for instance there are 12 higher order units that all represent "volume".
It is possible to do arithmetic on numbers with different units, but it may be necessary to reconcile the units before the calculation can take place. If an operation takes two arguments and the units of x and y are different, the unit of y is first converted to the unit of x. Then the value of y is scaled according to the ratio of the unit conversion before the operation is executed.
For operations that require the same type of unit in x and y, e.g. addition, the unit of y must be fully converted to the unit of x. If this is not possible, the operation takes place as if the units were not present, and the unit of the result is displayed as [err] . For other operations, e.g. multiplication, only the parts of the units that represent the same physical property will be reconciled. For instance, 1 m/s in y, multiplied by 1 h in x, becomes 3600 m , since y is first converted to "3600 m/h".
Units are displayed directly behind the numbers on the stack. For brevity, if a unit contains more than one base unit raised to a negative power, the units are joined by a "·" after the "/" without surrounding parentheses, e.g. "8.314472 J/mol·K" (meaning "J/(mol·K)"). Additionally, when displayed, many common unit combinations will be reduced and replaced with a symbol representing a composite unit. For instance, the unit "kg·m²/s²" will be displayed as "J", without actually changing the existing unit into a "higher order" unit or anything. More complex units may be reduced several times before they are displayed. The logic behind this reduction tries to construct the most compact form while maximizing the meaning of the displayed form. For instance, the unit "kg/s³" is displayed as "W/m²", because square meters are more logical than cubic seconds.
You can press and hold the stack element containing a unit and select inspect to see which base units a reduced unit represents.
Imperial units that have the same spelling as an American unit are presented in the menus and displayed on screen in italics. These units are ton (long ton), fl.oz, cup, pt and gal. Similarly, the symbol for the standard gravity g is displayed in italics (as usual) to distinguish it from the symbol for gram.
For each base unit and higher order unit, there is a limit of 127 to the power that a particular unit can be raised to. If a unit calculation results in a base unit raised a power that is too high, [ofl] is displayed.
When a unit error or overflow has occurred, the unit is displayed as [err] or [ofl] , respectively. If such a unit is used in combination with another unit, the result will also be [err]. On the other hand, if an [err] or [ofl] unit is combined with another [err] or [ofl] unit, or is combined with a number without a unit, the unit will simply "evaporate" and disappear.
SI prefixes such as "k" for "kilo-" and "m" for "milli-" are not generally supported for all units, just in some special cases due to common usage. It is worth noting that most prefixed units, such as "kW", are "higher order" units in the same manner as "hp", and will usually survive intact (i.e. not be decomposed) in calculations. For instance, "1 kW" multiplied by "2 h" becomes "2 kW·h". On the other hand "W" is a "reduced" unit; simply a shorter way of displaying the underlying unit "kg·m²/s³". When multiplying "1 W" (in y) by "2 h" (in x), the unit factor "s-3" of "W" is first converted to "h" before the multiplication takes place, resulting in the surprising value "93312000000 kg·m²/h²". This may seem strange, but this is an unfortunate byproduct of how unit arithmetic has been implemented, and will often lead to unexpected results when calculating with non-SI units. Use ➡unit SI to see the more familiar result "7200 J". It is impossible to make the calculator show the result as "2 W·h", since it would require two conflicting time units, "s" and "h", being present in the unit at the same time. For the same reason it is very confusing to try to find out how much one mile per gallon corresponds to in liters per kilometer.
Time and date calculations can be performed using specialized units. The DH.MS unit, when applied to numbers in the format yyyymmddHH.MMSS, causes the number to be displayed in date/time ISO format. If the HH.MMSS part is zero, only the date is displayed (but you still have to type zeros where HH should have been.)
For instance, pressing 2024022414.02 unit ×unit time DH.MS will display the date/time value 2024-02-24 14:02 . The DH.MS unit does not mix with other units, you cannot multiply it by "1 m", for instance. However date/time values can be used in calculations using + and - , in some time and astronomical operations, and it can be converted to other calendars and time units.
Time durations can be represented with the dH.MS unit. This unit, applied to numbers in the format dddHH.MMSS, causes the number to be displayed as days and time. If the ddd part is zero, only the time is displayed. This unit is used for date/time differences. For instance, date - date is a (possibly negative) duration, date + duration is a date, while date + date does not make sense.
The calendar implemented by the DH.MS unit is the Gregorian calendar from October 15th 1582 and onwards, and the Julian calendar up to and including October 4th 1582. The dates between "do not exist" because they were skipped by Pope Gregory XIII. Furthermore, the Gregorian calendar did not take effect until 1752 in Britain and her colonies (including the United States), and various other countries had other switch-over times. This means that care must be taken when calculating dates in those time periods, and most likely this calculator will give the wrong date unless the event happened in Roman Catholic Europe.
Dates before 525 AD (when the Anno Domini era was introduced) will not match any year numbering that they used at the time, but the month and days are accurate for those that had adopted the Julian calendar, all the way down to 8 AD. Preceding 8 AD, this calculator extrapolates dates using the Proleptic Julian calendar. If yyyy ≤ 0, by ISO 8601 convention the year represented is "1-yyyy BC". However, ISO 8601 does not state which calendar should be used prior to 1582, only that these dates "shall only be used by mutual agreement" regarding the calendar.
Date/time values can be converted to common time units, such as ➡unit s . This will convert the date/time value to Unix time, where 0 corresponds to midnight (00:00 UTC) January 1st 1970.
Date/time values can also be converted to Julian Days and Modified Julian Day using the units JD and MJD respectively. Beware that date/time values are specified without a time zone. If you are in a different time zone than UTC, you may have to add or subtract some hours to get a correct Unix, JD or MJD time value. The current time zone can be found with unit time TZ . Subtracting this value from the local time gives UTC.
Latitude and longitude can be represented using a specialized unit. The D.MS unit, when applied to numbers in the format DDD.MMSS, causes the number to be displayed as degrees, arc-minutes and arc-seconds.
For instance, pressing 59.564265 unit ×unit angle D.MS will display the angle as 59° 56' 42.65" .
The calculator can also fetch position coordinates from the system's own positioning system, for instance using unit pos lat . The position is given in the WGS-84 geodetic reference datum. The calculator can convert between latitude, longitude and altitude in WGS-84 to 3D coordinates in the ECEF (Earth-centered, Earth-fixed) coordinate system, represented by a 3×1 column vector in meters.
The const menu contains scientific constants that, like pressing π , can be entered on the stack and used in calculations. The constants are entered with units, however this can be turned off in the mode menu or the unit can be removed using unit⬅ . Constants were obtained from http://physics.nist.gov/cuu/Constants, and are based on CODATA 2022 recommended values.
PowerCalc is fully programmable with flow control and looping. To record a program, press prog new , select an empty button and enter the name of the program that will be displayed on the button, for instance "f". Then record the operations you wish the program to perform, for instance ENTER⬆ x² + 1 - , before pressing finish . When you run the program, the operations in the program are played back and affects the contents of the stack. For instance, given the program above, if you press 2 run f , the result will be 5 , just as if you had pressed 2 ENTER⬆ , followed by ENTER⬆ x² + 1 - .
When program recording has been activated (after prog new or prog edit ), all operations are recorded in the current program. In this mode, the contents of the prog menu itself changes to show different operations that are only applicable while programming, such as LBL and GTO . This also hides operations that are not applicable while programming.
The program recorded so far is displayed to the left of the stack. This view can be scrolled and pinch-zoomed, and you can also drag the partition between the program view and the stack.
In the program view, the current program position can be moved by pressing a specific line. New operations recorded will be inserted before the current position. Removing steps with step⬅ will remove the line above the current position (this can be a little confusing). Pressing ⬇step will execute the operation at the current position and advance the position (without inserting a ⬇step operation into the program). The operations recorded at the current position are also executed and affects the stack immediately, which is not necessarily in the order of the finished program. Your stack may get widely out of sync with what will happen when the program is actually running. Therefore, when using prog edit , it can be a good idea to enter some valid inputs on the stack first, then set the current position to the top of the program, and keep pressing ⬇step until you are in the area of the program you want to edit.
While programming, using the stack undo operation does not remove any statements from the program, it only adds the "undo" operation to the program as well. Typically, you will press undo anyway to fix up the stack with respect to what you did wrong, then step⬅ step⬅ to remove the undo operation and the operation you entered wrong.
A program is called a function if it uses the x on the stack as input, and produces a new number on the stack as output. The value left in x when the program finishes is used as the function value f(x). The program example f above, is a function that calculates f(x)=x²+x-1. Functions can be graphed, integrated, differentiated, solved, minimized and maximized. During these operations, the function program is run repeatedly with different x values placed on the stack.
When integrating, first enter the range over which you want to integrate. For instance, integrating f(x)=x²+x-1 from x=0 to x=6 can be done by pressing 0 6 prog ∫ f(x)dx f , and yields the result 84 . If the algorithm fails to produce the desired accuracy (the function may not be integrable), the unfinished result is placed on the stack and a message is shown. The algorithm may handle integration through a singularity, but in this case the algorithm works better if the singularity is at x=0 and the first integration limit is also 0. The accuracy of the result will most often be around 15 digits, but depending on the difficulty of the function to be integrated, it may be much better or worse than this.
When differentiating, enter the x for which you want to differentiate. When the operation is finished, the result is placed on the stack. For instance, differentiating f(x)=x²+x-1 at x=3 can be done by pressing 3 prog f'(x) f , and yields the result 7 . Numerical differentiation is hard to do accurately, the accuracy of the result is at rarely more than 13 digits.
When solving, enter two limits that "straddle" the solution, i.e. two x values for which the corresponding function values have opposite sign. When the operation is finished, the result is placed on the stack. For instance, finding a solution to x²+x-1=0 that we suspect lies between 0 and 2 can be done by pressing 0 2 prog f(x)=0 f , and yields the result 0.6180... . If you wonder what the number 0.6180... actually is, press prob guess , and the calculator will tell you it is (√5-1)/2. The accuracy of the result is in most cases 19 digits, but this depends on the accuracy of the operations used in the program.
When minimizing or maximizing, enter two limits in such a way that the calculator can decide if it should do minimization or maximization. To decide, it inspects the function value midway between the limits. If this value is greater than the function value at both limits, the operation will be maximization. If the value is less than at both limits, the operation will be minimization. If the value lies in-between, the criterion is undecided and an error is shown. When the operation is finished, the result placed on the stack. For instance, finding the minimum of f(x)=x²+x-1 that we suspect lies between -1 and 1 can be done by pressing -1 1 prog f'(x)=0 f , and yields the result -0.5000... .The accuracy of the result is much worse than for solving because of the flatness of a curve at a minimum/maximum, in most cases only about 10 digits.
If you make a program that runs forever, e.g. a sequence of LBL 0 followed by GTO 0 , when executing the program it will be allowed to run for 5 seconds before it is stopped with an error message. However, when graphing the program must be executed several times. Therefore the timeout is much smaller, only 100 ms.
Graph drawing, integration, differentiation, solving, min/max-ing and calling other programs recursively cannot be programmed, as well as some commands on the mode menu.
Programming examples are so varied and fun that they have their own page.
Before drawing graphs, you must first enter the ranges along the x axis and y axis that you want to see during drawing. For instance, you could draw the graph from the previous programming example f using -2 2 -2 2 prog draw y=f(x) f . This will pop up a window showing the function f(x)=x²+x-1 from x=-2 to x=2 and from y=-2 to y=2. This window can be dragged and pinch zoomed to adjust the limits. If you press and hold, a menu pops up where you can vary graph colors, graph thickness and so on.
The draw menu has many graph drawing options. Another we can try right away is polar graph drawing. First make sure that the calculator is in radian mode, by pressing trig DRG until the RAD symbol shows. Then, with the limits already in place from the previous graph, press prog draw r=f(θ) f . When drawing this graph, the calculator starts with the input θ in the range [0, 10·2π], executes the function, and the result is used as the radius corresponding to the input angle θ, which determines the shape of the graph.
We can immediately draw the graph in a third way, prog draw z=f(z) f . What are we looking at now? For every point (x, y) the complex input z=x+iy is put on the stack before evaluating the function f . The output, a complex number z, is drawn according to these rules: the color depends on the angle of z (i.e. arg(z)), and the brightness depends on the length of z. However, since the length of z may vary wildly, the brightness is 0 (black) when |z|=0, and the brightness is at max when |z|=0.999.., then it goes back to 0 again when |z|=1. In other words, the brightness equals |z| mod 1. This may not be a very instructive way to color the output when looking at our function f , but it can give us a rough feeling for how the function behaves with complex input.
Graphing z=f(z) can be used with imagination. If you have a function that does not use complex numbers, but instead takes two inputs, f(x,y), you can start the program with cplx z➡r , and x and y will contain the coordinates. After calculating something interesting with x and y that can be interpreted as hue [0, 2π] and intensity [0, 1], you can convert this to a complex number at the end of the program using the following pseudo-sequence of operations: hue ENTER⬆ intensity trig p➡r cplx r➡z . However, it goes further! If the result of the function is not a complex number, but a 3D vector, then the function that is drawn is instead [r,g,b]=f(z). The red, green and blue color components of the output vector are clamped to the range [0, 1]. To generate this output, the function may for instance end with the following pseudo-sequence of operations: red ENTER⬆ green ENTER⬆ blue matrix ➡col [3×1] .
Graphing z=f(t) is not very interesting with our current example program, so it will only be explained. When drawing this graph, the calculator starts with the input t as a real number in the range [0, 1], executes the function, and the result is used as a point (x, y) in the complex plane. It can easily be used to draw the parameterized curve [x,y]=f(t) by ending the function with cplx r➡z .
Graphing f(x,y)=0 , can be quite interesting. Suppose you have a curve determined by the equation x²-y²+1=0. What does the curve look like? The two-input function f(x,y)=x²-y²+1 can be programmed in the following way: prog new "conic" math x² x≷y x² - 1 + prog finish . When graphing f(x,y)=0 , the calculator starts by pushing two inputs to the stack, y and x. It then executes the function, looking for points in the x/y plane where f(x,y)=0, and plots them. The result can be seen by pressing e.g. -2 2 -2 2 prog draw f(x,y)=0 conic . Suddenly we have a graph with more than one y value for each x!
(Why is the graphing operation made as f(x,y)=0 , and not f(z)=0 ? Wouldn't it be easier with just one input, like in the other graphing operations? The answer is that this graphing task has fundamentally nothing to do with complex numbers. If you had a complex function, like f(z)=sin(z), finding the 0-points of the function in the complex plane would be like looking for needles in a haystack and it would not be interesting to look at at all. Implementing the graphing operation as f(x,y)=0 makes it clear that we are expecting a function with two real inputs and one real output value.)
Function evaluation can be parameterized by storing a parameter in memory, and then using the stored parameter when calculating the function result. For instance, the function f(x)=ax²+bx+c can be parameterized by storing a, b and c in M0, M1 and M2, and rewriting the function as f(x)=M0·x²+M1·x+M2. This function can be programmed like this:
prog new "abc" ENTER⬆ math x² RCL M0 × x≷y RCL M1 × + RCL M2 + prog finish
Assign values to a, b and c by storing to M0, M1 and M2 respectively, for instance 1 STO M0 STO M1 STO M2 , and then draw the function as described above using draw y=f(x) abc .
This can be made more interesting by allowing the user to vary the contents of M0, M1 and M2 live during graph drawing. To do this, enter the limits of the variation interval on the stack, and use the draw param operation, for instance like this:
-2 2 prog draw param M0 draw param M1 draw param M2
Now, while drawing the graph, the contents of M0, M1 and M2 can all be varied between -2 and 2 by dragging a slider. Up to 3 memory locations can be parameterized like this. To turn a parameterization off, press e.g. draw param M0 again.
The financial module allows you to specify 4 out of 5 financial parameters and solve for the fifth. Use finance STO to put values in and solve to calculate results. The parameters are:
pv: The present value in the account
fv: The future value in the account after np number of payment periods
np: The number of payment periods
pmt: The amount of each periodic payment
ir%: The interest rate of the account per period, in percent
Use negative values for owed balances and money paid to the account, positive values for balances in your favor and money withdrawn from the account. Also enter the interest rate per period, not per year. If you are making monthly payments and have an annual interest rate, divide the annual rate by 12 (*). Thus, one period of an 8% annual rate is 8/12=0.6666%.
[* This business of dividing an interest rate by 12 is not mathematically correct, but since the banks use this procedure it is wise to do it also, otherwise your numbers may not agree with those of the bank. To calculate the nominal monthly interest rate from an effective annual interest rate, use the y%/x operation, which actually calculates ((1+y/100)1/x - 1)·100]
If you start a loan of 1000 dollars at an interest rate of 15% per year, and pay 200 dollars in down payment at the end of each year, how many years would it take to become debt free? In this case, pv=1000 (withdrawn, positive), fv=0, pmt=-200 (paid, negative) and ir%=15. Start by pressing 1000 STO pv , and so on. Pressing solve np gives the result 9.92 which means you would be debt free after 10 years. (And during that time you have paid np × pmt dollars, nearly 2000.)
If you start a savings account and deposit 100 dollars at the beginning of each year at an interest of 5%, how much would you have after 10 years? In this case pv=0, pmt=-100, np=10 and ir%=5. Store pv, pmt, np and ir% first. In addition, you must set "beginning of period payments", by pressing END/BGN so that the BGN mode indicator is lit. Pressing solve fv gives the result 1320.68 which is what the future value will be.
In binary modes ( HEX , OCT and BIN ), fractional numbers are not rounded to integers, but are instead displayed with the fraction visible in exactly the same manner as decimal numbers, depending on the number format (normal, FIX , SCI and ENG ). If a number is displayed with an exponent, the exponent itself is still displayed in decimal form.
Negative numbers are displayed as a generalized form of "two's complement", with the following interpretation: Negating the number inverts all bits, including an infinite number of 1-bits before the radix point and an infinite number of 1-bits after the radix point. The infinite number of 1-bits before the radix is represented by the prefix /F (or /7 or /1 in OCT and BIN modes). The infinite number of 1-bits after the radix is rounded upwards producing an infinite number of 0-bits, until the first 0-bit is encountered which will be switched to a 1 (rounded or not, these two forms are mathematically equivalent). For example, the number 1 , negated, will become (in binary mode) ...1111110.111111... Rounding of the infinite number of 1's after the radix gives the number ...1111111.000000... , and is displayed as /1111111 which is the way we usually see -1 as two's complement.
Bitwise operations with negative numbers ( and , or , xor and bic ) use the generalized "two's complement" representation of the number when interpreting the bits. However, beware that normal rounding that occurs when the display cannot display all the significant digits of a number may cause inexact values to appear different in the display than their internal representation.
One consequence of the representation of binary negative numbers is another twist to the operation of the buttons -/e and -.e . When pressing these buttons at the start of number entry, the sign / is displayed instead of the normal - . This sign, as explained above, should be read as "an infinite number of 1-bits preceding the number". Pressing the button again exchanges / with a normal minus sign, indicating the input of a normal negative number which will be converted to two's complement on ENTER⬆ .
The calculator does not have a fraction calculation mode like a/b or a b/c . This can make it difficult to decide what the number actually is, after a calculation, when the display shows for instance 2.617021276595745 . The prob guess operation will tell you, in this case that this number is definitely 123/47. The guess operation can guess a whole range of formulas, not just a/b, but also a·π/b, ln(a/b) and many others. The function will also provide a probability estimate for how likely it is that the given formula is the correct one, among those considered. This estimate is only correct provided that no other type of formula fits even better, i.e. formulas that are not considered during the operation.
The formulas that can be guessed are the following, where a and b are integers less than 231 :
a/b √(a/b) ³√(a/b)
a·π/b a·π²/b a/(b·π) a/(b·π²)
e a/b 2 a/b 10 a/b
ln(a/b) log₂(a/b) log₁₀(a/b)
(a±√b)/c for a ≤ 100 and c ≤ 100
Sometimes the display is not wide enough. A complex number or a value with a very many units combined may hide the decimals that you want to see. Perhaps you just want to see all the decimals of the result. In any case, if you press and hold a stack element with a number in it, a pop-up menu appears with the command inspect . The inspect command will attempt to tell you "everything the calculator knows" about the value. It will show you all the decimals available at the full accuracy of the calculator. If the number has a unit that is displayed in reduced form, for instance "J", it will tell you that the unit is actually "kg·m²/s²". If there is a guess that fits particularly well it will tell you that. If it is an integer it will tell you if it is a prime number or else factorize it. If the stack element that you are inspecting is a matrix, it will show you a view of the matrix that you can pan around in.
PowerCalc supports import and export through the clipboard. After calculating a result, press and hold a stack element and select one of the copy modes:
copy value : Copy the stack value in a formal data interchange format (i.e. JSON), suitable for pasting as accurately as possible into another stack or another PowerCalc instance (it can for instance be e-mailed).
copy text : Copy the stack value exactly as it is displayed, in text format. This format uses Unicode characters to render exponent superscript numbers, and will look good in many text editors.
copy HTML : Copy the stack value exactly as it is displayed, in HTML format. This format uses HTML tags to render exponent superscript numbers, and will look good in web publishing applications.
If the current contents of the clipboard can be interpreted as a valid stack element (for instance, it may be recently copied using copy value ), then press and hold on the stack will display a paste button. Pasting will enter the clipboard contents into the lowest stack element.
Export and import of the contents of the entire stack, memory, statistics, finance and programs are available with copy and paste buttons under the mode state menu. Here, the JSON data interchange format is used throughout, except for programs that use a more suitable text format. Examples of exported programs and other exported content can be found in the programming examples.
When drawing a graph, press and hold on the graph window also provides a copy button, that will copy the graph as an image to the clipboard. Unfortunately, not many apps support pasting of images.