Thursday, 28 August 2014

The face of a Murderer


Actor Brendan O'Carrol is most famous for playing his alter ego, Mrs Brown.  But his most recent screen time has been on an episode of the BBC's family history programme, Who Do You Think You Are?

Brendan, who hails from Dublin, always knew that his grandfather had been murdered in 1920, and that his family always believed that he had been killed by the British military.  I'm not going to spoil the show and give details, and those details are not necessary to the point of my post.  So I'll leave it to Brendan and the BBC to tell his story in full. It's well worth seeing if you can catch it.

I have no connections to Ireland, no known Irish blood, no allegiance to Catholicism or Protestantism. But I grew up in England in the 1970s, knowing that Irish nationalists were planting bombs in my country to kill me and my fellows.  The risk to me, living in rural England, was remote, but it forged an allegiance to the British side of the conflict, if for no other reason than pure self-interest.

In my adult years, as a student of human nature, I am cautious of simplistic fallacies such as "our side is always honourable", and was fully accepting when the truth about the 1972 Bloody Sunday massacre finally came out, and David Cameron apologised on behalf of the nation.  But still, no prosecutions have been successfully brought.  And no closure process has been entered into, like the Truth and Reconciliation process which followed the end of Apartheid in South Africa.

Brendan achieved far more than he hoped for in tracing his grandfather's murderers: not only did he establish a motive and method, but he even identified the man who pulled the trigger - his cold face stares from the photo above. The motive was not noble, indeed it was not worth a man's life. And it is revealed that the killer lived a full life following his many crimes, and died having never faced justice.  This is not the closure I would want in Brendan's position. He has no formal justice; no apology from a representative of our nation, which sent a cold, ruthless murderer to kill of our behalf. As much as I'd like just to put my arm around Brendan and express my sorrow and regret for the loss of a grandfather in his life who was taken on behalf of my forebears, I can't do that. But in bringing this story to light, in telling us all what happened in those dark days of 1920 in Dublin, when so much violence and hatred was rife, he brings dignity and a different kind of justice to his family - the justice of truth being told, that we may know what has been done on our behalf, and hold to account our leaders for their actions now and in future.

Tuesday, 22 July 2014

On the Nature of Mathematics


Hands up, I'm way outside my sphere of expertise here: I'm no mathematician, physicist or epistemologist. I know enough to be dangerous, but not enough to make any ground-breaking contributions. So why read any further? Well, I have something to say on this which has been worming around in my mind for years, sometimes peeping into my consciousness for a fleeting moment, before vanishing back to obscurity. But it's now well enough formed to describe as a starting point, if not with any degree of eloquence. And even if I haven't made any breakthrough, let me perhaps lay a cobble along a road which may be interesting to walk. Please be patient...

I have long thought about the nature of mathematics in relation to physics. The two disciplines are closely linked, particularly at the limits of today's advanced cosmology and particle physics. Many physicists and mathematicians have marvelled at the predictive power of mathematics, at the way that theories can be synthesized mathematically into structures which suggest discoveries to be made experimentally, if only to realise some perceived 'beauty' by completing an elegant mathematical structure. When lo and behold the discovery is made, theorists marvel at mathematics and its pre-eminence among the intellectual disciplines.

Some go further still: Roger Penrose holds mathematics to be the reality of nature, and if that wasn't enough, that mathematical concepts have a metaphysical existence in the universe independent of mathematicians, as if Pythagoras's Theorem was floating in the ether for the Greeks to discover and document.

I have long held mathematics to be a human construct which represents the world around us, and not some disembodied mystical entity. I have found every other metaphysical construct to evaporate under the harsh light of critical examination, and I have no patience to entertain disembodied equations emerging from the Big Bang! But I see a problem: my view of mathematics as a construct just doesn't fit with the predictive power mathematics has proved to wield. The discovery of the Higgs boson was a triumph of the predictive power of mathematics, and one which has not sufficiently been heralded in my view. So there must be something more to mathematics than just a toolbag of strategies for solving practical problems.

There is something transcendent about mathematics. If you know what a materialistic skeptic I am, you'll appreciate the enormity of that statement. Solving equations, as I do from time to time as an engineer, feels like refining truth - cancelling terms feels like spooning off the dross from the ever more pure and precious metal sought. The formal proofs of theorems are eternal - once proven they are never broken, and reveal their truth for eternity. There is some kind of magic in mathematics, but I just can't follow Penrose down his metaphysical road. That way lies madness!

