# Z3 (computer)

The Z3 was a German electromechanical computer designed by Konrad Zuse in 1938, and completed in 1941. It was the world's first working programmable, fully automatic digital computer. The Z3 was built with 2,600 relays, implementing a 22-bit word length that operated at a clock frequency of about 5–10 Hz. Program code was stored on punched film. Initial values were entered manually.$^{:32–37}$
The Z3 was completed in Berlin in 1941. It was not considered vital, so it was never put into everyday operation.$^{:30,38–39}$ Based on the work of the German aerodynamics engineer Hans Georg Küssner (known for the Küssner effect), a "Program to Compute a Complex Matrix" was written and used to solve wing flutter problems. Zuse asked the German government for funding to replace the relays with fully electronic switches, but funding was denied during World War II since such development was deemed "not war-important".$^{:148}$
The original Z3 was destroyed on 21 December 1943 during an Allied bombardment of Berlin. That Z3 was originally called V3 (Versuchsmodell 3 or Experimental Model 3) but was renamed so that it would not be confused with Germany's V-weapons. A fully functioning replica was built in 1961 by Zuse's company, Zuse KG, which is now on permanent display at Deutsches Museum in Munich.$^{:30}$
The Z3 was demonstrated in 1998 to be, in principle, Turing-complete. However, because it lacked conditional branching, the Z3 only meets this definition by speculatively computing all possible outcomes of a calculation.
Thanks to this machine and its predecessors, Konrad Zuse has often been suggested as the inventor of the computer.

## Design and development

