Archive for the ‘Mobile Mathematics’ Category

October 9th, 2013

I got a Samsung Galaxy Note 3 yesterday and, since I’m so interested in compute performance, I ran various benchmarks on it.  Here are the results.

AnTuTu Benchmark Overall score was 35,637.  The screenshot below shows the comparison, given by the App, between my device and the Samsung Galaxy note 2 (my previous phone).

AnTuTu on Note3

Linpack Pro for Android – This was the app I used when I compared mobile phones to 1980s supercomputers back in 2010.  My phone at the time, a HTC Hero, managed just 2.3 Megaflops.  The Samsung Note 3, on the other hand, managed as much as 1074 Mflops. That’s quite an increase over the space of just 3 years!  I found that the results of this app are quite inconsistent with individual runs ranging from 666 to 1074 Mflops.

RgbenchMM – I’ve written about this benchmark, developed by Rahul Garg, before.  It gives more consistent results than Linkpack Pro and my Note 3 managed as much as 4471 Mflops!


  • The device was plugged in to the mains at the time of performing the benchmarks.  I rebooted the device after running each one.
  • There are at least two types of Note 3 in circulation that I know of – a quad core and an octo-core.  According to CPU-Z, mine has a Qualcomm Snapdragon 800 quad-core with a top speed of 2.27 Ghz.
  • Samsung have been accused of benchmark cheating by some.  See, for example, this post from The Register.
October 19th, 2012

MATLAB Mobile has been around for Apple devices for a while now but Android users have had to make do with third party alternatives such as MATLAB Commander and MLConnect.  All that has now changed with the release of MATLAB Mobile for Android.

MATLAB Mobile is NOT MATLAB running on your phone

While MATLAB Mobile is a very nice and interesting product, there is one thing you should get clear in your mind– this is not a full version of MATLAB on your phone or Tablet.  MATLAB Mobile is essentially a thin client that connects to an instance of MATLAB running on your desktop or The Mathworks Cloud.  In other words, it doesn’t work at all if you don’t have a network connection or a licensed copy of MATLAB.

What if you do want to run MATLAB code directly on your phone?

While it is unlikely that we’ll see a full version of MATLAB compiled for Android devices any time soon, Android toting MATLABers have a couple of other options available to them in addition to MATLAB Mobile.

  • Octave for Android Octave is a free, open source alternative to MATLAB that can run many .m file scripts and functions.  Corbin Champion has ported it to Android and although it is still a work in progress, it works very well.
  • Mathmatiz – Small and light, this free app understands a subset of the MATLAB language and can do basic plotting.
  • Addi – Much smaller and less capable than Octave for Android, this is Corbin Champion’s earlier attempt at bringing a free MATLAB clone to Android.  It is based on the Java library, JMathLib.
October 10th, 2012

There are many ways to benchmark an Android device but the one I have always been most interested in is the Linpack for android benchmark by GreeneComputing.  The Linpack benchmarks have been used for many years by supercomputer builders to compare computational muscle and they form the basis of the Top 500 list of supercomputers.

Linpack measures how quickly a machine can solve a dense n by n system of linear equations which is a common task in scientific and engineering applications.  The results of the benchmark are measured in flops which stands for floating point operations per second.  A typical desktop PC might acheive around 50 gigaflops (50 billion flops) whereas the most powerful PCs on Earth are measured in terms of petaflops (Quadrillions of flops) with the current champion weighing in at 16 petaflops, that’s 16,000,000,000,000,000 floating point operations per second–which is a lot!

Acording to the Android Linpack benchmark, my Samsung Galaxy S2 is capable of 85 megaflops which is pretty powerful compared to supercomputers of bygone eras but rather weedy by today’s standards.  It turns out, however, that the Linpack for Android app is under-reporting what your phone is really capable of.  As the authors say ‘This test is more a reflection of the state of the Android Dalvik Virtual Machine than of the floating point performance of the underlying processor.’  It’s a nice way of comparing the speed of two phones, or different firmwares on the same phone, but does not measure the true performance potential of your device.Put another way, it’s like measuring how hard you can punch while wearing huge, soft boxing gloves.

Rahul Garg, a PhD. student at McGill University, thought that it was high time to take the gloves off!