I also have bags of humbug for the ancient Greek philosophers. Hemlock wasn't Socrates's only herbal vice: just what was he on when he came up with the Allegory of the Cave? So I'm more than slightly embarrassed that my resolution to the problem of mathematics has certain similarities to his shadows on a cave wall.

While listening to back issue podcasts of The Infinite Monkey Cage a few days ago, with Brian Cox perhaps stating as final that mathematics is truth, while Robin Ince teases him on multiple levels simultaneously, which you only realise are much more clever than at first appears some time later, a thought popped into my consciousness, and decided to hang around.

The thought was: "there is a structure of underlying truth to the universe which we hairless apes are not adapted to comprehend, but parts of which are projected onto our limited consciousness, and the shadows formed are what we call mathematics".

Sitting there, like a mischevous imp at the corner of my mind, that thought cast off other thoughts. I thought of the schematic map of the London Underground. When laid out geographically, the tube network is fiendishly complex. But the schematic representation just shows what we need to know to plan a route from A to B, and where to change lines. It's a functional representation of London, but it's not actually London. So if the underlying truth is like London, but we only have parts of a schematic tube map, there are limited things we can know about London, (er, I mean truth). We know schematically that the Jubilee line crosses the Circle line twice, and if we know that in real London it crosses at one point, (we have solid experimental evidence for one physical law), then we can infer from the rules of topology that it must cross somewhere else (and make a prediction to test experimentally), even if we've never been to Baker St.

There are truths which are so obvious to us that they seem pointless to express: like the number 2 is half of 4, and sits neatly between 1 and 3.  Perhaps if we were not adapted to life as apes, but as supreme logicians, Pythagoras's Theorem would be similarly trivial, and unworthy of a name. So perhaps there is no need for a disembodied metaphysical law of right triangles in the universe, right triangles just are the way they are. And it's not obvious to us because we don't have the right kind of minds to appreciate it, and have to construct formal proofs instead. These proofs seem so magical and powerful to us, that some of us think they have a special existence, but that's just an illusion born of our limited perception. And perhaps the behaviour of waves and particles, and spacetime, and the unity of forces, are all logically deducible, if only we could perceive the logic so clearly.

So we build pieces of a reality map through our reasoning and by our observations, and call these pieces laws and theorems. But these laws and theorems are our constructs, our inventions to account for the way the universe is, to steer our ape minds to conform for a moment to the truth of reality, while the universe just goes on being what it is without any need for such trivia.

On this view then, mathematics really is the projection of reality onto human consciousness. And as the contours of our consciousness change, so do the mathematical strategies we use. When I learned basic number theory as a child, I used abacuses to count-on and perform basic addition. My children were taught the number line, which is a different concept. So their mathematics will be different to mine, not because truth is different for us, but because their consciousness of number is different from mine.

What can this idea tell us we didn't know before? Well it does suggest that there may be limitations to what we can discover. In terms of the analogy, there may be areas of our consciousness which our cerebral topography keeps in mathematical shadow, corresponding to universal truths we can never comprehend. But who knows, if we can find where these conceptual gaps lie, perhaps mankind's perseverance at solving problems will find routes around these gaps, allowing us to solve theoretical and practical problems regardless. Quantum theory could be one of those gaps - we just do not have minds equipped to understand the world on such small scales, but we have mathematical strategies which allow us to skirt the edge of our blind spot and solve quantum mechanical problems anyway.  We've done rather well for ourselves, don't you think?

Thursday, 10 July 2014

Fiat justitia ruat caelum


Dame Elizabeth Butler-Sloss is under fire for having taken the chair to inquire into allegations of historic establishment cover up of child abuse, when her brother stands accused of being party to such cover up. There is indeed a prima facie conflict of interest here, and I've been thinking this one over all day, (off and on, among other things). Now I think I have reached a personal conclusion.

What needs inquiring into, (among other important things, but this one’s pretty central), is this: we had people in positions of authority and responsibility who are alleged to have been conflicted when they became aware of allegations of wrongdoing, but failed to pursue those allegations because that may have disadvantaged them in some way. Perhaps politically, perhaps in their career aspirations, perhaps because it threatened to bring into disrepute a social group to which they belonged. We've accepted these people into positions of authority and responsibility with the unspoken bargain that they should in return exercise such powers responsibly, for the benefit of wider society and not for personal protection or advancement.  And we've been let down: by cash for questions; by the MPs expenses scandal; by the failure to hold Jimmy Savile to account; by disgraceful cover ups over Hillsborough; by the phone hacking scandal.

