Science

This website is under construction and some content may therefore be unavailable or incomplete.

Postgraduate work

Until I find time to create/finish the content on this page, I will post some of the coursework from my MSc (in HTML and PDF formats), and eventually eBooks containing course notes from my MSc (photon science) and my BSc (maths and physics). Where available, the awarded mark is also shown in square brackets.

Essays

I recommend using the PDF versions over the HTML ones, as some elements appear out of place in the HTML versions due to the conversion process. The presentations are available in Powerpoint (PPT) format on request.

Presentations

These presentations are complementary to the essays above. They are available in Powerpoint (PPT) format on request.

Calculating PI from the Mandelbrot set

Until I get round to filling out this page, here's a program that calculates PI from Mandelbrot paths by mercilessly stealing a discovery made by David Boll [PDF].

To use the program, simply run it, then enter the error range you'd like it to work to: for example, 0.01 will get you a result with an error of up to +/- 1 in the "hundredths" digit (after rounding); 1E-6 would produce a result with +/-1 error in the "millionths" digit (after rounding).

The main part of this program is now written in x86 ASM, as this runs around 900% faster than the same algorithm in pure Pascal (due to Delphi's optimiser being hopeless with FPU code). The ASM version loads data into CPU and FPU registers, then for the duration of the algorithm it does not use system memory at all (code fits into L1 cache) and does not move any data between CPU and FPU (besides [E]FLAGS for conditional jumping).

The Pascal version is considerably slower as the compiler-produced ASM for the repeated part of the algorithm constantly moves chunks of data (up to 160 bits at a time) between memory (presumably L1 data cache), CPU and FPU registers during each iteration. The main loop consists of 51 (compiler-generated) ASM instructions in the Pascal version and just 25 (handwritten) ASM instructions in the ASM version.

The benchmark version (ASM-BENCH) uses a slight structural change to the loop, which reduces the number of instructions per loop to 24 (one less than the ASM version). The benchmark should not be used on systems with single-core processors. I would recommend setting epsilon such that each "loop" takes several minutes (1E-10 should be fine). As interrupts, operating-system features and background processes will affect the performance of the benchmark (and most other benchmarks), I would recommend taking the MAXIMUM value that PiFractal produces (set it to run 20-50 loops). There is an exact theoretical limit to how fast it can run on a certain processor, so provided it comes very near to that limit at least once out of the many loops that you run, the results will have some meaning and be comparable across systems (when run with the same epsilon value). Slight variations in the computer's FSB frequency are the only source of error that cannot be avoided (theoretically) with the right code, as far as I know. Tools such as CPUZ may give some indication as to how much the FSB frequency varies.

The programs are released under the same disclaimer as the software on the software page.

ASM version PASCAL version
ASM benchmark  

Mathematics

Introduction

TODO: NB. Give each of the following its own section! Problem solving - problems solved recently including Chris' maximum. Graphics vs. theoretical treatment of problems. Chambers and his intro to calculus vs. university "intro to calculus". Music - missing fundamental and ringing. Overlap of the two in powerchords / fifths. 12th fret and 19/7th fret harmonics in powerchord, 5th/24th. 5th/7th tuning and Pythagorean vs. Equal - circle/spiral.

Geometry: Circle defined by three points

The roundest knight at King Arthur's table was Sir Cumference. He acquired his size from 2 much PI.

Terms used here:

  • Circles
  • Lines
  • Points
  • Vectors
  • Vector lines
  • Quadratics
  • Parallel/colinear and parallax
  • Intersection of vector lines

Circles

Conventionally, a circle is described by its centre C (a, b) and radius (r). The distance of a point P (x, y) from the centre of the circle is given by d2 metric Which is based on Pythagoras' Theorem.

Where:
  • (a, b) are the co-ordinates of the centre of the circle (C).
  • d is the distance of the point P from the centre (C).
Some basic circle properties
  • : d = 0, P = C, it is at the centre of the circle.
  • : 0 < d < r, P is within the circle, but not at the centre.
  • : d = r, P is on the edge ("circumference") of the circle.
  • : d > r, P lies outside the circle.

The problem

Most graphics programs either allow you to draw circles by marking the centre, then dragging to set the radius, or they draw them to fit an invisible box dragged out by the cursor. Sometimes, I may want a circle in an image to act as a border, and cross through several features that should be at the edge of an image, so neither of the common ways of describing circles to a graphics program were particulally useful. Yes, you can keep re-drawing and dragging circles until one fits, but doesn't that seem a bit tedious?

What are lines and circles, mathematically?

A line can be described by two points that it passes through. It can also be described with a point on the line, and a direction that the line leaves/enters the point in:

Vector lines

A circle can also be described by three points that it's circumference passes through.
As all three of our points lie on the circumference, they will all have a distance from the centre of the circle, equal to it's radius. Therefore, given three points, the centre of the circle can be anywhere that is at the same distance ("equidistant") from each of the three points. Usually, there is only one such place that is equidistant from the three given points, so we will get one circle and only one.

Three-point circle

Parallax and the bisector of two points

With two points (that aren't overlapping), the path formed by points ("locus") that are equidistant from them lies along a line called the "bisector". This line is at exactly 90 degrees (a "right angle") to a line joining the two points, and halfway along it, ie. halfway between either point. With three points, we can draw three bisectors. For this problem though, we only need two.

  • If two lines are "parallel", they never* meet (ie. don't "intersect"), unless they also overlap:
  • If the lines are parallel and overlap ("colinear"), then they are always touching - they never separate.
  • In all other cases ("parallax"), they meet only once, at one point (the "intersection").

* = not quite true, but we can assume so for this problem. Technically, parallel lines meet at infinity (). We can never have parallel lines in this problem (unless they're also colinear), as they have to meet at their common point (the point that they both pass through - we have two lines from three points, so they must share a point). If the lines were colinear, this would give us a circle with an infite radius though - which just turns out to be a straight line through the points. Since we want a circle, we can ignore this possibility.

Parallel & Parallax

Three points and some bisectors

We start with three points that aren't colinear. First, we number them 1, 2 and 3 and draw some lines to connect them:

Numbered three-points

We now draw the perpendicular* bisectors of the connecting lines and label these. Below, I've labelled the bisector of points 1 and 2 "A" and the bisector of points 2 and 3 "B":
* perpendicular = at a right angle (90 degrees)

Numbered three-points with bisectors

Finding the centre and radius

Now time to apply some logic:

  • Any point on A is always an equal distance d1,2 from points 1 and 2 (see "bisector" above).
  • Any point on B is always an equal distance d2,3 from points 2 and 3.
  • Therefore, where A and B meet, at d1,2 = d2,3, there is a point that is an equal distance d from all three points.
  • As the circumference of a circle is the locus of points at a distance r from its centre, r = d and the centre of the circle is at the intersection of the bisectors.

Or put in simpler terms: where these bisectors meet, we have the centre of our circle! The radius of the circle (distance from the centre to the edge) is the distance between any of the points and the centre:

Numbered three-points with circle markings

As we have a centre and a radius, we can now draw the circle:

Numbered three-points with complete circle

Animated method

The whole process in stages is shown in the animation below:

This requires an SVG-capable browser such as Opera. It will almost certainly NOT work in Internet Explorer, and Chrome doesn't seem too happy with animated SVG either.

A B A B 1 2 3

The algebra

To describe this mathematically, vectors are very useful. They aren't essential, but they do reduce the amount of writing considerably, and simplify it.

Physics

Introduction

TODO: Give each of the following its own section! High importance of graphical treatment. Feynman's analogy of curved spacetime. Chemists' importance with actual lab for discovery, vs. physicists' thought-lab for discoveries and developments - Churchman conversation. 10yrs Gallilean relativity and time-travel paradoxes (football match), determinism and thought problem. Einstein, special relativity vs. 12 yrs "speed of light" problem. Simple explanations of some physical problems and their importance, labs to assist explanation and vindication. Simple quantum mechanics? Aikido physics? Feynman's quote "We couldn't reduce it to a simple level, which means we don't fully understand it". Recommend some good books!

Computers

Introduction

TODO: Give each of the following its own section! British rocket attempts. Code breaking. IBM quote - how many will we need? Ease to build nowadays with CPUs and RAM cheaply available, and cheap units to convert (PSP, GBA, cellphone, etc) Use for any task that can be treated mathematically / logically Some examples - This website - XSL, XPath, XML, XHTML, CSS for easy page (re)generation. Smug comment about validator and examples of (seemingly harmless) problems encountered along the way (eg. xmlns=""). Big leap from bad quirky html to strict xhtml. Title graphic - how it was made - Delphi, circle vs. sine, blur function, gaussian blur, envelope, copy, paint-shop-pro finishing, final half-size. Ease of manipulation in program, adjustment and sandboxing in PSP. Sound engineering - DFT, echo, reverb - digital vs. valves - reverb pipes. Solving physics problems quicly. Importance of testing programs with predictable data and organised logic - IF/IF/ELSE/ELSE indenting in pascal for example. Examples of annoying bugs encountered in the past (including "INTERNAL ERROR") Link to software page, with # markers to find programs of relavent interest. Link to graphics where needed too. Software for clean version of MIDICOM3EG2. Example of timetable colorizer and description of how it works - cleaning, AI column detect, merge into database, use of interfaces, XML translation. Note CSS use again. VMware, Lack of spell checker - apologise for typos on the website in its current primordial state. Reasons for not using MathML (bulky, not IE compat) and eventual use of LaTeX (lack of nice software for doing individual equations and saving to PNG).

Last updated by Mark on 12-06-2011

Valid XHTML 1.0 Valid CSS! Footer logo