rgbench – a true high performance benchmark for android devices

Rahul has written a new benchmark app called RgbenchMM that aims to more accurately reflect the power of modern Android devices.  It performs a different calculation to Linpack in that it meaures the speed of matrix-matrix multiplication, another common operation in sicentific computing.

The benchmark was written using the NDK (Native Development Kit) which means that it runs directly on the device rather than on the Java Virtual Machine, thus avoiding Java overheads.  Furthermore, Rahul has used HPC tricks such as tiling and loop unrolling to squeeze out the very last drop of performance from your phone’s processor . The code tests about 50 different variations and the performance of the best version found for your device is then displayed.

When I ran the app on my Samsung Galaxy S2 I noted that it takes rather longer than Linpack for Android to execute – several minutes in fact – which is probably due to the large number of variations its trying out to see which is the best.  I received the following results

  • 1 thread: 389 Mflops
  • 2 threads: 960 Mflops
  • 4 threads: 867.0 Mflops

Since my phone has a dual core processor, I expected performance to be best for 2 threads and that’s exactly what I got. Almost a Gigaflop on a mobile phone is not bad going at all! For comparison, I get around 85 Mflops on Linpack for Android.  Give it a try and see how your device compares.

Android MM benchmark


May 13th, 2012

The MATLAB language has become ubiquitous in many fields of applied mathematics such as linear algebra, differential equations, control systems and signal processing among many others.  MATLAB is a great tool but it also costs a lot!  If you are not a student then MATLAB is a very expensive piece of software.  For example, my own academic licensed copy with just 4 toolboxes cost more than the rather high powered laptop I use it on.  If I left academia then there would be no chance of me owning a copy unless I found an employer willing to stump up the cash for a commercial license.  Commercial licenses cost a LOT more than academic licenses.

Octave – The free alternative

The good news is that there is a free alternative to MATLAB in the form of Octave.  Octave attempts to be source compatible with MATLAB which means that, in many cases, your MATLAB code will run as-is on Octave.  Many of the undergraduate courses taught at my university (The University of Manchester) could be taught using Octave with little or no modification and I imagine that this would be the case elsewhere.  One area where Octave falls down is in the provision of toolboxes but this is improving thanks to the Octave-Forge project.

Addi – The beginnings of MATLAB/Octave on Android

As Dylan said The Times They Are a-Changin’ and there is an ever-increasing segment of world-society that are simply skipping over the PC and going straight to mobile devices for their computing needs.  It is possible to get your hands on a functional Android mobile phone or tablet for significantly less than the cost of a PC.   These cheap mobile devices may be a lot less powerful than even the cheapest of PCs but they are powerful enough for many purposes and are perfectly capable of outgunning Cray supercomputers from the past.

There is, however, no MATLAB for Android devices.  The best we have right now is in the form of Addi, a free Android app that makes use of JMathLib to provide a very scaled-back MATLAB-like experience.  Addi is the work of Corbin Champion, an android developer from Portland in the US, and he has much bigger plans for the future.

Full Octave/GNUPlot on Android with no caveats

Corbin is working on a full Octave and GNUPlot* port for Android.  He has already included a proof of concept in the latest release of Addi which includes an experimental Octave interpreter.  To go from this proof of concept to a fully developed Android port, however, is going to take a lot of work.  Corbin is up to the task but he would like our help.

[* – GNUPLot is used as the plotting engine for Octave and includes support for advanced 3D graphics]

Donate as little as $1 to help make this project possible

Corbin has launched a Kickstarter project in order to try to obtain funding for this project.  He freely admits that he’ll do the work whether or not it gets funded but will be able to devote much more of his time to the project if the funding request is successful.  After all, we all need to eat, even great sotware developers.

Although I have never met him, I believe in Corbin and strongly believe that he will deliver on his promise.  So much so that I have pledged $100 to the project out of my own pocket.

If, like me, you want to see a well-developed and supported version of Octave on Android then watch the video below and then head over to Corbin’s kickstarter page to get the full details of his proposal.  The minimum donation is only $1 and your money will only be taken if the full funding requirement is met.

Update (16th May 2012): The project (and this post) made it to Slashdot :)

March 26th, 2012

