Calcium: a simple calculator for infix and rpn expressions.

Just a quick update on a small side project that I recently completed.

It started out as a test driven development code kata which involved implementing the classic shunting-yard algorithm by Edsger Dijkstra as well as a basic RPN evaluator. Additions to the basic algorithms includes support for named variables, a constants, and conversion of infix expressions to rpn.

The end result is a simple calculator for the windows desktop, written in WPF/C# for the .NET 4 platform, which allows you to input complete mathematical expressions in either infix or postfix (rpn) notation. It is designed to be easy to use by minimizing the use of settings and mode toggles. It will for example automatically detect if what you have entered is in infix or postfix notation.

Calcium

Calcium, a simple infix and rpn calculator.

As with all my utility side project the main goal was to create something that I would like to use myself. I have annoyed myself at the built in desktop calculator for some time while other more able calculators I have tried have seemed like overkill for my needs.

The unit tests written during development have been a real boon in that every time an error was discovered I would just add the offending expression to the tests and work through the code until the problem was resolved. Re-running all the tests then verifies that nothing else was broken in the process. This would have been a much more laborious and error prone process had the test scaffolding not been in place. Examples such as this just reaffirms my
conviction that unit tests are indispensible for maintaining code quality and correctness.

Note: As is always the case with experimental software such as this I give no guarantee that it will always perform correctly (so please don’t use it for anything critical).

If you discover that the calculator returns something unexpected or plain wrong then don’t hesitate to leave me a comment to tell me about it.

If you are interested in trying it out you can download it here: Calcium 1.0.1.0

Amazing video of simulated galaxy formation

Wired UK recently ran a very interesting article about moving mesh cosmology. In a recent simulation of galaxy formation, billions of points of mass slowly acreate to form stars and galaxies, continuing their cosmic dance for some 14 billion simulated years. The software used to create this marvel is called Arepo (created by Dr. Volker Springel) and utilizes Voronoi tesselation.

One end result is the truly stunning animation below (the animation covers a “mere” 9 billion years).

Curiosity has landed!

I have to say I’m impressed. When I first saw the landing procedure intended for the lander Curiosity headed for Gale crater on Mars I was a bit skeptical. The extremely complicated landing sequence employed for the Curiosity mission seemed like asking for trouble, given that Nasa has a bit of a spotty record when it comes to delivering hardware to Mars.

Curiosity lander.

The curiosity lander was to be lowered to the surface of mars on wires suspended from a delivery vehicle autonomously balancing on thrusters. Some may remember the Mars Climate Orbiter Metric vs. English unit mixup so a bit of scepticism didn’t seem to be misplaced. The more points of potential failure you add would seem to increase the odds of something unforeseen ruining the party.

As it turned out the landing went of without a hitch. Big kudos to everyone involved in this project who accomplished something truly amazing.