Australia Day Honours, 2021

It’s Australia Day again, which means the annual Australia Day honours. Some recipients of note this year in the field of the sciences include:

Congratulations to all four of these outstanding Australians, and to the many others on the list.


For another perspective:


Solar racing teams: the US and Dutch models


Stanford at the finish of the World Solar Challenge in 2015

Everybody knows that I’m a big solar racing fan. Today I wanted to talk about solar car team models, comparing what I call the “US model” (although most other countries also use it) with what I call the “Dutch model” (also used by the Belgian team). In the “US model,” students work part-time on a solar car team, and new members are added each year. As an example of this, I will look at the Stanford Solar Car Project, and specifically at one team member: Rachel Abril, who is forever famous for her May 2014 TEDx talk.

Rachel Abril did a 4-year Bachelor degree in Mechanical Engineering (the blue blocks in the chart below show Stanford’s academic years) followed by a Masters degree. The hashed region on the chart shows her extensive involvement with the Stanford Solar Car Project, first as a junior Mechanical Team and Aerodynamics Team member, and later as Suspension Lead and Aerodynamics Lead. She did not, I believe, attend the 2013 World Solar Challenge, but she did attend the 2015 and 2017 races (Stanford was improving during this period, but so were the other top-twelve teams!).

Rachel Abril’s story highlights one great advantage of the “US model,” namely that long-serving team members develop enormous experience in the design, construction, and racing of solar cars. They can take the lessons of one race, and apply them to the next one (and Rachel’s TEDx talk mentions some lessons that Stanford learned).

There are a number of disadvantages to the “US model,” however. New recruits often have limited knowledge of relevant physics (especially in the US, where high school graduates are educationally about a year behind their European or Australian counterparts). What work can new recruits be given that is both interesting to them and useful to the team? How can they be properly integrated into the team, and feel that they are genuinely part of the group? How can the team stop new recruits from feeling “cheesed-off” and dropping out? Answering these questions well is the key to success for US teams. One of the answers lies in running internal training courses for new recruits (there is also the IEF Solar Car Conference), but teams do not always include “Education Lead” or “New Member Coordinator” as one of the key team roles.

Another disadvantage of the “US model” is that the mix of people with varying lengths of experience creates a power structure. It can be difficult for a new recruit to disagree with someone that has been on the team for many years (even if, objectively, the new recruit is right). This can be a trap.

A final difficulty with the “US model” lies in balancing solar car construction, academic study, and personal life. Conventional wisdom is that you can hope for at most two out of three. Privately, team alumni sometimes suggest that one out of three might be more realistic. I don’t know what support mechanisms might help with this.


Solar Team Twente at the finish of the World Solar Challenge in 2019

In contrast, in the “Dutch model,” a smaller group of people gives up a little over a year of their life to work full-time on a solar car. This is quite a sacrifice. The Belgian team’s recruitment page explains the return on investment for the year like this (my translation):

  1. A project filled with experiences that you won’t find in your regular studies;
  2. Discovering a genuine engineering project and its various phases: concept, design, production,
    and test;
  3. Connecting and collaborating with the largest companies in relevant industries;
  4. A close-knit group and a racing adventure never to be forgotten;
  5. The experience of a lifetime and so much more!