These days almost all of us are carrying around seriously capable little computers in the form of our mobile phones.  Although these devices have a similar amount of horsepower to supercomputers of old, most of us only use a fraction of their potential– after all, you don’t need a supercompter to send text messages, look at pictures of cats or throw birds at pigs.  I believe that the only way to fully unlock the true potential of these devices is to program them yourself.

From fully fledged applications to little snippets of code, I think that there’s something enormously satisfying about writing your own computer programs and it doesn’t have to be difficult to do so.  The following 9 apps will allow you to write programs for your Android mobile phone in a variety of languages including C, BASIC, Lisp and MATLAB m-code using only your Android phone. Although you’ll not be able to use them to write the next 3D blockbuster game, you will be able to solve some interesting problems, learn a trick or two and have a lot of fun.

C4droid – £0.95

With c4droid you get the ability to write, compile and run C and C++ programs using only your Android device.  That’s a lot of functionality for only 95p!

Out of the box C4droid only handles C programs, making use of a modified version of the Tiny C Compiler to do the compilation work.  The standard C library is provided by uClibc which is specially designed for use on embedded systems.

In order to run C++ programs you need to additionally install the free GCC plugin for C4droid — something that I personally haven’t done yet due to its large size.  One of the most common user-complaints appears to be ‘this app doens’t allow me to use iostream.h’ which essentially demonstrates that the installation instructions were not followed.  Since iostream.h is a C++ library, you’ll need to install and configure the GCC plugin to get access to it and full instructions on how to do this are given on c4droid’s Google Play page.

You only get access to the standard C library with C4droid which means that you can’t generate graphical output or interact with the phone’s hardware in any way (bluetooth, accelerometers, that sort of thing) but that doesn’t stop this from being an impressive piece of work.  Also, for an extra 95p you can run pascal programs using the Pascal plugin for C4droid.

C4droid is a superb app that will be invaluable for anyone learning C,C++ or Pascal or for those of us that simply like to fiddle about with these languages on the go.

Mintoris Basic – £3.77

At the risk of showing my age, I’ll tell you that I first learned how to program in BASIC (Beginners All-Purpose Symbolic Instruction Code) on the Sinclair ZX Spectrum and so I will always have a fondness for the language.  Mintoris Basic is a very fully featured implementation of the BASIC programming language and is significantly more powerful than the implementation I cut my teeth on back in the day.

As well as having all of the stuff you’d expect in a BASIC implementation (loops, strings, variables, functions, decisions, graphics etc), Mintoris also allows you to interact with some of your phone’s hardware including Bluetooth, battery level, GPS, and various sensors.  Furthermore, you can attach your programs to shortcuts and launch them from your home screens.  The level of functionality is so high that you can write some rather nifty apps with relatively little effort.

Frink – Free

Frink is a great language developed by Alan Eliasen that has been around since 2001.  Named after Professor Frink from The Simpsons, Frink runs on almost every device you can possibly imagine and has some very interesting features including interval arithmetic, tracking of units of measure throughout calculations, arbitrary precision numbers, regular expressions and graphics.


This implementation of BASIC is completely free and is described as a labour of love by the author, Paul Laughton.  Paul is my kind of geek since he is the curator of The Dr. Richard Feynman Observatory and author of Atari Basic and Apple DOS 3.1 among other things.

The feature list of RFO BASIC is impressive and includes Graphics (with Multi-touch), SQL, GPS, Device Sensors, Camera and loads more.  There’s a great forum with lots of very engaged developers who are writing some very nice programs.

There are two ways to deploy your programs–either as scripts that require RFO BASIC to be installed or as compiled,standalone programs that can even be added to Google Play (formerly known as the Android Market’).

Addi and Mathmatiz – Free

These are two MATLAB clones for Android.  I’ve mentioned Addi before and they have both been covered over at Alasdair’s Musings so I won’t go into detail here other than to say that they are very cool!  Linear algebra, scripting and plotting on your phone!

tiny Lisp ISLisproid

Lisp is a very old programming language which first saw the light of day in 1958!  According to wikipedia, the only langauge older than Lisp that is still in common use is Fortran! With this app you can play with the language of the ancients on your super-modern smartphone.  This is a no-frills app..essentially little more than a command line shell and list interpreter but that is perhaps as it should be.