Zuse designed the Z1 in 1935 to 1936 and built it from 1936 to 1938. The Z1 was wholly mechanical and only worked for a few minutes at a time at most. Helmut Schreyer advised Zuse to use a different technology. As a doctoral student at the Technische Hochschule in Charlottenburg (now Technische Universität Berlin) in 1937 he worked on the implementation of Boolean operations and (in today's terminology) flip-flops on the basis of vacuum tubes. In 1938, Schreyer demonstrated a circuit on this basis to a small audience, and explained his vision of an electronic computing machine – but since the largest operational electronic devices contained far fewer tubes this was considered practically infeasible. In that year when presenting the plan for a computer with 2,000 electron tubes, Zuse and Schreyer, who was an assistant at Wilhelm Stäblein's [de] Telecommunication Institute at Technische Universität Berlin, were discouraged by members of the institute who knew about the problems with electron tube technology.$^{:113,152}$ Zuse later recalled: "They smiled at us in 1939, when we wanted to build electronic machines ... We said: The electronic machine is great, but first the components have to be developed."$^{:102}$ In 1940, Zuse and Schreyer managed to arrange a meeting at the Oberkommando der Wehrmacht (OKW) to discuss a potential project for developing an electronic computer, but when they estimated a duration of two or three years, the proposal was rejected.$^{:115}$
Zuse decided to implement the next design based on relays. The realization of the Z2 was helped financially by Kurt Pannke, who manufactured small calculating machines. The Z2 was completed and presented to an audience of the Deutsche Versuchsanstalt für Luftfahrt ("German Laboratory for Aviation") in 1940 in Berlin-Adlershof. Zuse was lucky – this presentation was one of the few instances where the Z2 actually worked and could convince the DVL to partly finance the next design.
In 1941, improving on the basic Z2 machine, he built the Z3 in a highly secret project of the German government. Joseph Jennissen (1905–1977), member of the "Research-Leadership" (Forschungsführung) in the Reich Air Ministry acted as a government supervisor for orders of the ministry to Zuse's company ZUSE Apparatebau. A further intermediary between Zuse and the Reich Air Ministry was the aerodynamicist Herbert A. Wagner.
The Z3 was completed in 1941 and was faster and far more reliable than the Z1 and Z2. The Z3 floating-point arithmetic was improved over that of the Z1 in that it implemented exception handling "using just a few relays", the exceptional values (plus infinity, minus infinity and undefined) could be generated and passed through operations. It further added a square root instruction.
The Z3, like its predecessors, stored its program on an external punched tape, thus no rewiring was necessary to change programs. However, it did not have conditional branching found in later universal computers.$^{:7}$
On 12 May 1941, the Z3 was presented to an audience of scientists including the professors Alfred Teichmann and Curt Schmieden of the Deutsche Versuchsanstalt für Luftfahrt ("German Laboratory for Aviation") in Berlin, today known as the German Aerospace Center in Cologne.
Zuse moved on to the Z4 design, which he completed in a bunker in the Harz mountains, alongside Wernher von Braun's ballistic missile development. When World War II ended, Zuse retreated to Hinterstein in the Alps with the Z4, where he remained for several years.

## Instruction set

The Z3 operated as a stack machine with a stack of two registers, R1 and R2. The first load operation in a program would load the contents of a memory location into R1; the next load operation would load the contents of a memory location into R2. Arithmetic instructions would operate on the contents of R1 and R2, leaving the result in R1, and clearing R2; the next load operation would load into R2. A store operation would store the contents of R1 into a memory location, and clear R1; the next load operation would load the contents of a memory location into R1.$^{:8}$
A read keyboard operation would read a number from the keyboard into R1 and clear R2. A display instruction would display the contents of R1 and clear R2; the next load instruction would load into R2.$^{:8}$

## Z3 as a universal Turing machine

It was possible to construct loops on the Z3, but there was no conditional branch instruction. Nevertheless, the Z3 was Turing-complete – how to implement a universal Turing machine on the Z3 was shown in 1998 by Raúl Rojas. He proposed that the tape program would have to be long enough to execute every possible path through both sides of every branch. It would compute all possible answers, but the unneeded results would be canceled out (a kind of speculative execution). Rojas concludes, "We can therefore say that, from an abstract theoretical perspective, the computing model of the Z3 is equivalent to the computing model of today's computers. From a practical perspective, and in the way the Z3 was really programmed, it was not equivalent to modern computers."
This seeming limitation belies the fact that the Z3 provided a practical instruction set for the typical engineering applications of the 1940s. Mindful of the existing hardware restrictions, Zuse's main goal at the time was to have a workable device to facilitate his work as a civil engineer.

## Relation to other work

The success of Zuse's Z3 is often attributed to its use of the simple binary system.$^{:21}$ This was invented roughly three centuries earlier by Gottfried Leibniz; Boole later used it to develop his Boolean algebra. Zuse was inspired by Hilbert's and Ackermann's book on elementary mathematical logic Principles of Mathematical Logic.$^{:113,152}$ In 1937, Claude Shannon introduced the idea of mapping Boolean algebra onto electronic relays in a seminal work on digital circuit design. Zuse, however, did not know of Shannon's work and developed the groundwork independently$^{:149}$ for his first computer Z1, which he designed and built from 1935 to 1938.
Zuse's coworker Helmut Schreyer built an electronic digital experimental model of a computer using 100 vacuum tubes in 1942, but it was lost at the end of the war.
An analog computer was built by the rocket scientist Helmut Hölzer in 1942 at the Peenemünde Army Research Center to simulate V-2 rocket trajectories.
The Colossus (1943), built by Tommy Flowers, and the Atanasoff–Berry computer (1942) used thermionic valves (vacuum tubes) and binary representation of numbers. Programming was by means of re-plugging patch panels and setting switches.
The ENIAC computer, completed after the war, used vacuum tubes to implement switches and used decimal representation for numbers. Until 1948 programming was, as with Colossus, by patch leads and switches.
The Manchester Baby of 1948 along with the Manchester Mark 1 and EDSAC both of 1949 were the world's earliest working computers that stored program instructions and data in the same space. In this they implemented the stored-program concept which is frequently (but erroneously) attributed to a 1945 paper by John von Neumann and colleagues. Von Neumann is said to have given due credit to Alan Turing, and the concept had actually been mentioned earlier by Konrad Zuse himself, in a 1936 patent application (that was rejected). Konrad Zuse himself remembered in his memoirs: "During the war it would have barely been possible to build efficient stored program devices anyway." Friedrich L. Bauer later wrote: "His visionary ideas (live programs) which were only to be published years afterwards aimed at the right practical direction but were never implemented by him."

## Specifications

* Average calculation speed: addition – 0.8 seconds, multiplication – 3 seconds
* Arithmetic unit: Binary floating-point, 22-bit, add, subtract, multiply, divide, square root
* Data memory: 64 22-bit words
* Program memory: Punched celluloid tape
* Input: Decimal floating-point numbers
* Output: Decimal floating-point numbers
* Input and Output was facilitated by a terminal, with a special keyboard for input and a row of lamps to show results
* Elements: Around 2,000 relays (1,400 for the memory)
* Frequency: 5–10 hertz
* Power consumption: Around 4,000 watts
* Weight: Around 1 tonne (2,200 lb)

## Modern reconstructions

A modern reconstruction directed by Raúl Rojas and Horst Zuse started in 1997 and finished in 2003. It is now in the Konrad Zuse Museum in Hünfeld, Germany. Memory was halved to 32 words. Power consumption is about 400 W, and weight is about 30 kilograms (66 lb).
In 2008, Horst Zuse started a reconstruction of the Z3 by himself. It was presented in 2010 in the Konrad Zuse Museum in Hünfeld.