Essentially, the year on the solar car team functions as an unpaid internship (speaking as someone who has helped arrange engineering internships in the past, I can’t think of an internship where you would learn more). One positive feature of industry internships is normally industry networking; this is also worked into the Dutch/Belgian solar car experience (as #3 on that list indicates). Of course, the need to set up those industry connections is one more reason to have a really professional sponsorship team.

As an example of the “Dutch model,” I will focus specifically on the 2018–19 “edition” of Solar Team Twente. Behind this team sits a part-time organisation (mostly of alumni) which handles recruitment and provides technical advice. This organisation began recruiting in February 2018, and a new team was announced on 9 June 2018. All these people were complete solar car novices, of course. The new team began work at the start of the 2018–19 academic year (with the aerodynamic and management subteams starting a little earlier). In the chart below, coloured blocks show academic years, and the hashed region shows the typical duration of full-time team involvement:

One of the first activities of the novice Twente team was to race the previous car, Red Shift, at the European Solar Challenge (iESC) on 21–23 September 2018. Team alumni raced the even older Red One, so that this was not only a training activity for the novice team, but an opportunity for knowledge transfer from alumni. Building on their iESC experience, the novice team then began designing and building their new car, RED E. The new car was revealed on 21 June 2019. After a test race on 17–18 August, the car was shipped to Australia on 30 August (a tragic crash due to wind gusts put RED E out of the race, but it was in the lead when that happened).

Engineering education in the Netherlands is traditionally a 5-year Ingenieur degree. Because of EU regulations, this is nowadays packaged as a 3-year Bachelor degree plus a 2-year Masters, but local students generally take the full package (because of the superior Dutch high school system, the 3-year Bachelor degree reaches at least the same standard as the 4-year US equivalent). As a result, the novice Twente team would have had substantially more formal education under their belts than new solar car recruits in the US. Dutch engineering schools also benefit from a close connection to industry, which drives a practical focus. The Eindhoven University of Technology, for example, is traditionally a feeder school for Philips, DAF Trucks, and other engineering companies in the Eindhoven area.

Of course, not every university teaches every skill needed for solar car design and construction. Dutch engineering schools typically teach agile project management, for example, but this does not seem to be the case in Belgium. The Belgian team therefore arranged industry training on the subject from their sponsor Delaware Consulting. Dutch teams also often benefit from industry-based “team building” activities (this video shows such an activity for Top Dutch). Practice races (including the European Solar Challenge) compensate for the fact that team members have never attended the World Solar Challenge before.

Because of team-building, educational initiatives, and good knowledge management, the “Dutch model” consistently produces top solar cars (Vattenfall/Delft has won the World Solar Challenge repeatedly, the Belgians won in 2019, Twente was on the podium in 2013 and 2015, Top Dutch came 4th in their first race, and Eindhoven has won the Cruiser Class every time). While the “Dutch model” relies partly on specific features of engineering education in the Netherlands and Belgium, I think there are several Dutch/Belgian practices that teams in other countries can learn from.


Nuon (now Vattenfall) at the finish of the World Solar Challenge in 2017

I should finish with a note on Vattenfall (Delft) Solar Team, which runs a variation of the “Dutch model.” Vattenfall (Delft) alternates what I call “big build” teams with “small build” teams. The “big build” teams design and construct new cars for the World Solar Challenge, while the “small build” teams modify existing cars for other events. For example, Nuna9 was a “big build” for the 2017 World Solar Challenge, while Nuna9S was a “small build” modification of the same car for the 2018 South African race (it included a clever radar system). Likewise, Nuna Phoenix was the same car modified again for the 2020 American Solar Challenge (that event was sadly cancelled, but Nuna Phoenix did set a world record). As part of providing a return on investment for the “small build” teams, Vattenfall (Delft) is careful to give these modified cars their own identity.


World Solar Challenge: Technical Innovation

Having discussed the “David Fewchuk Spirit of the Event” Award in the Bridgestone World Solar Challenge, I should say something about the CSIRO Technical Innovation Award as well. After all, technical innovation in sustainable transport is what the Bridgestone World Solar Challenge is really about. I should also note that, in the four races 2013–2019, Punch Powertrain (now Agoria) Solar Team have won the award twice.

2013 – Punch Powertrain (now Agoria) Solar Team

The Belgian car Indupol One finished sixth in 2013. It won the CSIRO Technical Innovation Award for its 3D-printed battery pack, which facilitated cooling of the 429 cells inside (I cannot find a photograph of the pack itself).

2015 – Solar Team Twente

Solar Team Twente won the award in 2015 for their SABINE (Solar Array Balancing Interface Not Expected), an improved MPPT system which handled shadows well (see here for a longer description in Dutch). SABINE helped Twente achieve second place.


Car photo: Anthony Dekker; Inset photo of SABINE: Patrick Ooms

2017 – Punch Powertrain (now Agoria) Solar Team

Punch Powertrain (now Agoria) won the award again in 2017 for their Geneva drive system to activate four-wheel steering. This allowed them to yaw the car during crosswinds, thereby gaining forward momentum by “sailing.” Blogger MostDece posted an illustrated explanation of the design at the time. Ironically, the regulations for 2021 have been altered to rule out such a design in future.

2019 – Kogakuin University Solar Team

Kogakuin finished fifth in 2019, in spite of crashing twice due to strong winds (see their dramatic after-race video here). They won the CSIRO Technical Innovation Award for their hydropneumatic suspension, which allowed height adjustment of the vehicle (see it in action here).

Also in 2019, Top Dutch Solar Racing won the inaugural Excellence in Engineering Award, for their beautifully constructed car (which came fourth):


Life after solar car: een saaie boel?

A while ago, I posted about the fantastic documentary Driven by Challenges, conceived by Liselotte Kockelkoren-Graas (who was also interviewer, co-director, and executive producer) and produced by D2D Media. The six episodes of this documentary (in Dutch with English subtitles) can be accessed via this playlist. They describe the careers of six former members of Solar Team Eindhoven, which has won the World Solar Challenge Cruiser Class four times with its Stella family of solar cars.

I posted about, and recommended, the documentary as a way of encouraging engineering students to become part of solar car racing and to reap the benefits (once again, watch it here). But there is a downside to building the world’s best Cruiser-class solar car. In comparison, entry-level jobs for engineering graduates may be a little boring – what the Dutch call “een saaie boel.” Evita, in the famous musical of the same name, sings:

High flying, adored, what happens now, where do you go from here?
For someone on top of the world, the view is not exactly clear.
A shame you did it all at twenty-six.
There are no mysteries now,
Nothing can thrill you,
No-one fulfil you.
High flying, adored, I hope you come to terms with boredom.
So famous, so easily, so soon, is not the wisest thing to be.

This can be a genuine problem, but the documentary Driven by Challenges shows us three solutions, and that is what I want to talk about today.

The first solution is to leapfrog up the management ladder. This is an option that is primarily available to graduates who combine engineering talent with people skills. The two examples in the documentary are Wouter van Loon (Escalation Project Lead and Strategic Business Planner at ASML) and Liselotte Kockelkoren-Graas herself (Innovation Lead and Senior R&D Engineer at Vanderlande). It is no accident that both these talented engineers filled people-oriented slots on the solar car team (Wouter handled Sponsorship in 2013, and Liselotte was Account Manager in 2015). Leapfrogging up the management ladder can give you all the challenges you might possibly want.

A quite different solution is to go into Research & Development. An engineering company may not give the coolest projects to fresh graduates, but R&D often lets them do exciting stuff from day one. Two solar car alumni in the documentary (André Snoeck, who handled Finance on the 2013 team, and Patrick Deenen, who was Mech. Eng. System Architect on the 2015 team) went on to do doctorates (doing a doctorate is a lot like working on a solar car, except that it lasts longer, and can sometimes be solitary). There is also another category of R&D worth mentioning: military-related R&D is typically done in specialist government agencies. Such agencies offer fresh graduates a chance to build all kinds of interesting prototypes (and you get to say things like “I could tell you the technical details, but then I’d have to kill you”).

The third solution is to go it alone at a startup. So the world doesn’t fully recognise your talents? Join with like-minded people to start your own company. After all, being part of a world-class solar car team is the best possible practice for that. The documentary includes an interview with Arjo van der Ham, who is co-founder and CTO of Lightyear, a startup company building a commercial solar car.

A fourth solution, not covered in the documentary, is to switch career direction, and to start over in a completely different field. That is less common, but it does sometimes happen. After all, having helped build a solar car is excellent training for about a million different things, and engineering is a way of thinking that is helpful in a wide variety of situations.


Driven by Challenges

Solar Team Eindhoven has won the World Solar Challenge Cruiser Class four times with their Stella family of solar cars (see montage of team photos above). The team’s home base, Eindhoven University of Technology (TU/e) is one of the best technical universities in the world (Times Higher Education rated it #64 in 2017, but that really doesn’t do it justice). So what do engineers do after building the world’s best solar family car?

In 2019, Liselotte Kockelkoren-Graas (account manager of the 2015 team) reconnected with five other former members of Solar Team Eindhoven, in a documentary produced by D2D Media. The six episodes of this beautifully filmed documentary (in Dutch with English subtitles) can be accessed via this playlist.

Liselotte and the other highlighted team alumni are working on some of the coolest engineering projects in the world, in some really cool places (see table and montage below). This list says something about the superb teaching that TU/e offers, the high-tech industry hub in which TU/e is located, and the close links that TU/e (wisely) maintains with its industry neighbours.

Who Now at Where
Liselotte Kockelkoren-Graas (2015 team) Innovation Lead / Senior R&D Engineer, Vanderlande Eindhoven area, NL
Arjo van der Ham (2013 team) Co-Founder / CTO, Lightyear Eindhoven area, NL
André Snoeck (2013 team) Researcher, MIT Megacity Logistics Lab Boston area, US
Patrick Deenen (2015 team) Senior Business Process Analyst, Nexperia & PhD student, TU/e Manchester, UK & Eindhoven, NL
Wouter van Loon (2013 team) Escalation Project Lead / Strategic Business Planner, ASML Taipei, TW & Eindhoven area, NL
Jessie Harms (2017 team) Graduate Intern Eindhoven area, NL & Ahmedabad, IN

Among the things I learned from the documentary Driven by Challenges: exciting things happen when your suitcase vanishes down a belt in an airport, and my beard grows at 5 nanometres per second. It was great to see that the careers of Solar Team Eindhoven alumni are progressing many orders of magnitude faster than that.


The Porsche Taycan

IEEE Spectrum has released its Top 10 Tech Cars issue. The most fun car listed is the Porsche Taycan electric vehicle (photos above by Alexander Migl: 1; 2 – click to zoom).

The Taycan uses the 800-volt architecture of the 919, which allows for fast charging and a slight weight reduction. The drag coefficient Cd is in the range 0.22 to 0.25. With 460 kW of power for the Turbo S model, this allows top speeds of 268 km/h or so. There are electric motors on both front and rear axles, four-wheel-steering, and air suspension. You pay for it, though.

Oh, and there are no solar panels.


Gender and Solar Car Teams


Solar Team Twente, led by Irene van den Hof, arrives at the World Solar Challenge 2015 finish line in 2nd place (photo: Anthony Dekker)

As a keen follower of international solar car racing, it’s interesting to explore the so-called “Gender-Equality Paradox” in Science, Technology, Engineering, and Mathematics (see Stoet and Geary, 2018) as it relates to solar car teams – although I realise that this is a controversial subject.

In countries with high gender equality, such as Sweden, female participation in the STEM professions is paradoxically low. In part, this seems to be due to the fact that young women with STEM skills and interests often have other skills and interests as well, and these drive their educational and career choices (and within STEM fields, women appear to preferentially choose medicine over engineering). One can hardly force women to make other choices, though!

Solar car racing is in some ways engineering at its most intense – a difficult challenge requiring a substantial sacrifice of free time (much like an engineering start-up company). In the chart below, I plot the UN Gender Inequality Index for various countries against the average percentage of women in the engineering segment of solar car teams from those countries (I include team leaders in the count, but not dedicated media or public relations personnel). The colour of the dots for each nation indicate whether team leaders are mostly women (pink) or mostly men (blue).

The results are not statistically very significant (p = 0.05 and 0.09 for the two coefficients at the individual team level), but there is an interesting inverted parabolic fit here. For countries with high gender equality (Sweden, Belgium, Germany, and the Netherlands), only about 6.7% of the engineering segment of solar car teams is female. This is compared to 11.3% for other countries. On the other hand, Germany and the Netherlands do have mostly female team leaders.

In part, these results may reflect the fact that when a team attempts to make an optimum assignment of people to roles, the best people to carry out public relations and leadership roles are often the female team members (some people have suggested psychometric reasons for this). In fact, women are exactly twice as likely to be team leaders as you would expect based on the composition of the engineering segment of teams.

Obviously this small-scale study doesn’t settle anything, but it does raise some interesting questions for further investigation. And, of course, it would be fatal to believe that the man or woman building the car’s suspension was doing a more worthwhile job than the man or woman raising the sponsorship money that the team needs to survive. Success requires being good at everything, and that requires a diverse team.

Edit: This analysis may have missed a few women who were not included on team web pages.


In praise of duct tape

It’s a common joke that engineers fix everything with duct tape. I’m happy to say that there’s no truth in that whatsoever.*

Photos: Punch Powertrain Solar Team (iLumen European Solar Challenge 2018), Tshwane University of Technology (Sasol Solar Challenge 2018), Solar Energy Racers (Sasol Solar Challenge 2018), Western Sydney University (World Solar Challenge 2015).

*: not everything.


Ada’s Program



Fragment of the Analytical Engine’s arithmetic/logic unit built by Babbage (photo: Science Museum London) and punched cards for operating it (photo: Karoly Lorentey)

Following on from my post about his Difference Engine, Charles Babbage’s Analytical Engine deserves some discussion. Only small pieces of the Analytical Engine were built. Indeed, Babbage’s ideas were so far ahead of his time that it could not be built with the technology available to him. Babbage was clearly either a true genius – or else he was a time-traveller from the future trying to recreate a modern computer.

It is not quite clear whether Babbage’s Analytical Engine was Turing complete. The kind of abstract computer developed independently by Alan Turing and Emil Post uses an arbitrarily long tape. Even more abstract models of computation use arbitrarily long integers to achieve the same effect. For example, the list (2, 3, 0, 1) can be encoded as the number 582 (1001000110 in binary). Modern computers use a sequence of numbered memory locations, accessed by indexing. The Analytical Engine could not do this. To quote the excellent analysis by Allan G. Bromley, “With hindsight we may note that in the Analytical Engine (at least until 1840) Babbage did not possess the variable-address concept; that is, there was no mechanism by which the machine could, as a result of a calculation, specify a particular variable in the store to be used as the operand for an instruction.


Ada King-Noel, the Countess of Lovelace (1836 portrait by Margaret Sarah Carpenter, cropped)

Babbage was not terribly good at explaining his ideas in writing, unfortunately. The best description is a 13-page summary of of a lecture by Babbage written in French by Luigi Federico Menabrea (later Prime Minister of Italy). This was translated into English in 1843 by Augusta Ada King-Noel (née Byron), the Countess of Lovelace.

Ada added 36 pages of detailed notes of her own. These include several insightful comments regarding the philosophy of computing, such as: “Again, it might act upon other things besides number, were objects found whose mutual fundamental relations could be expressed by those of the abstract science of operations, and which should be also susceptible of adaptations to the action of the operating notation and mechanism of the engine. Supposing, for instance, that the fundamental relations of pitched sounds in the science of harmony and of musical composition were susceptible of such expression and adaptations, the engine might compose elaborate and scientific pieces of music of any degree of complexity or extent. The Analytical Engine is an embodying of the science of operations, constructed with peculiar reference to abstract number as the subject of those operations.” (from Note A).

Also: “The Analytical Engine has no pretensions whatever to originate anything. It can do whatever we know how to order it to perform.” (from Note G).


The diagram from Note G, which shows what is essentially a computer program

Ada is sometimes described as the “first computer programmer,” based on the material in her Note G. This is clearly incorrect, since Charles Babbage had written several dozen programs for the Analytical Engine before 1840. Perhaps “first computer scientist” would be a better title. The program described in Ada’s Note G computes Bernoulli numbers. It does so using the fact that each Bernoulli number can be computed from its predecessors via the relationship:

0 = A0 + A1B1 + A3B3 + A5B5 + … + B2n−1

Here each Ai can be calculated as follows:

a <- function (n, i) {
	if (i == 0) -0.5 * (2*n - 1) / (2*n + 1)
	else if (i == 1) n
	else a(n, i-2) * (2*n + 2 - i) * (2*n + 1 - i) / (i * (i + 1))
}

Bromley notes that “the ‘user instruction set’ of the Analytical Engine seems nowhere to be clearly stated,” which makes it a little difficult to extract an actual program from Ada’s material. After fixing three small bugs, here is something that actually works (in the language R, and all done using numbered registers):

ada <- function (n.max) {
	b <- rep(0, n.max)  # result registers
	v <- c(1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)  # other registers
	
	while (v[3] <= n.max) {  # how is this loop done in the Analytical Engine?
		v[4] <- v[5] <- v[6] <- v[2] * v[3]
		v[4] <- v[4] - v[1]  # v[1] is always 1
		v[5] <- v[5] + v[1]
		v[11] <- v[4] / v[5]  # accidentally reversed in Ada’s diagram
		v[11] <- v[11] / v[2]  # v[2] is always 2
		v[13] <- v[13] - v[11]
		v[10] <- v[3] - v[1]
		
		if (v[10] > 0) {  # how is this conditional execution done in the Analytical Engine?
			v[7] <- v[2] + v[7]
			v[11] <- v[6] / v[7]
			v[12] <- b[1] * v[11]
			v[13] <- v[12] + v[13]
			v[10] <- v[10] - v[1]
		}

		while(v[10] > 0) {  # how is this loop done in the Analytical Engine?
			v[6] <- v[6] - v[1]
			v[7] <- v[1] + v[7]
			v[8] <- v[6] / v[7]
			v[11] <- v[8] * v[11]
			v[6] <- v[6] - v[1]
			v[7] <- v[1] + v[7]
			v[9] <- v[6] / v[7]
			v[11] <- v[9] * v[11]
			
			i <- v[3] - v[10]   # how is this indexing done in the Analytical Engine?
			v[12] <- b[i] * v[11]
			v[13] <- v[12] + v[13]
			v[10] <- v[10] - v[1]
		}

		n <- v[3]  # how is this indexing done in the Analytical Engine?
		b[n] <- b[n] - v[13]  # another apparent error in Ada's table at line 14 (negation is needed)

		v[3] <- v[1] + v[3]
		v[7] <- 0   # reset the register with a “variable card”
		v[13] <- 0  # a third apparent error in Ada's table (v[13] needs to be reset, not v[6])
	}
	b
}

There are a number of questions about this. First, I am assuming that all registers are read non-destructively (Ada’s notes indicate that read-and-clear is also possible). Second, the results stored in b require indexing, which the Analytical Engine could not do. Third, Ada writes that “Operation 7 must either bring out a result equal to zero (if n = 1); or a result greater than zero, as in the present case; and the engine follows the one or the other of the two courses just explained, contingently on the one or the other result of Operation 7.” This implies that some kind of conditional branching was possible. But how?

A simple response is simply to “unroll” the loops, breaking the program down into instructions of just three kinds:

  • Set 1 567: place the number 567 in register #1
  • Do 2 + 3: add the contents of register #2 to the content of register #3 (and similarly for −, ×, and ÷)
  • Store 4: store a previously computed result in register #4

The following, rather lengthy, version of the program correctly computes the first three Bernoulli numbers:

Set 1 1, Set 2 2, Set 3 1

# First Bernoulli number
Do 2 * 3, Store 4, Store 5, Store 6
Do 4 - 1, Store 4
Do 5 + 1, Store 5
Do 4 / 5, Store 11
Do 11 / 2, Store 11
Do 13 - 11, Store 13
Do 3 - 1, Store 10

Do 1 + 3, Store 3
Do 21 - 13, Store 21,  # 21 done
Set 7 0, Set 13 0

# Second Bernoulli number
Do 2 * 3, Store 4, Store 5, Store 6
Do 4 - 1, Store 4
Do 5 + 1, Store 5
Do 4 / 5, Store 11
Do 11 / 2, Store 11
Do 13 - 11, Store 13
Do 3 - 1, Store 10

Do 2 + 7, Store 7
Do 6 / 7, Store 11
Do 21 * 11, Store 12,  # use 21
Do 12 + 13, Store 13
Do 10 - 1, Store 10

Do 1 + 3, Store 3
Do 22 - 13, Store 22,  # 22 done
Set 7 0, Set 13 0

# Third Bernoulli number
Do 2 * 3, Store 4, Store 5, Store 6
Do 4 - 1, Store 4
Do 5 + 1, Store 5
Do 4 / 5, Store 11
Do 11 / 2, Store 11
Do 13 - 11, Store 13
Do 3 - 1, Store 10

Do 2 + 7, Store 7
Do 6 / 7, Store 11
Do 21 * 11, Store 12,  # use 21
Do 12 + 13, Store 13
Do 10 - 1, Store 10

# Inner loop
Do 6 - 1, Store 6
Do 1 + 7, Store 7
Do 6 / 7, Store 8
Do 8 * 11, Store 11
Do 6 - 1, Store 6
Do 1 + 7, Store 7
Do 6 / 7, Store 9
Do 9 * 11, Store 11
Do 22 * 11, Store 12,  # use 22
Do 12 + 13, Store 13
Do 10 - 1, Store 10

Do 1 + 3, Store 3
Do 23 - 13, Store 23,  # 23 done
Set 7 0, Set 13 0

Can we do better than that? Bromley notes that “the mechanism by which the sequencing of operations is obtained is obscure.” Furthermore, driven by what was probably a correct intuition about code/data separation, Babbage separated operation and variable cards, and this would have played havoc with control flow (Bromley again: “I am not convinced that Babbage had clearly resolved even the representational difficulties that his separation of operation and variable cards implies”).

I’m resolving those issues by straying into what Babbage might have done had he seen the need. In particular:

  • I assume a conditional jump mechanism, with Ifzero 1 goto A jumping (somehow) to Label A if register #1 is zero (if operation and variable cards are reunited, this can be easily done by moving forward or back the required number of cards)
  • I assume an additional category of card, with its own card queue, with each such card specifying an output register, and with the operations:
    • Q (in Do, Store, Set, or Ifzero): access the register specified by the next card in the card queue
    • ResetQ: wind back the card queue to the start
    • StopifemptyQ: stop if all the cards in the card queue have been read

Yes, that’s all very speculative – but something like that is needed to make Ada’s loops work. In addition, the card queue (plus the associated output registers) performs the role of the tape in Turing/Post machines, or the memory in modern computers. Something like it is therefore needed.

And here is Ada’s program in that modified form. It works, loops and all! I tested it for the first 12 Bernoulli numbers, which are 0.1666667, −0.03333333, 0.02380952
−0.03333333, 0.07575758, −0.2531136, 1.166667, −7.092157, 54.97118, −529.1242, 6192.123, and −86580.25 (numerical errors do accumulate as the sequence is continued).

Set 1 1, Set 2 2, Set 3 1

Label A

Do 2 * 3, Store 4, Store 5, Store 6
Do 4 - 1, Store 4
Do 5 + 1, Store 5
Do 4 / 5, Store 11
Do 11 / 2, Store 11
Do 13 - 11, Store 13
Do 3 - 1, Store 10

Ifzero 10 goto B
Do 2 + 7, Store 7
Do 6 / 7, Store 11
Do Q * 11, Store 12  # Using 21
Do 12 + 13, Store 13
Do 10 - 1, Store 10

Label B

# Inner loop
Ifzero 10 goto C
Do 6 - 1, Store 6
Do 1 + 7, Store 7
Do 6 / 7, Store 8
Do 8 * 11, Store 11
Do 6 - 1, Store 6
Do 1 + 7, Store 7
Do 6 / 7, Store 9
Do 9 * 11, Store 11
Do Q * 11, Store 12  # Using 22, etc.
Do 12 + 13, Store 13
Do 10 - 1, Store 10
Ifzero 14 goto B  # Unconditional jump

Label C

Do 1 + 3, Store 3
Do 14 - 13, Store Q  # Using register 14 as constant zero
StopifemptyQ

Set 7 0, Set 13 0, ResetQ
Ifzero 14 goto A  # Unconditional jump

And for those interested, here is an emulator (in R) which will read and execute that program. For a slightly different approach, see the online emulator here.

read.program <- function (f) {
	p <- readLines(f)
	p <- gsub(" *#.*$", "", p)  # remove comments
	p <- gsub(" *, *", ",", p)  # remove spaces after commas
	p <- p[p != ""]  # remove blank lines
	p <- paste0(p, collapse=",")  # join up lines
	p <- gsub(",+", ",", p)  # remove duplicate commas
	strsplit(p, ",")[[1]]  # split by commas
}

do.op <- function (x, op, y) {
	if (op == "+") x + y
	else if (op == "-") x - y
	else if (op == "*") x * y
	else if (op == "/") x / y
	else stop(paste0("Bad op: ", op))
}

emulate <- function(program, maxreg) {
	set.inst <- "^Set (Q|[0-9]*) (Q|[0-9]*)$"
	store.inst <- "^Store (Q|[0-9]*)$"
	do.inst <- "^Do (Q|[0-9]*) ([^ ]) (Q|[0-9]*)$"
	label.inst <- "^Label ([0-9A-Za-z]*)$"
	ifzero.inst <- "^Ifzero ([0-9]*) goto ([0-9A-Za-z]*)$"

	v <- rep(0, maxreg)
	op.result <- 0
	stopping <- FALSE
	pc <- 1
	queue <- 21:maxreg
	qptr <- 1
	
	while (pc <= length(program) && ! stopping) {
		p <- program[pc]
		if (grepl(set.inst, p)) {
			i <- gsub(set.inst, "\\1", p)
			j <- as.numeric(gsub(set.inst, "\\2", p))
			if (i == "Q") {
				i <- queue[qptr];
				qptr <- qptr + 1
			} else i <- as.numeric(i)
			v[i] <- j

		} else if (grepl(do.inst, p)) {
			i <- gsub(do.inst, "\\1", p)
			op <- gsub(do.inst, "\\2", p)
			j <- gsub(do.inst, "\\3", p)
			if (i == "Q") {
				i <- queue[qptr];
				qptr <- qptr + 1
			} else i <- as.numeric(i)
			if (j == "Q") {
				j <- queue[qptr];
				qptr <- qptr + 1
			} else j <- as.numeric(j)
			op.result <- do.op(v[i], op, v[j])

		} else if (grepl(store.inst, p)) {
			i <- gsub(store.inst, "\\1", p)
			if (i == "Q") {
				i <- queue[qptr];
				qptr <- qptr + 1
			} else i <- as.numeric(i)
			v[i] <- op.result

		} else if (grepl(ifzero.inst, p)) {
			i <- gsub(ifzero.inst, "\\1", p)
			if (i == "Q") {
				i <- queue[qptr];
				qptr <- qptr + 1
			} else i <- as.numeric(i)
			dest <- gsub(ifzero.inst, "\\2", p)
			j <- which(program == paste0("Label ", dest))
			if (v[i] == 0) pc <- j

		} else if (p == "StopifemptyQ") {
			if (qptr > length(queue)) stopping <- TRUE

		} else if (grepl(label.inst, p)) {
			# do nothing
			
		} else if (p == "ResetQ") {
			qptr <- 1
			
		} else stop(paste0("Bad instruction: ", p))
		pc <- pc + 1
	}
	v
}

emulate(program = read.program("ada.program.txt"), maxreg = 32)

Update: If we take Ada’s program as specifying implicit zeroing of unused registers, we get this slightly fancier version (which also works):

Set 1 1, Set 2 2, Set 3 1

Label A

Do 2 * 3, Store 4, Store 5, Store 6
Do 4 - 1, Store 4
Do 5 + 1, Store 5
Do 4 / 5 clearing 4 and 5
Store 11
Do 11 / 2, Store 11
Do 13 - 11 clearing 11
Store 13
Do 3 - 1, Store 10

Ifzero 10 goto B

Do 2 + 7, Store 7
Do 6 / 7, Store 11
Do Q * 11, Store 12  # Using 21
Do 12 + 13 clearing 12
Store 13
Do 10 - 1, Store 10

Label B

Ifzero 10 goto C  # Inner loop test

Do 6 - 1, Store 6
Do 1 + 7, Store 7
Do 6 / 7, Store 8
Do 8 * 11 clearing 8
Store 11
Do 6 - 1, Store 6
Do 1 + 7, Store 7
Do 6 / 7, Store 9
Do 9 * 11 clearing 9
Store 11
Do Q * 11, Store 12  # Using 22, etc.
Do 12 + 13 clearing 12
Store 13
Do 10 - 1, Store 10
Goto B  # End of inner loop

Label C

Do 1 + 3, Store 3
Do 14 - 13 clearing 13
Store Q  # Using register 14 as constant zero
StopifemptyQ

Set 6 0, Set 7 0, Set 11 0, ResetQ
Goto A

Did the Difference Engine make a difference?

I have been reading a few steampunk novels lately – I have a great fondness for the genre. Charles Babbage’s planned “Difference Engine” and “Analytical Engine” always play a large part in the fictional universe of such books. However, as Francis Spufford has pointed out, this does rely on some counterfactual history.


Reconstructed “Difference Engine No. 2” in the Science Museum, London (photo: “Geni”)

Babbage never completed any of his major devices, although redesigned working difference engines were built by Per Georg Scheutz (1843), Martin Wiberg (1859), and George B. Grant (1876). With much fanfare, the Science Museum, London reconstructed Babbage’s “Difference Engine No. 2” between 1985 and 2002, making only essential fixes to the original design – and it works! However, the pinnacle of this kind of technology was probably the beautiful handheld Curta calculator, produced in Liechtenstein by Curt Herzstark from 1947.

The world’s first programmable digital computer was in fact built four years before the Curta, in 1943, by English electrical engineer Tommy Flowers. The wartime secrecy associated with his work has kept this monumental achievement largely in the dark.


Colossus in action at Bletchley Park in 1943 (photo: National Archives)

The significance of the Colossus has also been obscured by a kind of “personality cult” built up around Alan Turing, much like the one built up around Babbage. Turing was one of a number of people who contributed to the design of the cryptographic “Bombe” at Bletchley Park, and Turing also did important theoretical work – although the fundamental result in Turing’s 1936 paper, “On Computable Numbers, with an Application to the Entscheidungsproblem” was not actually new, as is revealed on the second page of Turing’s paper, where Turing admits “In a recent paper Alonzo Church has introduced an idea of ‘effective calculability,’ which is equivalent to my ‘computability,’ but is very differently defined. Church also reaches similar conclusions about the Entscheidungsproblem . The proof of equivalence between ‘computability’ and ‘effective calculability’ is outlined in an appendix to the present paper.

Turing’s life was more colourful than either Church’s or Flowers’s, however, and this may be why he is far more famous. In a similar way, Babage lived a more colourful life than many of his contemporaries, including his collaboration with the forward-thinking Countess of Lovelace.


1: Charles Babbage, 2: Augusta Ada King-Noel (née Byron, Countess of Lovelace), 3: Alonzo Church, 4: Alan Turing, 5: Tommy Flowers

The chart below (click to zoom) puts the work of Babbage and Flowers in a historical context. Various devices are ranked according to their computational power in decimal digits calculated per second (from 1 up to 1,000,000,000,000,000). Because this varies so dramatically, a logarithmic vertical scale is used. The Colossus marks the beginning of a chain of “supercomputers,” often built for government use, with power doubling every 1.84 years (pink line). Starting with the Intel 4004 in 1971, there is also a chain of silicon chips, with power doubling every 1.74 years (blue line). At any given point in time, supercomputers are between 1,000 and 3,000 times more powerful than the chips, but the chips always catch up around 20 years later. The revolutionary PDP-8 of 1965 sits between the two chains.

One of the things that stand out on this chart is the gap between Babbage’s Difference Engine and the later digital computers – even the Colossus was around 280 times more powerful than the Difference Engine (carrying out a simpler task much more quickly). Steampunk fiction often suggests that steam power would have made the Difference Engine faster. However, it turns out that the mechanism jams if it is cranked too quickly. Complex mechanical calculating devices simply cannot operate that fast.


Morse telegraph key (photo: Hp.Baumeler)

In fact, Charles Babbage may actually have distracted people from the way forward. Samuel Morse’s improved telegraph was officially operational in 1844. It used electromechanical principles that were also used in the Colossus a century later. Electricity also has the advantage of travelling at the speed of light, along wires that can be made extremely thin. What might the world have been like had electromechanical computing developed earlier? The chart also shows the 1964 fluidic computer FLODAC. This was a fascinating idea that was abandoned after a successful proof of concept (although a 1975 film portrayed it as the future). What if that idea had been launched in Victorian Britain?