MathStudio – £12.99

I’ve been using MathStudio (formerly SpaceTime Mathematics) for quite a few years now on various operating systems and it’s great to finally have it on Android.  MathStudio is a fully featured computer algebra system for your mobile phone– think mini Mathematica or Maple and you are thinking along the right lines.  With this app you can write scripts that make use of advanced mathematical features,  2D and 3D graphics, animations and interactive demonstrations.

SigmaScript – Free

SigmaScript is a free implementatuion of the Lua scripting language for Android devices developed by Logimath.  You get an editor, scripting engine, small console output and a few simple code examples.  No graphics or anything fancy but a very nice way to play with an interesting language.

February 17th, 2012

The Wolfram blog has just published an article previewing the .cdf player on iPad.  I’ve discussed .cdf technology several times before (see Interactive Slinky Thing and Interactive Mathematics in the Web Browser for example) and it forms the basis of the superb Wolfram Demonstrations Project.

In a nutshell, it is trivially easy to write interactive mathematical applets using Mathematica and publish them to .cdf format.  The magic happens via the Manipulate command which has been around since version 6.  For example, here is the full source code for a simple interactive applet that calculates and displays the power series for sin(x)

 Series[Sin[x], {x, 0, n}]
 , {n, 1, 10, 1, Appearance -> "Labeled"}

Here is the result

Series demo

If you have Mathematica 8 or the free .cdf player installed with browser plug-in enabled then you’ll see a fully interactive applet above. Otherwise, you just get a simple image.

Bear in mind that this isn’t showing you a set of pre-computed solutions, it’s actually performing the calculations in real time using the full Mathematica kernel.  With this new player you’ll be able to do that on iPad as well as on your PC. That’s right…Wolfram have taken the full Mathematica kernel and got it running on iPad! It’s not shipping yet but it looks like it’s going to be awesome.

Just imagine…all 7000+ Wolfram Demonstrations on iPad, not to mention your own bespoke code.

There is a preview of the new technology in the video below.

Other articles on mobile mathematics from WalkingRandomly

October 26th, 2011

Typical…I leave my iPad at home and this happens

Maple on iPad

I can’t WAIT to try this out.  Blog post from Maplesoft about it at

May I be the first to ask “When is an Android version coming out?”

October 25th, 2011

Back in May 2010, The Mathworks released MATLAB Mobile which allows you to connect to a remote MATLAB session via an iPhone.  I took a quick look and was less than impressed since what I REALLY wanted was the ability to run MATLAB code natively on my phone.  Many other people, however, liked what The Mathworks had done but what THEY really wanted was an Android version.  There is so much demand for an Android version of MATLAB Mobile that there is even a Facebook page campaigning for it.  Will there ever be anything MATLABy that fully satisfies Android toting geeks such as me?

Enter Addi, an Android based MATLAB/Octave clone that has the potential to please a lot of people, including me.  Based on the Java MATLAB library, JMathLib, Addi already has a lot going for it including the ability to execute .m file scripts and functions natively on your device, basic plotting (via an add-on package called AddiPlot) and the rudimentary beginnings of a toolbox system (See AddiMappingPackage).  All of this is completely free and brought to us by just one man, Corbin Champion.

Addi - MATLAB Clone for Android

It works pretty well on my Samsung Galaxy S apart from the occasional glitch where I can’t see what I’m typing for short periods of time.  Writing MATLAB code using the standard Android keyboard is also a bit of a pain but I believe that a custom on-screen keyboard is in the works which will hopefully improve things.  As you might expect, there is only a limited subset of MATLAB commands available (essentially everything listed at sans the plotting functions) but there is enough to be fun and useful…just don’t expect to be able to run advanced, toolbox heavy codes straight out of the box.

Where Addi really shines, however, is on an ASUS EEE Transformer.  Sadly, I don’t have one but a friend of mine let me install Addi on his and after five minutes of playing around I was in love (It even includes command history!).  Some have pointed out to me that life would probably be easier with a netbook running Linux and Octave but where’s the fun in that :)  To be honest, I actually find it much more fun using a limited version of MATLAB because it makes me do so much more myself rather than providing a function for every conceivable calculation…great for learning and fiddling around.

