Friday, May 29, 2009

The Ascent of Freeware


In the last month, a new website created by a team lead by Stephen Wolfram (http://www.alphawolfram.com/) has generated considerable interest among mathematicians, scientists, engineers and the wider community. In the popular media, the site is characterised as an attempt to challenge the supremacy of "google" but a visit to Alpha Wolfram will quickly reveal that the site offers a very different service. For example, one can type "Integrate x^2cosx" and get a full analytical answer to the integral (including the steps), an alternate solution, a graphical representation of the integral, a definite integral solution and a series expansion of the solution, within seconds. Impressive indeed ! Type in "Solve x^3 + 2x^2 + x - 6 = 0", and the full solution of the cubic with steps and graphical interpretation appear moments later. Certainly, I have been able to think of analytical problems that the software can't deal with and the on line service is not really appropriate for dealing with large data sets (see http://www.scilab.org/ for powerful freeware for manipulating matrixes and high level scientific programming), but this is nit picking - Alpha Wolfram is a triumph.

Alpha Wolfram places much of the analytical mathematical power of Mathematica and Maple in the hands of anybody with access to the web. AND IT IS FREE ! It will cause mathematics teachers at all levels to re-think what kind of homework questions are worth asking, in particular, it should push assessment towards "setting up the problem" and "analysing the answers", and away from the application of largely mechanical procedures for solving various standard equations. It maybe to early to say the traditional idea of getting a 1st year Engineering student to go through hundreds of standard integrals is now dead but certainly, this approach is in danger of becoming irrelevant and going the way of "log tables" and using Euclid's "Elements" as a textbook.

Viva La Freeware !!

Sunday, May 17, 2009

In Praise of Newton-Raphson

The Newton-Raphson technique for finding roots of equation via an iteration process is one of the first numerical techniques taught to students of mathematics. As a technique, it illustrates important features common to many numerical techniques used in mathematics, namely:

A) it is based on a very simple mathematical idea, that is, that extrapolating a value from a curve back to the x axis, by assuming a linear relationship, is a good way to form a more accurate guess for the intercept of the curve with the x axis,

B) after a few manual calculation using the technique, you are eternally grateful to the inventors of the computer (Hail Babbage, Turing, Zuse and friends !)

C) it is very simple to turn the procedure into an automated program,

D) the better the initial guess, the quicker you will arive at the solution and save computational time,

E) the more accurate the solution you desire, the greater the number of iterations,

F) finding a strategy for dealing with rounding errors and storing numbers with the appropriate level of precision between iterations are not trivial problems,

G) without care, it is possible to diverge of the wrong solution or (even worse) even to send the computer off to an unending loop of diverging solutions (i.e. "wrong" over and over and over again), and

H) it really works - there are few curves that it can't deal with but these are relative oddities compared to the great number of curves that the technique solves readily.

As a young engineer, I wrote several programs that used the Newton-Raphson technique to find solutions to the various equations I had formed in my models. Invariably, once I had found a good method for avoiding divergent solutions, the Newton-Raphson routine would find a solution. Like many before me, I found the technique surprisingly powerful , verstaile and useful. Now, students can "play" with the technique using graphical calculators or spreadsheet programs on a lap top. In essense, once you have a "curve", whether it be formed by data or through a known equation, the technique can be used to find solution for particular intercepts (e.g. y = 0) without having an analytical solution - that may not be possible or indeed just beyond your algebraic ability.

Saturday, May 2, 2009

The Box Problem

A common problem used to illustrate how differential calculus can be used for optimisation is "the box problem". The box problem goes as follows; imagine you manufacture boxes (W metres wide, D metres deep and H metres high) and you wish to minimise the amount of cardboard used to produce your standard box with volume V (V= W.D.H cubic metres).

The first step is to set up an area equation, which is the quantity that we are trying to minimize:

A = (area of the two sides defined by the width) + (area of the two sides defined by the depth) + (area of the top and bottom sides)
=2W.H + 2D.H + 2W.D

Now we have three unknowns and two equations. One option is to form solution based on an assumed ratio (C) of the width to the height, which we can use to simplify our area equation to:

A = 2W.H. + 2(V/W) + 2(V/H) by using the the volume equation to substitute for D and using C= W/H, we get :

A= 2C.H^2 + 2 (V/C.H) + 2(V/H) = 2C.H^2 + (2/H)((V/C) + V)

If we graph this function (A vrs H) and forget negative values of both A and H, we can see a clear vertical asymptote along the A = 0 and a minimum near the origin that is a function of our choices for V and C. Of course, this equation is ripe for differentiation:

dA/dH = 4C.H - (2/H^2)((V/C) + V)

At the minimum, it must follow:

dA/dH = 0 = 4.C.H - (2/H^2)((V/C) + V)

therefore,

H = ((V + VC)/(2 C^2))^1/3

Now, we have a ready way of optimising the quantity of cardboard for any given volume and ratio of height for depth. What solutions do we get if we assume a certain ratio to the width to the breadth ? Which is the true minimum (i.e. independent of our assumptions of ratios of dimensions) ? Excellent questions ! Start analysing and optimising ..... welcome to Applied Mathematics !