Year: 2010

  • Why is no-one using electronic signatures?

    At the end of every semester we go through a little dance at the university called external examination. We send the exams to an external examiner and they have to indicate the paper is well set and fair, then we send them some of the marked papers and they indicate that they have been fairly marked and that the marks are reasonable. This process is monitored and our accreditation body (ECSA) requires that we keep the paper trail on file to check that everything was done right. They require a signature on a hard copy of the documentation at every stage of the process.

    At the moment I am also going about the business of registering as a professional engineer, which also requires much signing of documents. After the signing by the people involved, it has to be signed by a commissioner of oaths and sent on to ECSA as a hard copy.
    These situations have me wondering yet again why people don’t use electronic means for these processes. Perhaps I should append “in South Africa” or “in the Engineering community in South Africa”. An argument I hear quite often is that you need a handwritten signature for legal purposes. This is balony, as one can read in Act No. 25 of 2002: Electronic Communications and Transactions Act. A good summary of what the act means for digital signatures in SA can be found here, but I will give an even more summarised version: digital communication has exactly the same legal standing as hard-copy communication in South Africa. So there is no legal reason for people not to just e-mail one another and write their names at the bottom of the mail for non-contract communication just like any other time. When a legally binding contract is entered into, we need an “advanced digital signature”, which boils down to signatures using public key systems like S/MIME or PGP.
    So, why is no-one using these systems? I think the first is that most people still print out everything they want to keep, and digital signatures tend to be invisible. Printing out the document invalidates the security of a cryptographic signature and there is no formal way of ascertaining whether the document printed out was signed or not. Big problem for people who don’t use computerised filing systems. Unfortunately, this means they do something very bad: they trust faxed or printed out signatures. Many people are ok with a document as long as it looks as if it has been signed. This is ludicrously simple to cheat, as all the things that make a physical signature difficult to fake are not present on the fax. I am absolutely certain that I could trace a signature and have it look legit after faxing. I am even more certain (because I have done it) that a couple of minutes with a photo manipulation software gives me a signature I can put on any document I wish.
    Which brings me to the second reason no-one uses digital signatures: people think of computers primarily as an extension of the “real world”. The mental model encouraged by Office software vendors is that the electronic document is just like the real thing, only on the computer. This is great when the metaphor is solid, but many things that are used in computers just don’t have any physical equivalent, and these things become difficult to understand. This doesn’t mean they can’t be used (what’s the real-world equivalent of Facebook?), it just means you need to package it right. I reckon Adobe’s idea with a little ribbon that appears on a PDF when it’s been validated is almost there, but it’s not ubiquitous enough for people to recognise what it means, and I don’t think there is a good way of validating the document after it has been printed.
    I think there is a real gap in the market for a cryptographic signature that would work with mobile phones — a datamatrix in the corner that would match an image hash of the whole document. Lots of interesting implementation details there, but a good way to make hard copies trustable.
    So, what am I going to do to stop the madness of printing out documents, signing them and scanning them or faxing them? Pretty much what I’m doing already – affix a picture of my signature to the PDF and get on with my life. Legally, I could just as well have written my name, but it keeps people happy. I will also refer them to this blog entry and the law when they claim a legal necessity for hard-copy signatures.
    What do you think – when will the hard copies go away?
  • Free will of the gaps

    The following is a paper I will be presenting at our Philosophy Department’s colloquium entitled “SCIENCE, RELIGION AND THE FATE OF TRUTH” . The working title is “Free will of the gaps”. I have tried to restrict myself to 2500 words (about 15 minutes of talking). Please drop a comment — it’s not entirely polished yet, but I think the gist is there. I think I need to focus on the ending a bit more than the premises, but the general idea is to draw a couple of implicit parallels between free will and religion, and how science pushes against both concepts.

    When I was a child it was easy to imagine that I could control things at a distance. If I concentrated hard enough, it seemed like I could move a glass over the table at will just as I could move my hand. As I grew older I learned from experience and at school that the reach of my will was limited. I learned that, to move the glass I would need to use my hand; that to move my hand required the movement of internal muscles, which required electronic impulses from nerves which ultimately came from my brain.

    I am a chemical engineer by training, and as such I tend to view the world with a certain pragmatism (not unlike philosophical pragmatism) that is shared by people who try to build things that will work. A nice theory is all well and good but it won’t hold up a bridge, or generate electricity or produce better fuel, so engineers attempt to find models and use “will work” and “won’t work” as close approximations of “true” and “not true”. For this reason, I have studied for many years the way that the world works. A philosopher may point out that I have studied the way things appear to work, but an engineer would say that’s irrelevant. A scientist may go a bit further and say that science takes great pains to distinguish between apparent correlation and actual causation, that the kinds of mistakes that people tend to make in their perceptions are well studied and corrected for by techniques like strong hypothesis testing and blinding.

    Models of how things work are engineering axioms

    I have also studied mathematics. John von Neumann (also qualified as a chemical engineer) said that you don’t ever understand mathematics, you just get used to it. Although the field is viewed with some disdain by many, I have learned that mathematics is simply shorthand for logic: on the one hand, it is a way of using logical results without having to go through the trouble of proving them, on the other it helps to ensure that your own proofs are logically consistent. It also provides a conceptual framework that guides your thought along probably correct routes. Unfortunately, it is not a method of ensuring that all the statements you make are true in any sense, as Bertrand Russel had to learn the hard way thanks to Kurt Godel.

    Engineers use math to work from the axioms to conclusions consistently

    What I have learned from my studies of engineering and mathematics is that models like Newton’s laws and Einstein’s general relativity, together with some logic, predict the interaction of things larger than atoms with high accuracy. Whether engineers are designing buildings or spacefaring vessels, they have sufficient models without thinking about philosophy at all. Applied to the human body, these rules combine to place constraints on the effects of my thought. I cannot move the glass on the table with my mind. In fact, I cannot directly move my hand to move the glass. My hand moves due to electrical signals reaching muscles, the electrical signals originate in the brain or in autonomous systems in my body. The reach of my will has been beaten back to the brain.

    Engineering pragmatism also demands parsimony of its models. Scientific parsimony is a rule of thumb also known as Occam’s razor that holds that one should favour simple explanations over complicated ones. For scientists and engineers, this means that models that predict the results of experiments equally well should be distinguished based on their complexity, which is usually calculated from the number of assumptions or tunable variables. Newton’s famous F=ma is a remarkably parsimonious model of movement. Einstein’s model of relativity is more complex, but is more accurate than Newton’s model when things are moving at high speeds. Einstein is often viewed as having proven Newton wrong, but Isaac Asimov warns us about the “Relativity of Wrong”. He explains that science (and the pragmatic view) is about improving the models, which means that Newton’s models are less accurate than Einstein’s, but both are accurate in certain circumstances.

    So, it would appear (at least at the macroscopic level) that the universe proceeds by fixed, simple rules. Much of what we see is explained to great accuracy by such simple rules. If everything proceeds in this manner, with fixed causes leading to fixed effects via fixed models, the entire run of the universe is deterministic.

    Engineers treat the macroscopic world as deterministic

    This is not to say that the overall behaviour of the universe is simple or predictable. The complexity attainable by simple rules is amazing. Stephen Wolfram has shown that cellular automata (which are very simple rules for manipulation of numbers) can be computationally complete. This means that remarkably simple mechanisms yield systems with behaviour that is arbitrarily complex. Anyone who has ever zoomed around in a Mandelbrot fractal, or has struggled with the solution of the Navier-Stokes equations will attest to the beauty and complexity that can emerge from these simple manipulations. This complexity is the one of the chinks in the idea of predictability, embodied by Laplace’s demon, which uses the rules governing the universe together with complete knowledge about the state of the universe at a single point in time to predict the future.

    Chaos and complexity place limits on practical predictability

    Another problem with predictability is that when we zoom in even further than atoms, the kind of models that engineers are used to using start to break down. Here we are in the quantum world, where things are much less intuitively satisfying. The best models we have are confusing and do not mesh with the macroscopic models. The Copenhagen interpretation of the wave equation implies that at a subatomic level, certain events are truly unpredictable beyond simple probabilities.

    Quantum mechanics may imply limits on actual predictability

    Daniel Dennet identifies three levels of model that people use to predict the behaviour of an object. The models engineers typically use are either physical stance or design stance models. That is, they use physics (like Newton’s laws) or reasoning about the design of objects (a watch was designed to tell time, so it should show the correct time). Normal humans often predict how complicated things are going to behave by thinking about their intent or purpose. This is called the intentional stance. For instance, we may predict that a hungry lion will want to eat us and use this knowledge to move away from it. When interacting with humans, this prediction is harder, although it becomes easier with more intimate knowledge. Spouses or good friends may complete each other’s sentences.

    Unfortunately, this kind of intentive modelling is easy to over-apply. We may start trying to predict what a machine “wants”. Children may claim that a rock doesn’t “want” to move, and even adults often lament the unwillingness of their computers or bemoan how hard it is to find out what they want. The overeager application of intentive modelling is an example of how we think about the world may be wrong in the engineering sense of working — a good understanding of the rules that govern a computer program is more accurate than trying to figure out what it wants.

    Engineers tend to trust the physical stance more than the intentional stance

    If the extent of my will has been restricted to my brain, and we try to get better understanding of the brain by moving from the intuitive intentional stance to the physical stance, we are drawn into the field of biology.

    My exposure to chemistry leads naturally to an interest in biology. And what a time for an interest in biology! Every day we are making new discoveries about biological systems including our own bodies. Genetic research has accelerated as computer power has grown and methods for sequencing and correlating genetic information are making it easier than ever to understand the mechanisms behind the functioning of our bodies. Biologists are starting to develop physical models that engineers like: deterministic, calculable and predictive. Engineers are using the concepts behind evolution (selection and mutation) to optimise their models and finding that these techniques do work. In addition, they are making it more difficult to suppose that any external forces are in play other than selection and mutation leading to more specialised organisms over time. These models are quite good, but as we probe deeper into the brain, we seem to find nothing but physical matter where we expected to find our thoughts.

    What is more certain than our thoughts? Renee Descartes surmised that everything is subject to doubt but the act of thought. Unfortunately, he realised that one could go no further, to probe the truth or validity of these thoughts. Douglas Hofstadter explores how self-awareness can emerge from the models that we have of how minds work by using equivalence of certain kinds of computation “Godel, Escher, Bach, an Eternal Golden Braid”, which should be required reading for anyone interested in the origin of self-awareness. Many other researchers have tried to defend the idea of self-awareness arising from mechanistic models even though no-one has as yet claimed to be able to build a self-aware machine. Few people contend that self-awareness is contradicted by modern science. However, there is an interesting stronger statement about what is called “free will” or “agency”. For the purposes of this paper, we will use a colloquial definition of free will that involves

    1. the possibility of more than one future that is uncontradicted by the present condition of the universe and
    2. a property attached to a person that is able to make the final call about what ends up happening.

    An example of the first condition a may be that eating pizza or pasta tonight may both be possible. An example of the second would be that you could choose either without any forcing reason.

    The general consensus among modern philosophers seems to be that free will is an unprovable property. It is one of those topics that is hotly debated and well explored, but often ends in an “oh, let’s agree to disagree” embargo on further discussion. Why is it important? The largest impact of free will is in morality and ethics. A significant part of our legal systems is built around the idea of free will. It forms the basis for our concept of punishment and personal responsibility. If there is no free will, many of these constructs are logically inconsistent.

    This ties in with math, science, and biology in an interesting way. I have mentioned that modern science appears to imply that at a macroscopic level things are predictable in the short term. There may be unpredictability due to chaos effects (where even small changes in inputs can cause large changes in outcomes) and quantum effects (where subatomic particles can exist in many states at once, only collapsing to one state when measured), but there is no science that shows that we can do what we like. It is a subtle point, but one must be both aware of one’s existance and able to take independent action for us to be able to “do what we like”. Current science does not contradict the idea of a self-aware mind — it is when we start saying that this mind can exert an influence that the problem begins.

    It is clear from observation that certain physical constraints are in place. As near as we can tell, there is no “mind over matter”. I cannot move the glass directly with my mind. But now, the glass has moved into the brain. If my brain is made up of the same kind of things as the glass: atoms, where is the “secret sauce”? It is remarkably elusive.

    Religious apologists are critical of “God-of-the-gaps” defences of the existence of a deity. Lay people may say things like “science hasn’t yet created life”, and may point out “missing links” in evolutionary chains, but they are cautioned by people like Dietrich Boenhoeffer that “If in fact the frontiers of knowledge are being pushed further and further back (and that is bound to be the case), then God is being pushed back with them, and is therefore continually in retreat”. In many ways free will has been defended in similar ways.

    Everyone has their favourite example of free will: the existentialists had their ledge, almost everyone thinking of an example will try to do something unpredictable, or point out that my defence of my deterministic point of view contradicts itself. However, we are learning every day how our behaviour is determined by our physiology. Transcranial magnetic stimulation (TMS) can be used to selectively deactivate parts of the brain by placing the head in your head in a strong magnetic field. Experiments have shown that it is possible to induce feelings of awe, sensory illusions and other odd feelings by exposing the brain to a magnetic field. It is common knowledge that levels of various chemicals alter our perception and abilities. What is most interesting about results with TMS is that many of these effects are not as clearly categorised as altered states as for instance mind-altering drug use. A recent experiment reported in PNAS by Liane Young and coworkers shows that moral judgement can be altered by TMS. What makes this result interesting is how altering or disabling parts of the brain has such clear effects on things that people attribute to be a function of free will. From another angle, John Conway and Simon Kochen have proven that if we have free will, then so do subatomic particles. Now, I don’t know about you, but the idea of a subatomic particle having free will is pretty strange to me.

    Doing something unpredictable doesn’t prove free will any more than adding unpredictable behaviour to a robot using dice or a quantum event would make us say that it had free will. Even more disconcertingly, it is difficult to think of an experiment that would conclusively prove the existence of free will. Because there is no requirement of predictability, it is unreasonable to demand a perfect predictionn of the outcomes of a human decision before we concede. In the end the idea of an unconstrained free will is pretty solidly contradicted by modern science and our personal experience. Our will is restricted to our body, then our brain, and even our brain is restricted by its physiology. On the other hand, mathematical consistency shows the limitations of any computational device, whether it is silicon or carbon.

    Science is advancing ever further into our free will of the gaps

  • Installing scikits.timeseries on Mac OS X Snow Leopard

    Here is a nice list of steps (and dead ends) to get scikits.timeseries going on Mac OS X Snow Leopard. I am putting it up here for myself and for other people wishing to get going as soon as possible.

    So, scikits.timeseries lists python >= 2.4, setuptools, numpy >= 1.3.0, Scipy >= 0.7.0, matplotlib >= 0.98.0 and pytables >= 2.0.
    I am assuming you already have matplotlib and scipy and all that, and Snow Leopard comes with python 2.6 already installed. Now you need to get pytables going. For that you need to install HDF. If you go to the HDF site and you follow all the way to the Download page you may think you’ve hit the jackpot when they mention there’s a nice pre-built binary for you to download. Don’t do it, as it will not work with pytables! Rather, download the source for 1.8.4 patch 1 and compile it yourself (tar -xzf tarfile; ./configure –prefix=/usr/local && make && sudo make install). Should be fine if you have xcode installed.
    Now you are ready for pytables. sudo easy_install tables works fine if you’ve got hdf installed as per above. Last step is to install timeseries itself. sudo easy_install scikits.timeseries works fine.
    If the import fails (go into python and type import scikits.timeseries) with a reference to numpy 1.2.1, you may need to delete the numpy that Apple packaged with Snow Leopard. Simply do sudo rm -r /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/{numpy-1.2.1-py2.6.egg-info,numpy_APPLE_DEFAULT}
    Timeseries is a great package for working with timeseries that have dates attached. Perfect for timeseries segmentation and analysis for your PhD!
  • Equation solving interface

    In moment of clarity I realised today that many of the things that I want to create as GUI applications can be generalised to a single application: An equation solving interface. I have played around with various equation solving environments like EES and PolyMath, also math environments like Mathcad but none of them work like the thing I am starting to see in my head.

    The idea is like this: You set up a set of variables and constraints, which may be equalities or inequalities. You give the variables names and dimensions (length, time, etc). So far so normal. Traditionally you would now start to specify your problem, perhaps with the tool checking when there were enough specifications to solve the problem. In my vision, you get an interface consisting of entry boxes for each of the variables. You can enter values in any box, and as more information becomes available, the other boxes are filled. Some colour coding helps you to see which values you filled in recently and which ones have just been calculated. Hovering over a variable highlights the values that are linked to it, perhaps with an overall and direct distinction, perhaps with a drillable menu.
    So the first mode of operation allows you to start typing the information you have and the unknowns are calculated as they can be. Now you can play with the values, and select which calculated values should stay the same and which should be recalculated (perhaps using that drill-down menu). You can select some variables to be “Fixed”. You can elect to change some of the text boxes to sliders, which allows you to “play” with the solution. You can change some of the boxes to ranges, which will use interval arithmetic to calculate ranges on the other variables. You can change some of the variables to Min or Max, if you select more than one you get multiobjective optimisation. From the same interface, you can see visualisations of the current position in the design space and the constraints that you have placed via the equation setup and via the ranges you have imposed on the other variables. When you find a nice combo, you save it and it gets added to a list of tagged points in the plot views.
    Other nice things you can do: automatic nondimensionalisation, perhaps with plotting of variables and implied boundraries (that’s why you specify dimensions on the variables instead of units).
    This generalises problems like doing brewing calculations, designing equipment and many of the things people use spreadsheets for.
    A final note about why spreadsheets and programming languages aren’t right for this job. It all has to do with the directionality of equations. Equations go both ways. In fact, a set of equations is like a graph connecting all the variables in it. On spreadsheets and in most programming languages, equations are one-way — a cell can contain a value or a formula, not both. In some constraint programming languages, it’s easier to be declarative, but most of them enforce complete specification and don’t even try to calculate values if the whole problem hasn’t been correctly specified. They also don’t provide direct interaction that allows one to play with the solution.
    Perhaps I’m missing something, but I haven’t found anything like I’ve just described. I really want something like this, so perhaps this should the project that I finally break my GUI programming block on. If you have any information or comments, please pipe up!
  • Mr Fixit

    I am typing this from a 2009 model MacBook Pro, while my wife uses my previous laptop, a PowerBook G4 circa 2002. I loved my PowerBook, but there was a fatal design flaw in the power supply. The cord that came out of it was prone to weakening and breaking off. It failed in 2008, when I did a repair like this one, cutting off the bad bits of wire and soldering the good bits back together. This held out fine for a while, until it broke at a similar place (not where I fixed it before) due to the poorly positioned wire endpoint. I tried to fix it again, but something went wrong and the power supply blew.

    Of course, by this time Apple has moved on. The power supply is still available, but it’s pretty damn expensive (more than R800) and would only be here in two weeks if I ordered it today. So we went out and bought a cheap (R400) universal power adapter and spent some time researching the voltage and polarity of the G4 PowerBook power supply. For those of you wondering, it’s 24V DC with a connector just like a 3.5 mm headphone jack. The tip and sleeve aren’t connected to the power — they’re used for the light ring that indicates the status of the power. The power cord itself is positive on the ring connector and negative on the back connector.
    So, after exhaustive testing to avoid frying my beloved laptop, I had a working power supply again. This is why every home should contain a multimeter and soldering equipment.