Addi is a fantastic free MATLAB clone for Android based devices that I would heartily recommend to all MATLAB fans.  Get it, try it and let me know what you think :)

May 11th, 2011

This is the third in an ongoing series of articles where I take a look at some of the mathematical applications available for iPad. Click here for part 1 and here for part 2.  If you are the author of a mathematical iPad app that you’d like me to review then feel free to contact me.  Also, if you use any mathematical iPad app regularly and think that its awesome then contact me and let me know why.

Wolfram Alpha and the Wolfram Course Assistants

At the time of writing, Wolfram Research have several iPad apps available including the following:

All of these apps are interfaces to Wolfram Alpha, the fantastic computational engine that I fell in love with upon its release.  Sadly, the apps themselves do not live up to the quality that I have come to expect from Wolfram Research and, as one iTunes reviewer put it, they are very thin-soup.  In my opinion, the only one worth buying is the Wolfram Alpha app and even that is questionable since you could just access Wolfram Alpha directly (and for free) from your iPad web-browser.  I’ll admit that the keyboard provided by the app is occasionally useful though.

The course assistants offer no additional content compared to the Wolfram Alpha app (or the website); they simply offer a menu driven way to generate search queries that are then sent to Wolfram Alpha.  I would spend my money elsewhere if I were you.

slcalc – ‘Kazuo Nakazato’

In my original Math on the iPad article I focused on all singing, all dancing computer algebra apps but sometimes all you need is a good, old fashioned calculator.  There are hundreds available on the appstore and slcalc is my current favourite.  slcalc has got a long history for a mobile app since its first outing was on the Linux-based Sharp Zaurus back in 2003.  The current iPad version is great and includes a long calculation history, the ability to use variables, arbitrary precision calculation (up to 256 digits), big buttons and a reasonable set of functions.  You can even program it (and here are some example programs).  All this for $1.99 (there is a more limited free version also). I guess my only minus point would be that the colour scheme is a…odd!  Oh, and it can’t do complex arithmetic either but they are only minor things that detract from an otherwise great app.

Here are the iTunes links


Handwriting Calculator – ‘Old Men’

The idea is brilliantly simple, you write the calculation that you want to perform directly onto your iPad’s screen and the iPad finds the result.  No need to learn programming syntax or which button to press next, just write and calculate.  Sadly, the reality isn’t quite so brilliant.

There are a limited number of functions (Basic arithmetic, square root, factorial and power) and the handwriting recognition is a bit flaky although I have to admit that my handwriting is probably more of a challenge than most.  I also find myself wishing that I could use a stylus to write with since using my finger just doesn’t feel as precise.  Furthermore, it turns out that I can punch numbers into a traditional calculator (such as slcalc above) MUCH faster than I can write them down.

In summary, its a nice idea and fun to play with for a couple of minutes but it just isn’t very useful and not worth the $1.99 asking price. iTunes link:

Handwriting Calculator

December 28th, 2010

This is the second post in a series. The third post is at

DataAnalysis – free curve fitting on iPad

DataAnalysis is a fantastic curve fitting and plotting package written by Evan Kantrowitz.  You can import your data (in .csv format) from a variety of sources including email, iTunes and Dropbox.  Once imported, DataAnalysis allows you to modify your data if necessary and then plot it in a variety of styles before fitting it to one of several different regression models.

There is a nice range of built in model types including polynomial (currently only up to order 3), power, exponential, gaussian and more with the full list detailed over at the DataAnalysis website.  New model-types are being added all the time and the developer is willing to consider specific requests. Fitting is performed in the least-squares sense and the user can choose which numerical algorithm to use – Newton or Levenberg-Marquardt.  My only gripe here is that it is not possible to define your own fit function so if the model you want to fit your data to has not been included then you are stuck.

Once you have completed plotting and fitting your data, you can export the whole thing in either .png or .pdf format via email, Dropbox or to the iPad Photos app.  Alternatively, you can copy the graph to the iPad clipboard for inclusion in other apps.

This is a fantastic app that delivers exactly what it promises at a price that’s impossible to beat.
DataAnalysis on iPad