Archive for January, 2009
I love mathematical software – which makes me a lucky guy because I tend to deal with it a lot as part of my job as a science and engineering software specialist at the University of Manchester in the UK. Thanks to this role, I often get asked if I can recommend software for various tasks and my answer depends on many factors such as
- Does our university have a site license for it (or is it free)
- What packages do people in your research / teaching area tend to use? Sometimes I know this off the top of my head, other times I know people who know people who know ;)
- What is your computing background?
- Are you likely to need more support from me? If so then I am more likely to recommend that you use a package that I know a lot about.
- What is the support from the vendor like? Researchers tend to want to do odd things and a software vendor who is willing to work with them tends to bubble to the top of my list. There are some who have written routines just for us at no extra charge – I LIKE these kind of vendors.
- If I don’t know enough about a package to offer direct support to you then do I know someone who is willing and able to (bear this in mind if I ever offer to buy you a coffee, I may call in a favour at some point)?
- What software are you currently working with? Will you want something that can integrate with it or do you want to start afresh?
There are many others of course such as my mood, whether or not I have a clue what you are talking about and what software I have been playing around with recently but that pretty much covers it. One application that I have started to recommend to people recently is called Simfit.
What is Simifit?
Simifit is a free piece of software written by Bill Bardsley of the University of Manchester. According to the application’s website “Simfit is a computer package for simulation, statistical analysis, curve fitting and graph plotting.” It is written for Windows but can also be run under Linux via WINE (instructions specific to OpenSuse and KDE are given at this website.)
Simfit actually consists of a suite of over forty individual programs but all of these are held together by one central ‘program manager’. Essentially you spend your Simfit life in the program manager and it will run the sub-programs as and when they are needed. It’s all very straightforward although, in my opinion, the graphical user interface isn’t as intuitive as most applications I have used. I guess I should qualify this somewhat – by ‘not as intuitive’ I mean ‘doesn’t quite behave like all other Windows applications’ and after speaking to Bill it seems that the reason for this is that he wanted to avoid anything that would make Simfit less stable or more memory hungry. His interface works well and all of his users are happy with it so why change? Furthermore, it hardly uses any memory at all and so Simfit will quite happily accept massive data sets that can bring other packages to their knees. It may be quirky but once you get used to it you’ll be fine.
Academic versus Professional versions
Simfit comes in two flavours and both of them are free in the sense that Bill will charge you nothing for them. However one of them (The professional version) has the NAG library as a pre-requisite and NAG costs money. If you (or your institution) has a license for the NAG Library then you are good to go and can happily use the professional version of Simfit at no extra charge. If, however, you don’t have a license for the NAG Library then you need to use the Academic version which is also free but has less functionality. Details of the differences in functionality between the two versions can be found on the Simfit website.
When you download Simfit you get both versions at the same time and the package comes with an utility that allows you to easily swap between the Academic and NAG library editions.
At this point, it might be worth mentioning that if you desperately need some functionality that is only available in the professional version then you can obtain a trial version of the NAG library from NAG themselves.
Installation
Simfit works perfectly on just about any version of Windows you care to mention – Windows 95, 98, XP and Vista to name a few. I haven’t had chance to try it out on the new Windows 7 beta yet but I know one thing for sure – if it doesn’t work initially then I’ll bet my last dollarpound that Bill will get it working very quickly. He has put a lot of effort into ensuring that Simfit is portable across Windows versions and it shows.
In order to use all of Simfit’s features you will need to install a few pre-requisites first but happily all of them are free and Bill has made most of them conveniently available from his website. I installed things in the following order.
For .eps file support you need the following
- Ghostscript package – available from the Simfit website (among other places)
- GSview Windows – available from the Simfit website (among other places)
For pdf viewing support you need
- Adobe Reader – available from Adobe.
If you want to use Simfit in full ‘professional’ mode then you will need to install the commercial NAG libraries. If you don’t have a license the NAG library then don’t worry about it – Simfit will still work but with a few less bells and whistles.
- NAG LIbrary (FLDLL214ML or FLDLL214AL should do the job) – available from the Numerical Algorithms Group.
Finally, you install Simfit itself using simfit_setup.exe. The installer is so quick and easy that I won’t insult your intelligence by going through it blow by blow. If you forget to install any of the pre-requisites then don’t worry – you can still install Simfit and simply add the other packages if and when you need them.
Plotting Graphs in Simfit
Let’s start out with one of the (mathematically) simplest things that Simfit can do – plotting. They say that a picture can speak a thousand words so here are four plots produced with Simfit (taken from the author’s website)
Simfit’s graphical output is in the widely used EPS format (encapsulated postscript) which is of extremely high quality and easily incorporated into Latex documents. An extra bonus that you get with EPS files is that they are actually nothing more than text files (well the ones produced by Simfit are at least) – you can open them up in something like Notepad and edit them by hand (if you know what you are doing). If you are unfortunate enough to be unable to use EPS files then Simift can convert them to a wide range of graphics formats including bmp, jpg, pcx, tiff and Windows quality emf. There is also a built in Postscript editor to manipulate eps files and create collages, insets etc.
Simfit has the capability to generate many different plot types including (among others) standard x-y line plots, 2 and 3D histograms, pie charts, box and whisker plots, Scree diagrams, Dendrogams, Scatchard plots, 3D surface plots and contour plots. Phew! I don’t even know what some of these are. There are many other graphical facilities available but I think I will simply direct you to the author’s webpage rather than repeat the full list here.
Statistical analysis with Simfit
In its early days, Simfit only handled simulation and curve fitting but Bill and his collaborators felt that it would be useful to add an additional suite of statistical tests to the package. But which tests should be given priority? Bill’s approach was to speak to one of his collaborators, Tom Sharpe, a member of the Manchester University’s School of Biological Sciences (as it was called at the time). Tom drew up a list of all the statistical tests that had been used by the department over the previous few years and Bill implemented the lot! This formed the foundation of Simfit’s statistical abilities and Bill has been adding more routines ever since.
The full list of statistical routines is available on the Simfit website but, to save you a bit of clicking, I’ll reproduce a small sample of them here (shamelessly copied and pasted from the larger list here)
- chi-square (O/E vectors, m by n contingency tables and wssq/ndof)
- McNemar test on n by n frequency tables
- Cochran Q test
- Fisher exact (2 by 2 contingency table) with all p values
- Fisher exact Poisson distribution test
- t (both equal and unequal variances, paired and unpaired)
- variance ratio
- F for model validation
- 1,2,3-way Anova (with automatic variance stabilizing transformations and nonparametric equivalents)
- Tukey post-ANOVA Q test
- Factorial ANOVA with marginal plots
- Repeated measures ANOVA with Helmert matrix of orthonormal contrasts, Mauchly sphericity test and Greenhouse-Geisser/Huyn-Feldt epsilon corrections
- MANOVA with Wilks lambda, Roy’s largest root, Lawley-Hotelling trace, and Pillai trace for equality of mean vectors, Box’s test for equality of covariance matrices, and profile analysis for repeated measurements.
Documentation
It doesn’t matter how good a piece of software is if you can’t figure out how to use it and so good documentation is essential – especially for programs that contain advanced mathematics. Fortunatley Simfit is well served in this area as it comes with a beautifully produced manual. The manual has been typeset using Latex and is accessible from the Windows start menu in either pdf or ps format. Bill even makes the manual’s full Latex source code available from the Simfit website (in the downloads section) so you can compile it from source if you wish. The pdf file is very easy to navigate since it comes with a full table of contents and is extensively hyper-linked.
Weighing in at 425 pages (at the time of writing) it is certainly comprehensive but it is also very clearly written – Bill’ls multi-decade experience of being a university lecturer clearly shining through. As far as I can tell, the manual contains a fully worked example for every single Simfit routine including a suitable dataset and the sample data sets are also built into Simfit itself as you might expect. In fact I think that this is more than just a software manual, it gives a nice introduction to some of the mathematics too. In all honesty I think that this is one of the best produced manuals for a free piece of software that I have ever seen and it gives commercial offerings a run for their money too.
Use of Simfit in the academic community
If you do a quick google search for free software that can handle things such as curve fitting, statistical analysis and publication quality plots then you will quickly be overwhelmed with choices but which ones can you trust? If you are going to submit your results for publication in a peer-reviewed journal then you need to be really sure that the software you choose gives you the right answer. One way to measure confidence in a piece of software like this is to look in the scientific literature and see if other researchers are using and citing it (in a good way).
So, I did exactly that and discovered that Simfit has been used by hundreds of researchers for many years all over the world. Here is a completely random selection of scientific papers that have made use of Simfit calculations over the last few years. I have tried to work out exactly how they used the package and put this in bold at the end of each citation but bear in mind that my own knowledge of statistics is pitiful so I apologize if I have got anything wrong.
- Diverging catalytic capacities and selectivity profiles with haloalkane substrates of chimeric alpha class glutathione transferases, Protein engineering, design & selection [1741-0126] Kurtovic yr:2008 (biplots and dendrogram analyses)
- Phylogeny and evolution of papillomaviruses based on the E1 and E2 proteins, Bravo and Alonso, Virus genes [0920-8569] yr:2007 vol:34 iss:3 pg:249 (deconvolution of Gaussian distributions)
- Catalysis of potato epoxide hydrolase, StEH1, The Biochemical journal [0264-6021] Elfström yr:2005 vol:390 iss:Pt 2 pg:633 (fit to the Michaelis–Menten equation by non linear regression )
- Selective Estrogen Receptor Modulators Accelerate Cutaneous Wound Healing in Ovariectomized Female Mice, Endocrinology [0013-7227] Hardman yr:2008 vol:149 iss:2 pg:551 (Spearman’s coefficient)
- Sex Dimorphism in Wound Healing: The Roles of Sex Steroids and Macrophage Migration Inhibitory Factor, Endocrinology [0013-7227] Gilliver yr:2008 vol:149 iss:11 pg:5747 (unpaired Student’s t test and one-way ANOVA)
- Three dimensional analysis of microaneurysms in the human diabetic retina, Journal of anatomy [0021-8782] MOORE yr:1999 vol:194 iss:01 pg:89 (Kruskal-Wallis test and Kolmogorov-Smirnov 1 sample test)
This is just a small sample of what I found but I think you get the idea. If you spend a bit of time searching on google scholar then you will come up with many more. So, it seems that Simfit is definitely trusted and well used by many in the scientific community.
What if Simfit doesn’t have the routine you need?
If you find yourself wanting to do some sort of analysis that isn’t in Simfit then simply email Bill and (politely) ask! If time permits then he may well help you out.
Spanish Version
Simfit is used extensively in spain and a Spanish version of the program is maintained by a team in Salamanca. I don’t speak Spanish so can’t offer any comment on this except to say that it is fully endorsed by Bill (in fact he gives Simfit courses over in Salamanca) and that the url for the spanish version is http://simfit.usal.es/
Source code
Simfit is written in FORTRAN for windows and the full source code is available to download from the Simfit website. One of the great things about having access to the source code is that you can see exactly how each and every mathematical routine works if you so desire. In addition, if you find any bugs then you will be able to fix them yourself if Bill isn’t around and you will be safe in the knowledge that you will always be able to obtain a copy of the program and (with a bit of work) port it to any computing platform you like.
Something that I would personally love to see is a native Linux version of simift. Bill tells me that he has done his best to separate the windows-centric code from the calculational parts of the program so maybe, just maybe, someone out there has enough Linux GUI programming experience to produce a native version for KDE or GNOME. It would be fantastic if Simfit were to eventually appear in the standard package repositories for Debian, Ubuntu and Fedora.
Something that crossed my mind was the possibility of making some (or all) of the Simfit routines callable from Python. I have no idea how feasible this would be and would need to delve into the source code (and probably send a few emails to Bill) to get a better idea. It is on my ‘to do’ list but one or two people have seen the size of that particular list and have wondered if anyone would be able to get through it before the heat-death of the universe. So if anyone fancies rolling up their sleeves and having a bash…the source is there :)
If anyone is seriously interested in working on a Linux (or Mac) port then I am sure Bill would love to hear from you. His email address is all over the Simfit site.
Full Disclosure
Now I know what you are thinking…Mike (that’s me) is from Manchester University and the author of this software (that’s Bill) is also from Manchester University and so Mike is simply promoting his colleague’s software via his blog. Well in the interests of full disclosure I’ll tell you that I have met Bill a few times and like him a lot but if his software stank then I would tell him (and you) so. He isn’t my boss or anything (in fact he is now retired) so I don’t have a vested interest in making him happy. I don’t use or recommend software because I like the author – I use or recommend it because I think it is the right tool for the job.
As always, comments are welcome!
Has anyone out there had any experience with distance learning courses in Mathematics? I would like to fill in the gaps in my mathematical knowledge and courses offered by institutions such as the Open University look perfect but I was wondering what alternatives there are out there.
I know that there are many alternatives to doing a paid course – For example, I could just read books or I could drop in on some maths lectures at the university where I work. I already do this sort of thing and I find it difficult to stay focused on any particular topic. I tend to start a month thinking about number theory, move on to a bit of statistics and then end up considering problems in global optimization!
The end result is that I know a little about a lot but I want to try and get more depth to my learning and the thought of a looming exam does wonders for my concentration.
So…What I am after is distance learning courses run by accredited institutions (No diploma mills please) that offer lots of modules which will (eventually) lead to some sort of qualification. Exams are a must! One important criterion is that the course must be part time – I simply don’t have time to work through a one-year masters course. The ability to be able to take individual modules (rather than the whole degree or nothing) would also be desirable.
As for academic level – I guess anything from undergraduate upwards will be fine.
Any suggestions?
When you start up Mathematica and get past the splash screen you are met with a blank screen and to a beginner* there are few things more terrifying than a blank screen. Imagine the scene…
“What can I do?” the beginner asks
“Anything you like,” replies the master “This package gives you the ability to explore all of mathematics. Calculus, Fourier transforms, special functions, number theory, image processing, linear algebra…all of these things and more are within your grasp. The world is your mollusc.”
“Um..Can it plot a graph? How do you plot the graph of sin(x) for example?” asks the beginner hopefully.
The master is somewhat deflated by this question. He has spent much of his life learning everything there is to know about Mathematica and wants to show off his knowledge. Hundreds of functions to choose from, hailing from every conceivable branch of Mathematics and the best this guy could do was the Sine function. Oh well…
“Sure – that’s easy” replies the Master “Let’s start out with a simple one. All you have to do is type the following”
Plot[Sin[x], {x, -Pi, Pi}, Ticks -> {{-Pi, -Pi/2, Pi/2, Pi}, {-1, 1}},
PlotStyle -> Red]
The beginner recoils in horror “But..but that’s PROGRAMMING. I’m not a programmer – I can’t do that kind of stuff. All I want to do is plot a graph. Can’t I just use Excel…?”
I have used Mathematica for a few years now (ever since 2000 if you’re counting) and so I can either remember or work out the syntax for commands like the one above with relative ease but I have taught enough beginners courses to know that the above scenario isn’t too far from the truth for many people. Learning Mathematica syntax can be a very daunting prospect if you have never done any programming before in your life.
Many students these days are much more used to clicking on buttons in a user interface to get a job done rather than typing in strings of commands. This is where the new classroom assistant comes in very useful.
The basic idea behind the classroom assistant is that you can look through the palette for what you want to do and when you click on the relevant button it will create a template for the command in a Mathematica notebook. For example, click on Plot and you get
All the user has to do now is fill in the blanks. What could be easier? For more detailed information concerning the Mathematica classroom assistant check out the recent Wolfram Research blog article written by Eric Schulz – the creator of this great new tool. If you would prefer a user’s perspective then take a look at the article written a while back by Maria of TCMTB.
*terrifying to more experienced people too for that matter
I’ve just installed the Intel C++ compiler on a Ubuntu 8.04 system and when I try to compile something I get the error message
Catastrophic error: could not set locale “” to allow processing of multibyte characters
I fixed this by adding the following to my .bashrc file
export LANG=C
Maybe this will help someone out there.
Near the beginning of the month I posted a new Integral of the week which asked for the indefinite integral of
W(1/x)
Where W is the Lambert W function. I had a response from Simon Tyler who sent me a PDF file with a full solution and as far as I can tell it is correct but feel free to get in touch if you disagree with us.
In case you don’t want to read the PDF file, the solution is
x*W(1/x) + E1(W(1/z))
Where E1 stands for the Exponential Integral which is defined as
In Mathematica notation this solution is written as
x*ProductLog[1/x] + ExpIntegralE[1, ProductLog[1/x]]
Since Mathematica uses the function name ProductLog to stand for the Lambert W function. Let’s differentiate this to see if it is correct
D[x*ProductLog[1/x] + ExpIntegralE[1, ProductLog[1/x]], x]
gives ProductLog[1/x]
So, why did I select this particular integral as integral of the week you may ask? Well it started off with a thread in the Maxima developers mailing list. The developers of Maxima added the Lambert W function fairly recently and the system was having serious problems finding the integral W(1/x). If you evaluate
integrate(lambert_w(1/x),x)
in Maxima 5.17.1 then the integrator just loops endlessly – never finding a solution. The members of the maxima developers forum knew what the result should be but they couldn’t get maxima to find it. This got me curious so I fired up Mathematica 7 and did
Integrate[ProductLog[1/x],x]
Mathematica replied by simply returning the unevaluated integral to me. So, not only did Maxima fail at this particular integral but so did Mathematica. Could MATLAB 2008b do any better with its new Mupad-based symbolic toolbox?
syms x
int(lambertw(0, 1/x), x)
Warning: Explicit integral could not be found.
> In sym.int at 64
That’ll be a no then! I can’t try Maple 12 since I don’t have a copy but I do have a copy of Matlab 2007b which uses the Maple 10 kernel as part of its symbolic toolbox so how did that do?
syms x
int(lambertw(0, 1/x), x)
ans=x*lambertw(1/x)+Ei(1,lambertw(1/x))
Success! So Maple (via MATLAB 2007b) is the winner in this little game it seems – I really need to get myself a full copy of the thing.
So, since 3 out of 4 powerful computer algebra systems couldn’t do this integral, I wondered if maybe I could. Turns out that I couldn’t! It seems my interest in bizarre looking integrals far outstrips my ability to actually do them. So, I threw it open to you guys and, thankfully, Simon rose to the challenge. Thanks again Simon.
I have been using Feedburner to manage my RSS feeds for quite a while and they were taken over by google a while back. Until recently this had no effect at all but I was recently told that I had to migrate my feedburner account over to the google platform.
The process was completely automatic but according to my subscriber statistics I may have lost some of you. Looking around the web I see that a lot of people are having similar problems.
The feed seems to be working OK but if any of you are having problems then please try to re-subscribe. Sorry for any problems this may have caused.
Update (28th Jan 2009): My subscriber numbers are now back where I expected them to be and all is well with the new google version of feedburner.
The 47th Carnival of maths has been posted by John over at JD2718 with the usual collection of good stuff. The next one will be at Concrete Nonsense on the 30th January.
Someone at my university reported the following Mathematica 7 bug to me and I thought I would share it with all of you in case someone was interested or could offer insight that we don’t have. Needless to say this has been reported to Wolfram via the official channels and I am sure that it will be sorted out soon.
If you do
Integrate[k^2 (k^2 – 1)/((k^2 – 1)^2 + x^2)^(3/2), {k, 0, Infinity},Assumptions -> x > 0]
you get
EllipticK[(2*x)/(-I + x)]/(2*Sqrt[-1 – I*x])
Which is complex for all x whereas the integrand is purely real. As a particular example let us put x=2. Evaluating numerically:
NIntegrate[k^2 (k^2 – 1)/((k^2 – 1)^2 + 2^2)^(3/2), {k, 0, Infinity}]
gives
0.706094
But if I plug x=2 into the symbolic result given earlier
N[EllipticK[(2*x)/(-I + x)]/(2*Sqrt[-1 – I*x]) /.x->2]
Then I get
-5.35054*10^-17 + 0.568541 I
Which is obvioulsy incorrect. Would someone with a copy of Maple 12 mind seeing what that makes of this integral please? Extra kudos to anyone who can do it by hand!
From time to time I find it necessary to connect to my University’s VPN network and I have to use the Cisco VPN client in order to do it. Ever since updating my machine from Ubuntu 8.04 to 8.10, running the VPN client causes it to crash in the most horrible way. It locks up completely and various lights such as Caps Lock flash on and off repeatedly. The only way to recover from this is to switch my machine off, reboot it and never run the Cisco VPN under any circumstances.
Well, thanks to a user forum I found recently, I have a solution (sort of). The problem stems from the lack of multi-core support in the Cisco VPN client so one workaround is to turn off multicore support on your machine. I did this via the bios in my Del XPS 1330 laptop and when I rebooted the VPN client worked perfectly. Of course this means that I am only using half of the full potential of my processor but since I don’t use the VPN client all that much I figure that this solution is good enough for now. Once I have finished using VPN I just reboot and turn multicore back on.
I have written about Crayon Physics several times now and am pleased to note that Crayon Physics Deluxe has been completed and is available for purchase and download from the author’s website. I have played the demo version for a bit and can assure you all that it is awesome although a shortage of funds prevents me from buying it right now.