Science on Android

on October 9, 2015

I have covered a lot of different scientific packages that areavailable under Linux in this space, but the focus has been on Linux running on desktopmachines. This has been rather short-sighted, however, as lots ofother platforms have Linux available and shouldn't be neglected.So in this article, I start looking at the type of science you can doon the Android platform. For my next several articles, I plan to include occasional Android applications that you may find useful.

The first application I want to exploreisMaxima for Android. Maxima has been under development since the 1960s at MIT,and it continues to this day under an open-source license. It is a fullcomputer algebra system, written in Common Lisp. Luckily, EmbeddableCommon Lisp has been ported to Android, so this provides the Lisp engineneeded to run the Maxima engine.

Installing Maxima on yourAndroid device is a two-step process. The first step is to install thebase application from the Google Play store. Once it is installed andyou run it for the first time, the application will unpack the bulk ofthe application. Because this section is so large, the app will ask youwhere to unpack it, so you can put it on some other media ifyou don't have a lot of room in internal storage.

When you initially start Maxima, you get a display of the licensinginformation and the version number, and then you are presented with an inputprompt labeled as "(%i1)". Depending on the device youare using and the age of your eyes, you may have a hard time seeing theoutput displayed on the screen. If so, you can zoom in and out witha two-finger pinch or zoom, just like in other Android applications. Yourother option is actually to change the font size. You can usethe commandtextSize:XX, where XX is the size you want to use for thefont in pixels. The suggested range is 10–50 pixels.

Figure 1. When you start Maxima, you get the standard license and version information.

Atthe bottom of the screen, you will find a text entry box outlinedin orange. This is where you enter the Maxima commands you want torun. Once you have entered your command and press Enter, it is displayedin the main window, along with the results. The MathJax library handles the pretty-print display ofthis mathematical information.The history mechanism used in order to re-use previous commands is veryintuitive. When you tap a previous command, it is copied and pastedinto the text input command box, ready for you to make any necessaryedits before executing it again.

The Android version of Maxima includes a full set of documentation thatis available by tapping on the menu icon and selecting the "Manual"option. A lot of examples are available in each section of themanual that you may want to try. Assuming that this would be a commonthing people would want to do, you simply can tap the example you wantto work with, which will copy the example into the command text inputbox. This way you can find an example that is close to what you want totry to do and easily copy it into the command box. You then can edit itand make any required changes before running it. This really can speedup any research work you are trying to do with Maxima.

There is also afunction namedexample(). If you callexample without anyparameters, it will generate a list of all of the subjects that haveexamples provided. You then can look at the examples for a specificsubject by callingexample with the named subject.For instance, you canlearn about arrays with the commandexample(arrays). This will pullup and run a series of examples on how to use arrays within Maxima.

Theother useful function for speeding up research is the ability to loadfiles of Maxima commands. Maxima for Android automatically looks inthe main Download directory when you try to load files. Also, fileswith the ".txt" filename ending are found and loaded without having toinclude the file ending. This means if you have a filenamed "my_script.txt" in the Download directory, you can load it withthe commandload(my_script). If you use Dropbox and synchronize theDownload directory, you easily can move files back and forth betweenyour Android device and your desktop.

One major area that is not completely implemented yet is the graphicalsystem for plots and graphs. However, new features are being addedwith each new version. The graphical functions actually are provided bygnuplot. The functions currently implemented areplot2d,plot3d,implicit_plot,contour_plot,draw,draw2d anddraw3d. These commandspop open a new window to display the results of theplotcommand.

Becauseeverything is full screen on Android, you need to tap on the backicon to get back to the main Maxima window. If you want to see theplot again, you can tap on the menu and select the "Graph" option. Thiswill re-open the last plotting window.

Another major issue is the lapacklibrary. Trying to load it will cause an error, so you won't have accessto the optimized linear algebra functions provided through lapack.

When you are doing complicated research, you may need to stop part waythrough the process and pick it up again at a later time. This is handledby the concept of a session. Tapping the menu icon, you can select the"Session" option. This will pop open a sub-menu where you can chooseeither to "Save", "Restore" or "Playback" your session. You havejust one saved session state at a time, however, so it is really usefulonly when you need to stop in the middle of a workflow.

If you are workingon a larger project where you are using the same libraries foran extended period of time, you can set initialization code that getsrun whenever Maxima starts. This code needs to be stored in the file/data/local/tmp/maxima-init.mac. Any arbitrary Maxima code can be placedhere, so you can initialize a pretty complicated environment if you like.

Now you can carry Maxima around in your pocket, ready to work out allof those troublesome problems that come up in everyday life. So, you won'thave any excuse for not solving the equations you need in order toplot out your space travel, all on the train ride to work. Just promiseto be good, and don't try to use it on your next physics exam.

Load Disqus comments