It seems to me that there will be no one in the establishment with the authority to inquire into this matter, who is not tainted in some way by association.  And despite the appearance of conflicted interests, that is not what we need. What is needed is someone who has the integrity to rigorously inquire into these allegations despite it being potentially damaging to the good name of a close family member, and not someone whose potential embarrassment remains concealed.

All commentators who seem well enough informed to judge her describe Dame EBS as possessing impeccable integrity and unparalleled qualifications to chair this inquiry.  And continuing to chair the inquiry would give her the opportunity to set an example to those pillars of the establishment and inquire into this matter as rigorously as they all perhaps should have done all those years ago, and damn the consequences.

I think she should proceed, and show them what integrity looks like, because it's a lesson many in the establishment need to learn.

Profile: Dame Elizabeth Butler-Sloss
Fiat justitia ruat caelum

Tuesday, 1 July 2014

LogMeIn - Can that let anyone in?



Until recently, I used a service called LogMeIn, which allows me to access other computers I've set up with specific accounts.  I used it primarily to enable me to provide technical support to family members.  It's an incredibly useful service, and until recently a limited service was available completely free of charge. Recently the free option was withdrawn so I stopped using it.

I used it twice for business purposes, one time setting up a specific email address so that a client could access a remote computer I had set up to configure a specific piece of equipment installed on another continent.

Then I began to receive spam email which had been sent to the login email address I used for business that one time.  I knew that the email address had not been published.  I knew that only I had access to the server receiving emails to the address used.  I knew that I had not used it for any other purpose, and that there was no benefit to it being used by anyone else, since only I could receive emails sent to it.  The email address used for spam HAD to have been released by LogMeIn.  So I emailed LogMeIn and explained, but I just received a generic denial, and left it at that.

Today I received an invoice for $826, purporting to be from LogMeIn, sent not to the exclusive login account previously sent spam, but to my business email address.  The attached invoice contained no data, so I was fairly sure it was a phishing attempt to defraud me.  Sure enough, one look at the LogMeIn Facebook page reveals other victims complaining of the same scam.  I forwarded the information to LogMeIn, along with my rationale for believing that it was attempted fraud.

Now I think about it, my alarm bells are ringing loudly.  LogMeIn has allowed my private data to fall into the hands of criminals, witness the exclusive login email address now used for spam.  That's irritating.  Now their customers are being targeted with attempted fraud.  That's alarming.  But how bad could this be?

I used LogMeIn to gain authorised access to computers, with the knowledge and trust of the owners of those computers.  But the means to do that, in the form of login credentials to the computers involved, is entrusted to LogMeIn.  And I now know that information entrusted to LogMeIn has fallen into the hands of criminals.  So how safe are the computers I have used with LogMeIn?  If someone with malicious or fraudulent intent can gain unauthorised access to those computers, they may have access to all sorts of information which could be harmful, such as login details to banking services, financial accounts, employee personnel records, medical details, intellectual property, state secrets,... the list is endless.

I have removed LogMeIn from all my computers, and family computers.  But this remains a concern.  If LogMeIn cannot secure client data, and they hold the keys to millions of computers worldwide, is it wise to entrust LogMeIn with those keys?  Think about it... it gets frightening if you do!

LogMeIn also provides services marketed as RemotelyAnywhere, join.me, Xively, Cubby and BoldChat.

Thursday, 8 May 2014

Halal or Not Halal? That is the Question.

