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.
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.
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 :)
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.
- C4droid on Google Play
- GCC plugin for c4droid (needed for C++ access)
- Pascal plugin for C4droid – provides the ability to compile and run Pascal programs
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.
- Get Mintoris Basic from Google Play
- Mintoris Basic official website
- Mintoris Basic Forum
- Mintoris Basic on Facebook
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.
- Get Frink from Google Play
- What’s new – Frink is under very active development. See here for the new stuff
- Many example programs in Frink
- Extensive documentation for Frink
RFO BASIC! + SQL – Free
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’).
- RFO BASIC on Google Play
- RFO BASIC Forum
- RFO BASIC website
- De Re BASIC! – The .pdf manual for RFO BASIC
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.
- MathStudio at GooglePlay
- MathStudio official website
- A set of MathStudio examples and demonstrations
- MathStudio Forum
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.
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.
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 http://www.jmathlib.de/docs/handbook/index.php 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 :)
I bought a Samsung Galaxy S recently as a replacement for my dying HTC Hero and am mostly very pleased with it. However, the built in email client is so slow that it’s embarrassing! The Google Mail app is fine but the one that’s simply called Email does not work well for me at all which is a shame because that’s the app that I use to access my work email.
The ‘fix’ that I ended up doing isn’t really a fix at all because all I did was install the free K-9 mail client and use that instead. It’s so much faster that it borders on the insane. Just search for K9 mail in the Android Marketplace.
Christmas isn’t all that far away so I thought that it was high time that I wrote my Christmas list for mathematical software developers and vendors. All I want for christmas is….
- A built in ternary plot function would be nice
- Ship workbench with the main product please
- An iPad version of Mathematica Player
- Merge the parallel computing toolbox with core MATLAB. Everyone uses multicore these days but only a few can feel the full benefit in MATLAB. The rest are essentially second class MATLAB citizens muddling by with a single core (most of the time)
- Make the mex interface thread safe so I can more easily write parallel mex files
- More CUDA accelerated functions please. I was initially excited by your CUDA package but then discovered that it only accelerated one function (Matrix Multiply). CUDA accelerated Random Number Generators would be nice along with fast Fourier transforms and a bit more linear algebra.
- Release Mathcad Prime.
- Mac and Linux versions of Mathcad. Maple,Mathematica and MATLAB have versions for all 3 platforms so why don’t you?
- Produce vector versions of functions like g01bk (poisson distribution function). They might not be needed in Fortran or C code but your MATLAB toolbox desperately needs them
- A Mac version of the MATLAB toolbox. I’ve got users practically begging for it :)
- A NAG version of the MATLAB gamfit command
- A just in time compiler. Yeah, I know, I don’t ask for much huh ;)
- A faster pdist function (statistics toolbox from Octave Forge). I discovered that the current one is rather slow recently
- A Locator control for the interact function. I still have a bounty outstanding for the person who implements this.
- A fully featured, native windows version. I know about the VM solution and it isn’t suitable for what I want to do (which is to deploy it on around 5000 University windows machines to introduce students to one of the best open source maths packages)
- An Android version please. Don’t make it free – you deserve some money for this awesome Mathcad alternative.
- The fact that you give the Windows version away for free is awesome but registration is a pain when you are dealing with mass deployment. I’d love to deploy this to my University’s Windows desktop image but the per-machine registration requirement makes it difficult. Most large developers who require registration usually come up with an alternative mechanism for enterprise-wide deployment. You ask schools with more than 5 machines to link back to you. I want tot put it on a few thousand machines and I would happily link back to you from several locations if you’ll help me with some sort of volume license. I’ll also give internal (and external if anyone is interested) seminars at Manchester on why I think Spacetime is useful for teaching mathematics. Finally, I’d encourage other UK University applications specialists to evaluate the software too.
- An Android version please.
How about you? What would you ask for Christmas from your favourite mathematical software developers?
Ever wondered how fast the fastest computer on Earth is? Well wonder no more because the latest edition of the Top 500 supercomputers was published earlier this week. Thanks to this list we can see that the fastest (publicly announced) computer in the world is currently an American system called Jaguar. Jaguar currently consists of 37,376 six-core AMD Istanbul processors and has a speed of 1.75 petaflops as measured by the Linpack benchmarks. According to the BBC, a computation that takes Jaguar a day would keep a standard desktop PC busy for 100 years. Whichever way you look at it, Jaguar is a seriously quick piece of kit.
All this got me thinking….how fast is my mobile phone compared to these computational behemoths?
The key to answering this question lies with the Linpack benchmarks developed by Jack Dongarra back in 1979. Wikipedia explains:
‘they [The Linpack benchmarks] measure how fast a computer solves a dense N by N system of linear equations Ax = b, which is a common task in engineering. The solution is obtained by Gaussian elimination with partial pivoting, with 2/3·N3 + 2·N2 floating point operations. The result is reported in millions of floating point operations per second (MFLOP/s).’
People have been using the Linpack benchmarks to measure the speed of computers for decades and so we can use the historical results to see just how far computers have come over the last thirty years or so. Back in 1979, for example, the fastest computer on the block according to the N=100 Linpack benchmark was the Cray 1 supercomputer which had a measured speed of 3.4 Mflop/s per processor.
I installed the benchmark onto my trusty T-Mobile G2 (a rebadged HTC Hero, currently running Android 1.5) and on firing it up discovered that it tops out at around 2.3 Mflop/s which makes it around 66% as fast as a single processor on a 1979 Cray 1 supercomputer. OK, so maybe that’s not particularly impressive but the very latest crop of Android phones are a different matter entirely.
According to the current Top 10 Android Linpack results, a tweaked Motorola Droid is capable of scoring 52 Mflop/s which is over 15 times faster than the 1979 Cray 1 CPU. Put another way, if you transported that mobile phone back to 1987 then it would be on par with the processors in one of the fastest computers in the world of the time, the ETA 10-E, and they had to be cooled by liquid nitrogen.
Like all benchmarks, however, you need to take this one with a pinch of salt. As explained on the Java Linpack page ‘This [the Java version of the] test is more a reflection of the state of the Java systems than of the floating point performance of the underlying processors.’ In other words, the underlying processors of our mobile phones are probably faster than these Java based tests imply.
I’m usually a big fan of Wolfram Research and their products but on reading the news that they had released a $50 iPhone app that hooked in to the Wolfram Alpha website I wondered if they had taken leave of their senses. Let’s see why…
Wolfram Alpha is a web service that is based on the extremely powerful computer algebra system, Mathematica, and it is very VERY cool. I won’t go into detail about what it can do here since many,many people have done that before (including me) but for the uninitiated think of it as a super-powerful graphical calculator that (partially) understands plain English and also has access to massive datasets from areas as diverse as the stock market, chemistry, popular music, language and physics.
Many students I know focus on the fact that it can eat their math homework for breakfast – not only giving the answer but also giving all of the steps that you’d need to get full marks on your coursework. Mathematics educators in the know are scrambling to come up with ways to harness this new freely available computational power while those not in the know are wondering why their students all get straight As in their coursework and yet flunk their exams.
All in all it’s very good stuff and you may be forgiven for thinking that it’s worth $50 for an app that can do all that. I would agree with you except for one, tiny little detail.
You can get all of this stuff for free! From Wolfram themselves!
Don’t believe me? OK, let’s prove it. Mashable have just reviewed the shiny new Wolfram iPhone app and have given it a big thumbs up because the reviewer has focused on all of the awesome features that Wolfram Alpha has. Choose any one of those nice examples shown in the mashable review – any one you like. Now, fire up your favourite web browser, head over to the Wolfram Alpha website and type in the exact same query.
Tell you what. I’ll do it for you. One of the examples given for the $50 app solves a simple differential equation – click on this link (from your iPhone if it suits you) to see exactly the same results for free.
I did exactly this on my Android phone and have included a screenshot for your delight and delectation (well, technically speaking I did it on the Android emulator since getting screenshots from an actual Android phone is tricky). The Wolfram Alpha query below cost me nothing:
I would have had to pay $50 to get this next one using the new iPhone app.
So, let’s be very clear here, Wolfram aren’t selling you an app that puts the power of Wolfram Alpha in your iPhone – they are just selling you a browser alternative that can only hit one website! For $50.
Of course they don’t JUST give you a browser alternative – according to the comments section over at mashable, the new alternative to the ‘I am Rich‘ app also gives you a more math-friendly onscreen keyboard and a query-history as well as formatting the results a little nicer than the built in browser.
Maybe that’s worth $50 to you but if so then you have a lot more money than me.
Update 2nd June 2010: As pointed out in the comments, Wolfram have since reduced the price of the Wolfram Alpha app significantly. At the time of writing it cost just £1.19 for iPhone and iPad versions of the software – now that’s more like it!
The Android Market is not the only place where you can get applications for your Android phone. As long as you are prepared to accept the increased risks then you can install applications from anywhere. Android applications have the extension .apk and to allow their installation all I had to do on my HTC Hero was
- From the home screen press the Menu button and then tap on Settings.
- Tap on Applications.
- Tap on Unknown sources (allow install of non-Market applications) and follow the prompts.
This information is widely available on the web and there are several other ways of doing it. The only reason I am posting it here is as a reminder to self but it’ll be a bonus if it’s useful to anyone else.