General instructions
exporting and importing / formulas syntax

Formulas typed into the main activity's text field are evaluated and added to the top of the history list displayed below (if no error occurred during the evaluation). The result is displayed and stored into an automatically named variable, for use in later formulas.

When the history list reaches its maximum size, it is reduced by a given number of lines; references in the remaining formulas to the removed variables are replaced by their explicit numerical values and remaining variables are automatically renumbered. Before this reduction takes place, the program offers to save the whole history in external storage (like the export menu option). The settings menu option gives access to the maximum size and reduction step of the history list.

The clear menu option destroys the whole history list without asking for confirmation.

By selecting (touching) a formula in the history list, one can import the formula in the text editor, remove the formula (the program then performs a list reduction with variables substitutions as explained above) or change its value. In this latter case a new formula is evaluated and, in the absence of error, is substituted to the selected one. The value of the corresponding variable is changed and all later formulas are re-computed (since this might be a lengthy operation, it is performed in the background and a "progress" dialog box is displayed). A fourth option inserts a new formula below the selected one. In this case, the program renames all subsequent variables (neither substitutions nor recomputing are required).

Two special kinds of formulas (equations and curves) may (and should) use the variable associated to them in their final expression (and only there). It is a syntax error (forward reference) for other types of formulas to refer to their own result. The expression located after the > token is considered as a function of the variable associated to the formula. The result of the evaluation of an equation is a zero of this function or a local minimum of its absolute value (see remarks below). In the case of curves, the value assigned to the variable is always NAN (Not A Number). Equations define a search interval and curves a drawing interval; in both cases the function may be plotted inside the defined interval and a fifth option to do so (draw curve) is displayed when touching the formula in the history list.

Exporting and importing
general instructions / formulas syntax

When the program terminates gracefully, the history list is automatically saved in a private storage location. It is restored from this location when the application restarts. Furthermore, it is possible (before a list reduction or by choosing the export menu option) to save an intermediary snapshot of the history list into a text file.

The program's output files may be stored in any external storage location (if several ones are available, a dialog box is displayed to let choose a destination). They are written in folders named FormulaCalculator (created when necessary) and are named Formulas@date_time.txt, where date and time are the date and time of the export operation.
These files start by a list of formulas (one per line, oldest first), followed by a list of results values:
#0=12/7
#1=ln #0

*** Results ***
#0=1.7142857142857143
#1=0.5389965007326870


The files menu option starts an activity displaying all files of proper name (see above) located in the FormulaCalculator folders. By selecting a file one can:
  1. destroy it
    (if the operation succeeds and the FormulaCalculator folder where the file was located is empty, then the folder is also destroyed)

  2. display its contents
    (the program tries and launches a viewer or editor for MIME plain/text data type; it may happen that none is found on the device: Formula Calculator does not provide one)

  3. (re)load its formulas
    the Files Manager activity closes and the program
Formulas syntax
general instructions / exporting and importing
important remarks
syntax description conventions:
Symbol Meaning
 ( )
single element
 [ ]
optionally
 { }
one or several times
 |
or
 :=
is defined by
bold text
keyword or operator

Syntax
formula := expression | equation | curve
expression := product [{( + | - ) product}]
product := power [{( * | / | % ) power}]
power := term [{ ^ term }]
term := constant | variable | ( function term ) | ( ( expression ) )
constant := IEEE positive floating point constant | $pi | $e
variable := #integer
function :=

-
sign change

abs
absolute value

acos
arc cosine

asin
arc sine

atan
arc tangent

cos
cosine

cosh
hyperbolic cosine

ln
natural logarithm

log
base 10 logarithm

sin
sine

sinh
hyperbolic sine

sqrt
square root

tan
tangent

tanh
hyperbolic tangent

deg
radians to degrees conversion

rad
degrees to radians conversion

int
integer conversion towards 0

rnd
rounding to nearest integer
equation := ? expression , expression [, expression] ; expression [; expression [; expression [; expression]]] > expression
curve
:=
! expression , expression > expression

Remarks
Contrary to C language,
Equations:
Note on the algorithm: it first searches for of a sign change and, in case of failure, tries and finds a local minimum of the absolute value of the function; since the search is bounded, this algorithm always converges.

Curves:
to top