Today's news is full of stories that Halal meat is being sold in the UK without being labelled as such. Now let's get this clear: according to the BBC, 90% of UK Halal meat is from animals which have been pre-stunned, so they conform to legal requirements without the religious exemption. So what's the issue?
During the Foot & Mouth crisis, having seen videos of a man running around a field with a bolt gun after a sheep, I decided to look into legal slaughter practices, (he should have been imprisoned in my opinion), and in doing so I also looked into Halal practices.
The biggest issue for me, way bigger than whether someone speaks magic spells over my food, is that correctly carried out, to the spirit and letter of the law, legal slaughter in the UK is as humane as it's reasonably practical to be. And in my view it's far preferable to death from predation or disease in the wild.
The problem I have is that human nature does not pre-dispose us to treat other humans, let alone other animals, with the dignity, respect and humanity required when there is so much potential for suffering. So we need far greater safeguards against the darker side of our nature in the slaughtering process. I have some in mind, which include routine oversight by independent observers, but the cost would be unacceptable to many people who just want a cheap meal to feed their families.
There are three main requirements for the practice of Halal slaughter: ritual cleanliness; hygienic cleanliness; and minimising the suffering of the animal being slaughtered. Whatever you think of Islam today, these requirements clearly underlie Halal practices and they are entirely consistent with the best ethical practice in humane animal slaughter.
Considering the time when these requirements were established, there was not the knowledge of disease causes we have today, and the distinction between ritual and hygienic cleanliness was entirely blurred. Speaking magic spells over the animal was just as important as ensuring that the animal did not have a communicable disease. The strict requirements of the blade, and the manner in which it is used, are clearly intended to minimise pain and bring about unconsciousness as quickly as possible, both requirements for humane slaughter.
The prohibition on pre-stunning prevents botched attempts which could cause unimaginably greater suffering than a clean Halal kill. And given the state of knowledge over a thousand years ago, when these requirements were founded, I cannot in all conscience condemn it. And having read the scientific literature examining both sides, I find it hard even to insist on pre-stunning, but on balance I do support it.
So, the Halal requirements for cleanliness and the humane treatment of animals are precisely the same as those which underlie our legal requirements today. If Halal practices could be refined in the light of new scientific evidence, then I have no doubt that they would allow carefully prescribed pre-stunning, and place less emphasis on magic spells. Halal practices were introduced for precisely the same reasons we want humane slaughter today, and dogmatically holding to the letter of scripture, while denying improvements in the light of new knowledge, which support its spirit and clear purpose, can be neither just nor holy.
According to the BBC, 90% of UK Halal meat is from animals which have been pre-stunned, so they conform to legal requirements. There is no legal prohibition on magic spells, since we all know they do nothing so cannot possibly do us harm. Therefore, I would be perfectly content to buy and eat Halal meat from animals treated according to secular law, including careful pre-stunning, with or without the magic spells and added Halal requirements, and whether labelled as such or not.
The final issue troubles me as a secular Humanist: compare two circumstances.
1) The legal, ritual slaughter of animals by a devoutly religious person, who believes he is being watched over by an invisible master who requires the animal to be treated with respect.
2) The slaughter by the hand of the kind of person I can imagine applying for and doing the job of slaughterman in a secular abattoir, without independent oversight.
In the light of this comparison, and knowledge of the requirements for Halal slaughter and secular slaughter, I do have a hard time condemning Halal practice.
This is an emotive subject, but I do have one request. Before condemning my heresy, please do read up on the details and argue from a position of knowledge of the subject. Then please feel free to weigh in.

Saturday, 3 May 2014

Billysugger Simples: How to measure temperature with a Thermistor

Introduction

Often we have a requirement to measure the temperature of the board, the environment or some process.  Here’s a quick and easy guide to simple temperature measurement using a simple, cheap thermistor.

There are numerous silicon devices on the market which seem to simplify temperature measurement, but it’s difficult to beat a good quality NTC thermistor.  I’ve used them to measure the temperature of things as diverse as engine manifolds to LEDs, and in medical applications have measured patient internal temperatures to accuracies far better than 0.1°C.

Selecting the Thermistor

There are two types of thermistor, defined by whether their resistance increases or decreases as temperature rises.  Temperature is best measured using NTC (negative temperature coefficient) thermistors, whose resistance decreases as temperature rises.

There are two parameters of importance in defining the characteristic: A reference resistance and the Beta value.  The reference resistance is usually specified as the resistance at a temperature of 25°C.  The most common types have a 10k resistance at 25°C.  The Beta value specifies how the resistance varies as temperature deviates from the reference temperature.  The most common types have values in the region of 4000 and have units of Kelvin.

For this example, we will use a Vishay NTCLE100E3103JB0, (Farnell/Newark part 1187031, Digikey part BC2301-ND).  This is a cheap and simple leaded part with a 2.54mm (0.1”) lead spacing, has a 10k resistance at 25°C and a Beta value B=3977K.



There are many, many types of NTC thermistor, some with different case styles including surface mount parts, different reference resistances for nominal temperature ranges other than room temperature, and different tolerances for accuracy.  This one is good for general purpose air temperature measurement.

The Measurement Circuit

The thermistor is connected to the ADC 0V and in series with a reference resistor, forming a potential divider from the ADC reference.  A filter capacitor across the thermistor will reduce any thermal noise, or other pickup.



Now, we can easily calculate the ADC value at 25°C.  And we’ll see that as the temperature increases, the thermistor resistance decreases and the voltage measured at the ADC falls.

Calculating Temperature

We could approximate the thermistor response as a linear function, but beyond a very small range around 25°C, the errors would quickly become unacceptable.  A better approximation is made by using the Beta-curve function:

