Showing posts with label science. Show all posts
Showing posts with label science. Show all posts

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?

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.

Sunday, 14 July 2013

Winchester Science Festival 2013

While planning my visit to the Winchester Science Festival next weekend, I was looking for a programme laid out as a timetable, so my family and I could mark sessions of interest then plan what we were going to see when.  I couldn't find one, so I decided to compile one.  My OCD compelled me to make a reasonable job of it, so I now have a printable PDF which can be printed on one double-sided page per day, (one side per morning or afternoon).

If you're thinking of going, feel free to download it here: WinSciFest2013.pdf

Otherwise, for a quick summary, see the table below (without photos and session descriptions).

SATURDAY MORNING
Performance Hall
SATURDAY MORNING
Learning Room
Sat 10:00
DR HELEN CZERSKI
A WORLD OF SCIENCE TOYS

Sat 10:00
DR JEN GUPTA
STARGAZING TBC

Sat 11:00
DR ADAM RUTHERFORD
CREATION: THE ORIGIN AND
THE FUTURE OF LIFE

Sat 11:00
DR SIMON WATT
SPERM WARFARE

Sat 12:00
PROF DEBRA SKENE
HOW YOUR BODY TELLS THE TIME

Sat 12:00
PROF BOB NICHOL
SETI: THE SEARCH FOR
EXTRATERRESTRIAL LIFE

SATURDAY AFTERNOON
Performance Hall
SATURDAY AFTERNOON
Learning Room
Sat 14:00
PROF MARK MIODOWNIK
STUFF MATTERS

Sat 14:00
ALAN LAWRIE
SECRETS OF THE SATURN V

Sat 15:00
ROBERT LLEWELLYN
ELECTRIC CARS ARE RUBBISH,
AREN'T THEY?

Sat 15:00
BEN LITTLEFIELD
STRONGER, GREENER, FASTER

Sat 16:00
PROFESSOR BRUCE HOOD
THE SELF ILLUSION

Sat 16:00
DR ED WAUGH
DRILLING IN ANTARCTICA:
THE LAKE ELLSWORTH PROJECT

Sat 17:00
MAGGIE PHILBIN
TEENTECH

SUNDAY MORNING
Performance Hall
SUNDAY MORNING
Learning Room
Sun 10:00
DR TOM CRICK
COMPUTING: THE SCIENCE OF
NEARLY EVERYTHING

Sun 11:00
DR DEAN BURNETT
BRAINS, I AM IN YOU!

Sun 12:00
DR LISA MCNEILL
NO MARGIN FOR ERROR

SUNDAY AFTERNOON
Performance Hall
SUNDAY AFTERNOON
Learning Room
Sun 14:00
PROF COLM MULCAHY
MATHEMAGIC WITH
A DECK OF CARDS

Sun 14:00
MEGAN WHEWELL
HOW DO WE KNOW
WE LANDED ON THE MOON

Sun 15:00
PROF DOROTHY BISHOP
THE REF, IMPACT FACTORS,
AND OTHER DAMAGING TRENDS: THOUGHTS FROM
A GRUMPY OLD SCIENTIST

Sun 15:00
DR MATTHEW WRIGHT
HOW SCIENCE SHAPED MUSIC

Sun 16:00
DR SIMON WATT
WHY WE DIE...,

Sun 17:00
PROF JON BUTTERWORTH
ATLAS SHRUGGED;
OUR NEW BOSON

MONDAY MORNING
Performance Hall
MONDAY MORNING
Learning Room
Mon 10:00
DR KAREN MASTERS
A RAINBOW VIEW OF
THE ANDROMEDA GALAXY

Mon 10:00
NICOLE SLAVIN
FUN WITH BRAINS AND BEYOND
(FOR AGES 7+)

Mon 11:00
DR HEATHER WILLIAMS
PHYSICS GETS TO
THE HEART OF THE MATTER

Mon 11:00
DAVID GREEN
ECOISLAND; THE HARDWARE AND SOFTWARE FIX FOR PLANET EARTH

Mon 12:00
PROF DAME WENDY HALL
NO WOMAN, NO RASPBERRY PI

MONDAY AFTERNOON
Performance Hall
MONDAY AFTERNOON
Learning Room
Mon 14:00
PROF SOPHIE SCOTT
LAUGHTERLAB

Mon 14:00
PROF JAMES SMITH
FROM CHERNOBYL TO FUKUSHIMA: PREDICTING THE CONSEQUENCES OF NUCLEAR ACCIDENTS 

Mon 15:00
DR FRAN SCOTT
SCIENCE MISADVENTURES

Mon 15:00
DR SIMON WATT
DR DEATH AND THE MEDI-EVIL MEDICINE SHOW

Mon 16:00
GRRLSCIENTIST
ENDANGERED SPECIES

Mon 17:00
DR KAREN JAMES
DARWIN, THE BEAGLE PROJECT AND GALAPAGOS NOW