### y^2 + x^2 = 1

This entry is based on the prologue for the book Elliptic Tales: Curves, Counting, and Number Theory (challenging but quite fun reading on the morning Tube commute!):
$y^2 + x^2 = 1$ is the familiar equation for the unit circle and in the prologue the authors show how a straight line with a rational slope intersects a circle at two point which is rational i.e, of the form $(x, y) = (\frac{a}{b},\frac{c}{d})$ then the second point is also rational and that all such lines trace out the full set of rational points on the circle.

But then the book goes further -

We say that circle $C$ has a “rational parametrization”. This means that the coordinates of every point on the circle are given by a couple of functions that are themselves quotients of polynomials in one variable. The rational parametrization for $C$ we have found is the following:

$(x,y) = (\frac{1 - m^2}{1+m^2},\frac{2m}{1+m^2})$

So this is what I wanted to check… it surely isn’t claiming that all the points on the circle are rational, is it? Merely that the above – if $m$ (which corresponds to the slope of our line through the two points) is rational, generates the full set of rational points on the circle. Because if $m$ is not rational then the second point will not be either? Is that right?

### More on the Summa Metaphysica

David Birnbaum’s office contacted me having seen what I wrote on the “Summa Metaphysica” and sent me this link – www.paradigmchallenge.com

I have to say, of course, that I am a deep sceptic and not endorsing these ideas in any way – quite the opposite – but as both he and his office were perfectly pleasant I haven’t really got the heart to argue about it here.

### Quickly deleting multiple lines from a text file

This may be useful to someone, it was for me.

To delete (say) between lines 10 and 1000000000 (inclusive) use sed:

sed 10,1000000000d <infile >outfile

### New, improved Hexxed

I have not had much luck in hunting down what is wrong with my code or the Xerces-c SAX2 parser – but I do think I have successfully updated by hex editor, Hexxed, to handle 64 bit (ie >4GB) files.

Indeed it performs rather better than vi for some editing tasks (Hexxed has a vi like interface).

So, if a hex editor, capable of handling little and big endian code and able to display output in Unicode is what you are after, and if you are vi-conditioned, then maybe Hexxed is your thing.

Groovy code can be found at: https://github.com/mcmenaminadrian/hexxed

While a runnable jar for those of you who have Java but are not yet Groovy can be downloaded at: http://88.198.44.150/hexxed.jar

And there is more about it here: http://cartesianproduct.wordpress.com/2012/06/03/hexxed-usage-options/

Just remember it is code for playing with – don’t bet the farm on it. But, that said, I have no reason to think it does not work.

### Going on a bug(?) hunt

I now have some code that is meant to parse an XML file of approximately 5 billion lines.

Flow of data in a typical parser (Photo credit: Wikipedia)

Unfortunately it fails, every time (it seems), on line 4,295,025,275.

This is something of a nightmare to debug – but it looks like an overflow bug (in the xerces-c parser) of some sort.

Do I try to find it by inspection or by repeating the runs (it takes about 4 – 5 hours to get to the bug point)?

One is probably quite difficult but simple to organise. The other is (relatively) easier – just step through the code – but is perhaps impossible to organise – how many weeks of wall clock time in a debugger before we get to that instance?

### How “rip-off Britain” comes to science

Nature is perhaps the world’s leading scientific publication. Of course, these days it is a bit odd to have a scholarly journal that looks to cover all of science, but having a paper published in Nature would be a feather in anyone’s cap.

And, more than that, it was founded in, and much of it – including its subscription department – is run from the UK.

So why on Earth do they think it is acceptable to offer a subscription at the rate of \$50 in the US and at £50 in the UK? At the current exchange rate the US subscription rate in equivalent to less than £32. To add to the insult, they offer subscriptions to those elsewhere in Europe for 50 Euros – around £43 at current exchange rates.

### And in XML…

<!DOCTYPE lackeyml [
<!ATTLIST lackeyml version CDATA #FIXED "0.2">
<!ATTLIST lackeyml xmlns CDATA #FIXED "http://cartesianproduct.wordpress.com\">
<!ELEMENT application EMPTY>
<!ATTLIST application command CDATA #REQUIRED>
<!ELEMENT instruction EMPTY>
<!ATTLIST instruction size CDATA #REQUIRED>
<!ELEMENT modify EMPTY>