# Javia Calculator

Javia Calculator is an *easy-to-use* calculator for mobile phones.
It features a user interface designed for the mobile phone's keypad, which allows quick input of mathematical expressions.

Built-in functions include trigonometric and hyperbolic functions, logarithms and exponentiation, combinations, permutations and factorial. New variables and functions may be defined by the user.

Moreover, functions *f*(*x*) of one variable can be plotted, and functions *f*(*x,y*)
of two variables can be visualised in a grayscale "map". Parametric plots, where x and y coordinates
are determined by a pair of single-parameter functions, are also supported.

## Download

The most recent version is 0.1.4, released on 2007-11-04:

calculator.jar (size 40 kB).

calculator.jad

If you type the download link on a mobile phone, use the short form calc.javia.org/jad

## Open Source

Javia Calculator is open source under the MIT License. You can access the source code (subversion repository): http://svn.javia.org/calculator/.

Javia Calculator is developed by Mihai Preda and Carlo Teubner. Mihai started the project and released the first version towards the end of 2006. Carlo joined the project in the summer of 2007 and made very substantial contributions since; most notably, Carlo did all the graphing work (plot, map, par).

Suggestions and bug reports are welcome, please post to the discussion group,

javia-calculator@googlegroups.com

## Key-Menus

The two keys ***** and **#** are special, because they
open the *operators key-menu* and the *functions key-menu*, respectively.

