Archive for January, 2007

h1

Differentiating Functions in C++

January 21, 2007

Myself and Das Obersturmfuhrer — henceforth known as J — were considering taking on an expression differentiator (in Lisp) recently, in his investigations J found some nice Python to do this and wondered how one might go about it in C[++]. The result of a few minutes experimentation was the following:

#include <iostream>
using namespace std;

class d
{
private:
double (*f)(double);
double h;
public:
d(double (*function)(double)) : f(function), h(0.0001) {;}
double operator()(double arg)
{
return (((*f)(arg+h)-(*f)(arg))/h);
}
};

double square(double arg)
{
return arg*arg;
}

int main()
{
cout << “square(5) = “ << square(5) << endl;
cout << “d(&square)(5) = “ << d(&square)(5)<< endl;
return 0;
}

If some templates were added to the functor d this would allow an open ended solution for differentiating numerical functions (albeit in a pretty crude manner); all the same I was surprised at how elegant the end result looked!

– PostScript —
Jason expounds upon the Lisp implementation:
http://jasonmc.wordpress.com/2007/01/24/fun-with-lisp/

h1

Split in Cabinet over Alliance with Radical Islam.

January 18, 2007
Dublin, Ireland — In a far-reaching coup for Radical Islam, the Irish Taoiseach Bertie Ahern has declared his support for Al-Qaeda — or as he termed them “de lads”. This unprecedented switch of allegiances, and seemingly unconstitutional breach of Irish Neutrality, has sent shock-waves right across the Irish political landscape. With news conferences being hastily convened only one dissident voice was heard from the cabinet — that of Minister for Defence, Willie“You Talking to Me?” O’Dea. Minister O’Dea appealed for calm, and in a uncharacteristically well thought through exchange affirmed his command of the armed forces, and called for an immediate vote of no-confidence in the Taoiseach.
For some time Ireland has been considered a low-risk target for Islamic terrorism, but of late more insidious signals have begun to indicate that the use of Shannon airport by U.S. Forces, as well as Irelands thriving economy and proximity to Britain may lead it to be viewed as a soft target. These worries have grown more concrete in recent times with the much publicised threat to Irish airports made by Islamic cleric Omar Bakri Mohammed in an internet chatroom. In recent years Ireland’s economic boom has bought unprecedented immigration, and along with this tide have come many Muslims eager to avail of the ample employment opportunities available. This process has made many in Ireland wary of immigrant and where their allegiances may lie. Today’s developments can only exacerbate these fears.

More Inside: p.3-p.17; comment: p. 22,23.

h1

Changing Times, Changing Perspectives

January 8, 2007

…Being a Reflection (on Opinions) That Went Awry
In a moment it is night.
I’ll be the first to admit that I like a good argument. I’m interested in Politics, and I think it’s important to hold Political opinions (and equally important to know when to shut up about them). It has always been clear to me, from the time I first started to accumulate Political opinions and sift through them to find my own that there is little point in holding an opinion you’re not willing to change. There are a few reasons for this, probably the most important of which is the possibility that you’re plain and simply wrong. It is a possible to hold an opinion which you’re not sure of, or — by accident or circumstance — to become associated with an idea you don’t truly believe in, and it’s important to know when to abandon a sinking ship. We can often find ourselves debating some point with friends and suddenly realise that the argument is lost, and it’s important to recognise at that point that our opinions might need reconsidering, that — shock, horror —we might be wrong. But there’s another, more subtle process at work changing opinions – the passage of time.

We’re not always aware of the passage of time, and often it seems a year has just slipped by us and out of the room, dripping away steadily until the bucket reaches it’s brim (maybe that’s a bit morbid, well that’s just how it is). All the time our world is changing, our experiences change, and before you take the time to notice: you have changed. I know that in my younger and more vulnerable years (as Gatsby would have it) I held some pretty naive opinions, and time has tempered them into my current world-view. Sometimes it shocks us when we catch a gut reaction which runs against the current of our opinions, like the brief rumble of thunder which precedes a storm that will change our lives. Sometimes this change is a good thing, sometimes we find that within weeks we have retreated with our tail between our legs. The important thing is to remember that, deep as they may be, still waters can stagnate — we should embrace change just as we appreciate stability.

Looking back over this I realise I didn’t end up saying what it started out to say. Maybe that’s a good thing. I started with the idea that this would be a testament to what I think (prompted by a change recently witnessed in someone whose political ideas I have a world-of-time for), instead it’s akin to a death-bed summary of pointless experience. So I apologise for wasting your time, this whole “conversational” blog idea will take a while to ferment.

h1

A Highpoint of Clarity

January 7, 2007

…Being a notification of Contentual and Thematic Change.
They do not move.
Up until now I have refrained from writing about “reality” or “facts”; perhaps I have even been a little aloof. Well no more, inspired by Das Obersturmfuhrer’s wistful reflection, and concomitant with the new year and the vague promises of change it heralds I’m going to start posting some reviews of books, music, films — essentially anything which crosses my path and offers itself for criticism/praise. I may also begin some political/social/moral commentary — only time will tell.