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.
InstallationThe 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.
UsageIt 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.
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
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:
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.
ExampleA 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.