Showing posts from April, 2010

Waiting for software and school children

I spent a few hours with colleagues at a major national laboratory earlier this week talking about national security, the role of software and school children. On the surface, they would seem to have little connection but as I drove back to the office the connections started to form. I invite you to follow along. In North America, Europe and other major economies throughout the world we spend huge sums of money in an attempt to detect and prevent national border intrusions and terrorist activities. In the process we've created a massive industry to x-ray, scan and monitor everything that moves in airports and elsewhere. In the process, we've put hundreds of thousand of people into jobs that apparently weren't needed 40 years ago, spent billions in taxes and worst of all, thrown sand into the gears of both business productivity and leisure time by a process ostensibly designed to keep us safe. We've created a huge "tax" in time and money when the real problem…

Plotting Lambert's W Function

For this post I wanted to come up with something a little easier on the eye than my previous offerings (Loading DTDs using DOM in Python, Colorised svn diffs and How do you like your Fortran 95 interfaces?).

Here you go:

I've been developing code for computing complex values of Lambert's W function, and I thought I'd share the Riemann-surface plots above, which are, from top to bottom, Re(W), Im(W) and abs(W) for the branches -1 (Blues), 0 (Greens) and 1 (Oranges). The route I've taken to get the plots has been a good learning experience for me.
First approachMy initial idea was to write a mex wrapper to my algorithmic Fortran code, along the lines of what happens for the NAG Toolbox for MATLAB. I also wanted to see if I could provide a vectorized interface, as native MATLAB functions have.

Whew, it's not much fun debugging mex files, is it?

The main thing I learned from this experience was to use mxCreateNumericMatrix to create my function's return values: in th…

New product launch = busy, but happy marketing department!

Today is an exciting day for NAG. The launch of the latest release of the NAG Library for SMP & multicore, Mark 22.

A new product launch (or release) is always a busy time for any marketing department. Months of planning and preparing new literature, presentations, collating benchmark data, new advertising campaigns, exhibition stands etc, and then comes the fun part - announcing to the outside world.

As with all marketing activities, there's a plethora of best practice guides in achieving a successful product launch. Our goal in the marketing department at NAG is to ensure that our news reaches every single user, potential user and specific media.

How do we achieve this goal?

The relatively recent emergence of new communication methods, blogging, microblogging and social media have transformed how we communicate with our audience and has made this launch different from those previous to it. What's so great about these new channels to market is that we can communicate and enga…


How early can you be taught to program? A thought that has struck me since my wife gave birth to our first born son a month ago. There is no denying that the thought processes that have to be learnt in order to program are invaluable and transferrable abilities. Skills such as logical thinking, reasoning, planning, modularity, that are applicable in all forms of jobs not just ones involving programming. Having only learnt to program three years ago, I wish I had had more of a chance to program in my early years. So if ever my son is interested in programming I might start him off with a kids programming language called scratch that I heard about in a magazine. Scratch is a pictorial drag and drop language that feels a bit like lego in style. Different types of variables are different shapes and only fit in the right shaped holes. It's not a very powerful language, but a good educational tool for the youngsters as it is easy to use, understand, and they can create a lot of fu…

Easter egg or not?

Hi, I'm Marcin, technical support engineer here at NAG and I've recently encountered an interesting problem. I coauthored a recent paper on option pricing with the NAG Library (Option pricing in Excel). My coauthor Jeremy subsequently blogged about it (Extending, imitating and collaborating). Now it’s time for the next step.

While working on a demonstration of NAG random number generators in Excel and their application in option pricing using the Monte Carlo method I noticed a considerable discrepancy in results while using unscrambled Sobol quasirandom numbers. Well, to start with, how do you price a European option when the underlying asset follows geometric Brownian motion? Basically for each random number you simulate what the price of the asset will be in, say T=1 year, moving in one step from the starting time point t=0 to the end point t=T, calculate the payoff, and the average value of all payoffs will be our desired option price (Monte Carlo methods for option prici…