When either key-menu is displayed, select an entry by pressing
the corresponding key on the numeric keypad (**1**-**9**, ***0#**).
The top row of the key-menu corresponds to keys **1 2 3**, the middle row to
keys **4 5 6**, and the bottom row to keys *** 0 #**.

For example, pressing the ***** key while the operators key-menu is active produces
the **+** operator, while the **7** key produces the ***** operator,
as is displayed in the menu visible on the screen.

While the left key-menu contains the operators, the right key-menu (activated with the **#** key)
contains everything else: the decimal dot, variables, constants, functions, and the plotting commands.

Some entries in the functions key-menu are displayed with a green lower-left corner, such as . Selecting these entries opens additional sub-menus that contain related entries. For example, the

entry opens the trigonometric menu where you can find sin, cos, tan, etc.
The sub-menu items are arranged such that pressing the key for a green-corner entry twice produces the
corresponding symbol directly. For example, when the functions key-menu is active, pressing
***** twice produces the **sin** function.

To dismiss a key-menu without making a selection, press any key corresponding to none of the entries.

## Operators

Pressing*****opens the operators key-menu, containing the usual operators

**+ - * /**, parentheses

**( )**, as well as:

% | real modulo (remainder). E.g. 1.75 % 0.5 = 0.25 |
---|---|

^ | power (exponentiation) |

! | the factorial, extended to the real numbers (Gamma function) |

, | the comma is used to separate the arguments of a function.
E.g. `min(3/4` . |

## Functions, constants, decimal dot

Pressing**#**opens the functions key-menu. This menu contains everything except the operators:

trigonometric functions menu: sin cos tan, asin acos atan, and their hyperbolic variants. | |

logarithms menu: lg (base 10 logarithm), ln (natural logarithm), lb (base 2 logarithm), cbrt (cubic root). | |

. | decimal dot |

pi | π = 3.141592653589793... |

e | e = 2.718281828459045... |

various functions: combinations, permutations, random number generator, fractional and integer part, min, max, abs. | |

plotting functions: plot (draws the graph of a function of one variable), map (draws a grayscale "map" of a function of two variables), par (produces a parametric plot of two functions which prescribe x and y coordinate). | |

names for user-defined functions and constants | |

:= | function/constant definition symbol |

sqrt | square root |

ans | Answer, the result of the previous operation |

E | Exponent notation symbol (e.g. 2.5E3 = 2500) |

## Plotting functions of one variable: *plot*

To plot a graph of a function of one variable, use the *plot* command, available by pressing **4** twice
while in the functions key-menu. This command takes three parameters. The first parameter is the function you
wish to plot, such as `x*sin(1/x)`

. The second and third parameters are the minimum and maximum
value of *x* for which to plot the function. Note that the meaning of the parameters is indicated above
the input line.

For example, to produce the graph to the left, type `plot(x*sin(1/x),0,1/2)`

.

The general form of the *plot* command is

*plot*(*F*, *x _{min}*,

*x*),

_{max}
where *F* can either be an expression involving *x* (such as in the example above), the name
of a built-in one-parameter function (such as *sin*), or the name of a
user-defined one-parameter function (see below on how to define functions). Combinations such as
`sin+x`

are also allowed.

## Parametric plots: *par*

The *par* command is found in the
sub-menu of the functions key-menu. It produces plots where the x and y coordinates are determined by a pair
of one-parameter functions. The general form is

*par*(*F*, *G*, *t _{min}*,

*t*),

_{max}
where *F* and *G* are expressions involving *t*, names of built-in or user-defined one-parameter functions
(see below on how to define functions), or a combination such as `t^sqrt`

.
The plotted curve consists of all the points (*F*(*t*),*G*(*t*)), with *t* varying from
*t _{min}* to

*t*.

_{max}
For example, to produce the plot to the left, type `par(sin,sin(2t),0,2pi)`

.

Note: the parameter name *t* only exists in the context described here and replaces *x* in the variables key-menu when
entering one of the functions *F* or *G*.

## Plotting functions of two variables: *map*

The *map* command is available from the
sub-menu of the functions key-menu. It visualises functions of two variables by colouring each
display pixel with a grayscale value corresponding linearly to the function evaluated at its
coordinates. The general form is

*map*(*F*, *x _{min}*,

*x*,

_{max}*y*[,

_{min}*y*]),

_{max}
where *F* can be an expression involving *x* and *y*, the name of a built-in or
user-defined two-parameter function (see below on how to define functions), or a combination such as
`gcd/y`

.
The parameters *x _{min}*,

*x*,

_{max}*y*,

_{min}*y*define the region to be plotted. As the square brackets around

_{max}*y*indicate, it may be left out, in which case it is chosen such that the aspect ratio of the map is 1 (i.e., scales on the x and the y axis coincide).

_{max}
For example, to produce the map to the left, type `map(sin(x^2+y^2),-5,5,-5,5)`

.

Pixels corresponding to non-real values are coloured as follows: dark blue for negative infinity; bright yellow for positive infinity; red for NaN (not a number).

## User-defined variables and functions

To define a new variable or function, first choose its name from the *variables* menu, available by
pressing **5** in the functions key-menu.
There is a limited choice of one-letter names: *a*, *b*, *c*, *d*, *m*, *n*,
*f*, *g*, *h*.

Next enter the *definition symbol*, **:=**, available by pressing **6**
in the functions key-menu. If the variable to be defined has previously been undefined, the
definition symbol is inserted automatically.

Finally, enter the expression to be assigned.

In order to define a variable, this expression can be a number or an arithmetic expression that
evaluates to a number. For example, `a:=sqrt(pi/2)`

assigns the
value 1.2533... to the variable *a*.

In order to define a function, simply use one of the special *parameter names*
*x*, *y*, *z* in the function's expression.
*x* denotes the first parameter of the function, *y* the second,
*z* the third.
The presence of at least one parameter is what differentiates a function definition from a variable definition.
For example, `f:=sqrt(x^2+y^2)`

defines the function *f*(*x*,*y*).

The parameter names *x*, *y*, *z* are only available in the variables key-menu when defining
a new function (and partially when entering a function to be plotted, see above).

All definitions (variables and functions) are persistent, i.e. they are saved between invocations of Javia Calculator.

## Operations History

The most recent 32 expressions are saved in a *history*.
You can easily navigate the history using the up/down arrows.

## Parentheses

Use parentheses **( )** to control order of evaluation.
Parentheses occurring at the beginning or end of the expression may be omitted.

1+2*3+4 = 11 (1+2)*(3+4) = 21 1+2)*(3+4 = 21 1+2)(3+4 = 21The last line demonstrates that the multiplication symbol

*****may also be omitted.

## Edit Navigation

The left/right arrow keys are used to move the cursor inside the text of the expression. When the expression is long and spans multiple lines, the up/down arrow keys may be used to move the cursor vertically between lines.

The up/down arrow keys are also used to navigate within the history.

## Deleting

The right softkey is used to erase the token immediately to the left of the cursor, similar to the way the backspace key works on a computer. Other additional keys which are present on some mobiles (for example, a dedicated clear key) may have the same effect.

## The application menu

The left softkey displays the application menu, which is structured as follows.

General settings > Angle unit > | Radians Degrees |

The angle unit applies to the trigonometric functions sin, cos, tan, asin, acos, atan.

General settings > Rounding > | Smart rounding No rounding |

Determines whether result values are rounded to better match their underlying precision.

Plot settings > Axes > | Draw axes No axes |

Determines whether the *plot* and *par* commands should draw axes.

Plot settings > Labels > | Draw labels No labels |

Determines whether the *plot*, *par* and *map* commands should draw labels to indicate minimum and maximum x, y, and function values
(as applicable).

Plot settings > Aspect ratio > | Aspect ratio = 1 Stretch to fill screen |

Determines whether the *plot* and *par* commands should apply an equal scale to the x and y axes (aspect ratio = 1) or whether
scales should be chosen so that the whole screen is used (stretch to fill screen). Also determines whether the four or five parameter form of *map*
is inserted into the input line when the *map* command is selected from the functions key-menu.

Help |

Displays help on Javia Calculator.

About |

Displays program and version information.

Exit |

Exits Javia Calculator.