# ProFunCalc

Version 1.9

ProFunCalc is a programmable RPN calculator for the iPhone. It allows the user to write parameterized functions and programs in JavaScript.

## iPhone 5 Screenshots                  ## Usage

Calculator

The calculator uses Reverse Polish Notation (RPN, with 4 stack levels) as its input mode. Here are some examples.

To calculate '2 + 7' press:

2 Enter 7 +

To calculate '8 x (9 - 3)' press:

8 Enter 9 Enter 3 - x

To enter a negative number, press CHS, e.g. to enter '-5' press:

5 CHS

The P(n,r) and C(n,r) functions calculate permutations and combinations of n elements of which r are taken at a time. To calculate P(9,5) press:

9 Enter 5 P(n,r)

Functions

Functions are defined using the JavaScript language. They take their parameters from the stack by accessing the predefined variables _x, _y, _z and _t or they can take up to 5 parameters which must be given a prompt together with the name of a JavaScript variable. When running such a function, the parameters are first prompted from the user and then the function can access them by using the corresponding variables. Using the arrow buttons you can transfer parameters from the calculator and take back results to the calculator.

A function without prompted parameters will immediately turn its result back to the calculator.

A function without prompted parameters can also directly set stack values by returning a result string where the x, y, z and t values are separated by colons. Example:

return "1:2";

This will set x to 1 and y to 2 and no stack lift operations will occur. If a function returns only one value then normal stack lift operations will take place and the returned value becomes the new x value.

The following trig functions (which work accordingly to the currently set angular measurement mode) are predefined:

_sin(), _cos(), _tan()

_asin(), _acos(), _atan()

Constants

Constants can have only numerical values. Non-numerical values are interpreted as 0.

Programs

Programs are written in the JavaScript language. Some utility functions for printing and number formatting are predefined.

Start a new output paragraph:

para()

Print some text:

print(text)

Print a formatted number n in a field of width w and with d decimals:

nprint(n, w, d)

A program can read the current stack values using the predefined variables _x, _y, _z and _t.

Programs do not show any output until they have finished running. A program which has JavaScript errors might output nothing. Running programs can be aborted by pressing the navigation button, thereby returning to the program list.

New since version 1.7: On the iPhone 5 all stack levels are displayed.