R = exp[(Beta/Tk) + LN(A)]

Where Tk is the thermistor temperature in Kelvin, not degrees centigrade, and LN(A) is a constant value for the thermistor. (Kelvin is an absolute temperature scale, where Tk = Tc + 273.15).

Solving the above equation for temperature gives

Tk = Beta/(LN(R)-LN(A))

Or

Tc = Beta/(LN(R)-LN(A)) – 273.15

Where

LN(A) = LN(R25)-(Beta/298.15)

But now we need to know the thermistor resistance R.  The ADC value depends of the resistance R as follows:

ADC = ADC_TOP * R / (R + Rref)

Where ADC_TOP is the highest value given by the ADC, (e.g. 4095 for a 12-bit ADC), and Rref is the reference resistor value.

Solving for R gives

R = Rref * ADC / ((ADC_ TOP * Kadc) – ADC)

Implementing in C-code

The following is representative of code which calculates temperature measured using the above method.  The detailed code will need to be adapted depending on your processor, your board and your thermistor.
// Include math library for calculations
#include <math.h> 

// Define ADC parameters
#define ADC_TOP 1023 

// Define thermistor parameters
#define R_NTC 10000
#define BETA 3977
#define LNA (-4.12858298874828)

// Define Reference Resistor
#define R_REF 15000 

float read_temperature(void)
{
  float x = 0; 

  // Calculate thermistor resistance from ADC
  x = (R_REF * adc[0]) / (ADC_TOP – adc[0]; 

  // Calculate Kelvin temperature from resistance
  x = BETA / (log(x) - LNA); 

  // Convert temperature to Celsius
  x = x – 273.15; 

  // Return result
  return(x);
}
 And if you want to play around with different thermistor parameters, I’ve prepared an Excel file with all the calculations included.

Friday, 13 September 2013

Why I oppose gambling - A humanist perspective

I don't like gambling.  Many people don't like gambling, some for religious reasons.  But I'm a humanist, so I have no religious reasons.  So why do I oppose it?

We all live under the illusion that what we see is real, and what we think is true.  These illusions are so compelling that many people refuse to believe that our awareness is an illusion, but neuroscience and the study of the paranormal prove that the images in our minds are not accurate pictures of the real world.

Some of the differences between human perception and reality are classified under the title 'cognitive biases'.  These include the perception that 'I' am more important to the world around me than is justified.  Another key human bias is that we have a tendency to overestimate the chance of good things happening to us, and underestimate the chance of bad things happening, even in the face of compelling evidence to the contrary.

Because we are alive, we are descended from ancestors who won through tough times and out-competed their peers in the struggle for survival and reproduction.  And we inherited the traits which helped make that difference, for example the tendency to persevere in the face of adversity, and not the abilities accurately to assess probabilities of success versus failure.  Indeed, we are spectacularly maladapted for mathematics, which is why so many of us find it hard.  We have to defeat our in-built biases and become disciplined in following rules of logic which are as unnatural as they are successful.

Just how bad we are at intuitive math, particularly when it comes to assessing risk and probability, is shown by the following BBC video.  When I first saw this kind of demonstration I was utterly convinced that the probability of winning remained 50:50, (you'll see what I mean when you watch it).  Even Professor of Mathematics Marcus du Sautoy was convinced.  He worked it out mathematically, I modelled the game in Excel, (independently of course, I don't move in such noble circles), and the correct answer really is 1 in 3 if you keep to your original guess.

BBC News Magazine - Monty Hall problem: The probability puzzle that makes your head melt

So what has this to do with gambling?  Well we're programmed to assess risk and probability incorrectly.  We inherently overestimate our chance of winning compared to losing.  If Alan had been tempted to bet on the game, Marcus could've cleaned him out.  Alan is inherently no worse at this than you, me or anyone else.  And when we use intuition and common sense about gambling, we make decisiona as rational as a child playing on a railway track.

The only gambling I entertain is the English Grand National, (an annual horse race over jumps, on which many people make a token bet).  But I take the role of family bookmaker and stakes each person can afford to lose.  I've come away on top every year except one.  Even when my wife got third place this year, I paid out less in winnings than I made in stakes on her other bets.  And that's how gambling works - it's always rigged against the punter, it's just that we're all programmed to ignore that fact.

This makes gambling as much a vice as addiction to narcotics.  And the bookmaker is the pusher.  Both vices involve bypassing reasoned choice.  Both involve someone making money by exploiting other people whose decision making is compromised.  Both ruin lives.  And in my opinion, both should be outlawed.