Jasymca 3 for Android-OS

Prof. Dr. H. Dersch - HFU Furtwangen


Jasymca is a programmable Java-based calculator. The user interface can be selected from either a Matlab/Octave/SciLab-style, or a GNU-Maxima-style. The Matlab-mode also supports many functions of the symbolic toolbox and exact rationals. It runs on many Java SE- and ME-platform: Windows, MacOS, Linux, Cellphone, PDA,... This note covers some features of the Android-app which is available as part of Jasymca 3.0. The main documentation and distribution for Jasymca is still based on version 2 : other than the mentioned Android-app only the applet for standard Java 1.4-platforms can be downloaded at this time.

Installation

The application file Android-app should be downloaded directly to the smartphone running Android-OS. To be installed it must be granted permission to read and write the SD-card (for accessing scriptfiles and graphic files) and permission to monitor phone state (to go out of the way of incoming phone calls). Jasymca has been tested on Android-OS 2.1 and 2.2.

Usage

It is assumed that the user is acquainted with either Matlab or Maxima. Starting the application displays the main command window which is basically a terminal input.

It is recommended to select the Qwertz/y keyboard which is easier to use than the 3x4 block for command input. Commands are entered into the textfield labeled Command. Upon hitting the Enter key of the keyboard the command is processed and the result displayed in the Output-window. The two arrowkeys next to the Command-textfield can be used to scroll through the command history.

To get started, enter some plain-text mathexpression like 3+2*7.3^5 and hit Enter. For a short demo type demoen (or for a german demo: demode). Detailed documentation and a tutorial can be found here.

Working in horizontal layout is also feasible, see the image below. The keyboard is larger and easier to use. However, textinput and output are on different screens and can not be viewed together.

The main command screen exhibits an option menu with the following commands

File Open Script Open and read scriptfile
Save Environment Save all numeric variables in textformat
Add Path Add folder to searchpath
Quit
Run Interrupt Restart
Octave Mode Restart in Octave mode
Maxima Mode Restart in Maxima mode
View Clear Command Window Delete text in output window
Clear Command History Delete saved commands
Clear Environment Delete all variables
TextEditor Launch texteditor
Graphic Display graphics screen
Command Window Options

Many options and settings like the mode (Octave or Maxima), the environment (numerical variables) and the command history, as well as graphs and text in the editor are automatically saved to preferences so that a paused session can be resumed later.

Jasymca can read and process plain-textfiles from the SD-card of the device. A builtin texteditor can be used to create and manipulate them. It is available from the options menu View->TextEditor. Commands can be directly run from this editor without saving the text making development of scripts quite simple. A script named Jasymca.Octave.rc (or Jasymca.Maxima.rc) is automatically read from the SD-card and processed at startup if it exists. This can be used to customize the application. Here is the option menu of the texteditor:

File New Create new textfile
Open Open existing textfile
Save Save textfile
Save As Set filename and save textfile
Run Run text as script, don't save
File Manager New Folder Create new directory
Remove Delete file or directory
Texteditor Options

Jasymca's graphical view is accessed from the main command window through the menu option View->Graphic. As an example the image below displays the output of a 3-parameter least-square-fit performed on the device. It is described in detail in the tutorial of the next chapter. Graphics can be manipulated through commands in the command window, or through menu options in the graphics window. Graphics can be saved as series of standard Matlab-style commands in textfiles, and later reread or processed and plotted on a standard Matlab-(or Octave/SciLab,...) workstation.

Coordinates of points and line parameters can be displayed interactively by touching the graphics screen, as seen in this image. The following options are available in the menu of the graphics window.

Save Plot Save graphic in textformat
Edit Set title Set title of graph
Set xlabel Label of horizontal axis
Set ylabel Label of vertical axis
Hold Hold graphic for next plot commands
Clear
View Point Display point coordinates
Line Display line parameters
Point/Line Both
Graphics Window Options

Example

A set of data points x,y is supposed to obey the equation y = A*exp(-((x-x0)/sigma)^2). Find the best parameters A,x0,sigma and display the results (Matlab/Octave-Mode).

Our (fake)-data are created as randomized data:

x = 0:0.5:10;
for i=1:length(x),y(i)=1.5*exp(-(x(i)-4)^2/2)+rand(1)/5-0.1; end;
e = 0.1 * ones( 1, length(x) );	 % errors

Solution:

We program the function y(x), which contains the three parameters to be fitted
function y=fit(a,x)	y=a(1)*exp(-(x-a(2)).^2/a(3)^2); end;
The three parameters A,x0,sigma form the vector a. Then we use the builtin function lsqcurvefit to find the optimum parameters:
a = lsqcurvefit(@fit,[1,5,2],x,y)                                  

Jasymca Output:		a = [ 1.4912  3.9911  1.4481 ]
This may take some time (~100s on my Samsung Galaxy 5). Notice that we had to supply an estimate for a, in this example [1,5,2]. The function lsqcurvefit fails if this is too far off.

Plot the errorbars in blue

errorbar(x,y,e,'+');
hold   

Jasymca Output:		Current plot held.
Now plot the fitted curve in green
xi=0:0.1:10;
yi=fit(a,xi);
plot(xi,yi,'g');
Plot the data points as red stars.
plot(x,y,'r*');
Display the graph using Menu:View->Graphic and obtain the image shown above.


Copyright 2011  Helmut Dersch
der@fh-furtwangen.de