# Analogue Computers

## Analogue Computers

Introduction

Electronic analogue computers come at the end of a chain of development that includes a wide variety of devices such as slide-rules, nomograms, and planimeters. In contrast to these simpler devices, they are more flexible, in that they are not designed for the solution of a single problem, but can be "programmed" to solve many different problems. Also, they include time as an important factor – i.e. they are designed for solving dynamic, rather than static, problems. Before looking at the electronic form, we should mention other methods that have been used.

Suppose we take a vertical cylinder with a small leak at the bottom, and fill it with water. The pressure across the leak will be proportional to the depth of the water, and the rate at which water flows through the leak will be proportional to the pressure. This means that the rate at which water leaks out of the cylinder is proportional to the amount of water present. This is precisely the same behaviour as the decay of a radionuclide (popularly referred to as a "radioactive isotope") – i.e. the rate of decay is proportional to the amount of the nuclide present at any instant. Therefore we can use a leaky cylinder as an "analogue" for the process of radioactive decay. We can do more than that: if the water that leaks out of the cylinder is caught in a second cylinder, then that represents the amount of the decay product accumulating over time. In addition, if this "daughter" nuclide is also radioactive, its decay can be represented by a leak in the second cylinder, and so on. Therefore we have a simple analogue computer for showing the time-variation of the different members of a radioactive decay series.

By using the volume of water to represent money, quite complicated analogues have been constructed for economic models.

Numerical values are represented by physical movement in the slide-rule, but research machines have been designed in which the rotation of a shaft is used. Mathematical functions can be represented by the profile of a cam. Several units can be coupled together with pulleys and belts, and quite complicated problems can be solved. If the linkage is done via cogwheels, then it can be difficult to decide whether we have an analogue or a digital computer.

The type of electronic analogue computer formerly used in research laboratories consisted of a wall-sized panel divided into a large number of rectangular modules, each having a number of sockets and lamps. The sockets were joined up with a tangle of different-coloured leads, and the results appeared as the flashing of the lamps and readings on voltmeters. In more recent machines, the layout of the circuit is much clearer, and very close to the way that the circuit is drawn out on paper. In the 1930s, a machine for doing calculations would have been called a calculator, while the term "computer" meant either a person who did calculations, or an analogue computer. In his stories about robots, Isaac Asimov recognised that they would be controlled by some sort of computer, and he gave them "brains" in the form of analogue computers involving the circulation of electrons and positrons in a sponge-like metallic structure. If instead he had described electrons and holes (i.e. "bubbles" in the sea of electrons) circulating in silicon or germanium, then he would have been even more prophetic. Analogue computers were still of practical importance in the 1960s, and many of the calculations behind the Apollo moon expeditions were carried out on this type of machine.

The decreasing cost of integrated circuits and the wider availability of digital computers have tended to overshadow analogue machines, in parallel with the way in which pocket calculators displaced slide-rules. The techniques underlying analogue computation, however, are still relevant, and we can learn about these by simulating an analogue computer on a digital machine. Analogue signal processing is of continuing interest in all branches of science and engineering. The programming technique known as Neural Networks has also a great similarity to the setting-up of an analogue computer. These notes will describe the properties of a "traditional" analogue computer, and will make additional comments relevant to a digital simulation, which has been constructed to go with this account, plus some problems that can be solved using the simulated machine.

The computer represents dynamically-varying quantities as potentials (voltages), often limited to a range such as –10 to +10 V. It contains components referred to as "passive" (potentiometers) and "active" (summers, integrators and multipliers).

Potentiometers

Each potentiometer has one end at earth potential, while the other end is where the input voltage is applied. The output is taken from a slider, and can vary continuously from zero up to the applied voltage. The simulated computer contains up to 120 potentiometers, each considered to be permanently connected to one of the input terminals of a summer or integrator (see below). The potentiometer values are set by inserting the appropriate factor in the cell provided. In a schematic diagram, a potentiometer is shown as a small circle with two leads, and is represented by the mathematical formula Vout = kVin, where k is the constant of the potentiometer. In a real analogue computer, the allowed range is 0 ≤ k ≤ 1, but in the simulation, any value (positive or negative) will be possible.

## Summers

Figure 1. A summer (left) as constructed from a high-gain amplifier and additional resistors, and (right) as shown in analogue computer layouts.

A summer is a high-gain, high-input-impedance, inverting amplifier, with a particular type of negative-feedback circuit. See Fig. 1. In the early days of analogue computers, the amplifier would be based on thermionic valves ("tubes" in the USA), would have been quite expensive and generated a lot of heat. Now we can use a simple solid-state op-amp. The popular 741 chip only costs a few pence, and would make a working model of a summer (and integrator, see below). For higher accuracy and better high-frequency response, a high quality op-amp with FET input would give a much better performance, approaching that of the early research machines. The most expensive components are likely to be the potentiometers, as these need to be linear multi-turn pots with a dial that can be read to an accuracy of 0.1% full-scale. It is worth pointing out an important limitation of analogue computation. Suppose we have carried out a computation, and we want to improve the accuracy. On a digital machine, we could increase the accuracy by a factor of 10 simply by increasing the word length by about three bits (e.g. from 12 bits to 15 or 16 bits). The extra cost of doing this would be a fairly small percentage. If we want to improve the accuracy of an analogue machine by a similar amount, then the cost goes up by at least a factor of 10, probably much more. Therefore we should accept that analogue computers are going to provide an accuracy of about 1 in 1000, and not expect much better than that.

In Fig.1, R represents a convenient value of resistance, for example 1 kW. (Do not confuse this with the use of R to represent "ohms" on some circuit diagrams.) A number of inputs V1, V2, … can be applied, and the output is Vout. The negative feedback ensures that the output is finite. Since the gain is very large, it follows that the potential at the input of the amplifier itself is very small, and we approximate it by V– = 0. The input impedance is, also, very high, and we make the approximation that the current into the V- input is zero. Summing all the currents flowing into this input, we have:

V1/R + V2/R + … + Vn/(0.1R) + … + Vout/R = 0,

or

-Vout = V1 + V2 + … + 10Vn + … .

The following points should be noted: (a) The output is the negative sum of the inputs. (b) Some of the inputs can have a built-in gain; 10 is a common choice, as in this example. (c) If only one of the unity-gain inputs is used, then the summer reduces to an inverter.

In the simulated computer, it is more convenient to take the default situation to be a positive gain, and to achieve a negative overall result by defining a potentiometer to have a negative value of k. This should reduce the amount of confusion that often arises due to the combination of too many negative signs. Since k can be > 1, there is no advantage in having a 10× input. Also, it is never necessary to use a summer as an inverter, so economising on the use of (virtual) active components.

## Integrators

Figure 2. An integrator (left) as constructed from a high-gain amplifier and additional components, and (right) as shown in analogue computer layouts.

The same basic high-gain amplifier is used as in a summer, but the feedback resistor is replaced by a capacitor C. Again, we assume that V- = 0, and that the total current flowing into the V- input is zero, and obtain the equation:

V1/R + V2/R + … + Vn/(0.1R) + … + C(dVout/dt) = 0,

or

Here IC represents the initial condition, that is, the value of -Vout at time t = 0.

We note the following points: (a) The output is the negative integral of the sum of the inputs. (b) Some inputs can have a built-in gain of 10, for example. (c) The value of IC is also changed in sign at the output. The quantity RC is known as the time constant of the integrator, and is usually chosen to have a value of 1 second (so that the factor 1/RC can be omitted from the above equation). Note that, while a traditional analogue computer inverts the outputs of summers and integrators, the potentiometers are essentially positive. In the component diagram (left section of Fig. 2) the feedback capacitor has to be connected by a switch to a potentiometer that sets the IC. The switch is closed during the IC-setting phase, and opened at "time zero" when the computation begins. When several integrators are present, they must all enter the computation phase together, which means using a multipole switch in which all the contacts open at precisely the same time. This switch is likely to cost more than the integrator itself.

In the simulated computer, all the inputs have a gain of +1, rather than –1, and a value of >1 can be given to a potentiometer, so that a 10× input is not required. Similarly, the initial condition sets the initial value of the output voltage, without any change of sign.

## Multipliers

The multiplication of analogue voltages is quite difficult to achieve with any degree of accuracy, so that multipliers are often regarded as an "optional extra" on a real analogue computer. To get an idea of how complicated analogue multiplication can be, we consider two types of multipliers.

In the "Mark-Space" multiplier, one of the inputs controls a pulse generator running at a high frequency (several kilohertz at least). When this input is at its maximum (one machine unit), then the pulse is permanently "high", and when the input is zero, the pulse is permanently "low". For intermediate values, the length of the "high" phase of the pulse is proportional to the input. For example, if the frequency is 10 kHz and the first input voltage is 0.6 machine units, then the pulse will be high for 60 ms and low for 40 ms. It can be seen that the time-averaged voltage at the output of the pulse generator is equal to the input signal. The other input signal is used to control (by "clipping") the amplitude of the output pulses. Therefore, when the average is obtained by passing the output through a low-pass filter, the value obtained will be the product of the two inputs. This works when both the inputs are positive. To cover all possible cases (a "four quadrant multiplier") is another story. In addition there is a small unavoidable time-delay due to the low-pass filter.

In the "Quarter-Squares" multiplier, the two inputs, say A and B, are combined using summers to produce new signals (A + B) and (A – B). By means of inverters and diodes, the moduli (i.e. absolute values) of these two signals, |A + B| and |A – B|, are found. These then pass into "squaring" circuits. These are special cases of a more general circuit known as a function generator. If we consider a resistor as a simple function generator, and apply a voltage V as an input, then the output can be considered to be the current flowing, I = V/R. This is a simple linear relationship. If the resistor is replaced by a diode, then a non-linear relationship is found – more like an exponential curve. By means of a network of resistors and diodes, we can generate a relationship as near as we like to a quadratic one: I = const.V2, which is the required squaring circuit. Now by applying the signals |A + B| and |A – B| to two separate squaring circuits, and subtracting the outputs, we get a signal proportional to (A + B)2 – (A – B)2 = 4AB. Dividing by 4 gives AB, which is why it gets the name "quarter-squares". This multiplier, thanks to the inclusion of the "modulus" step, works in all four quadrants (i.e. with A positive or negative and B positive or negative).

In the simulation, of course, there is no problem in achieving accurate multiplication, so that we may consider problems that require several multipliers. In the case of multipliers, the input "potentiometers" are assigned a different function. These must be given integer values, and they define the power to which that particular input is raised. E.g. if only one input is used, and the potentiometer value is 2, then the output is the square of that input. Similarly the output can be arranged to be the square of one input multiplied by the cube of another input, etc. This feature is not found on a real analogue computer, where two extra multipliers would need to be used in order to calculate the cube of a variable for example. A zero (or unassigned) value means that the corresponding input is ignored, not that the output is multiplied by zero. [It is however consistent with multiplying by V0 º 1.]

Permitted ranges of variables

In a real analogue computer, it is vital that no voltages are allowed to exceed a limit, usually determined by the amplifier power supplies. For thermionic versions ±100 V was a common choice, and for solid-state versions, ±10 V. In the simulated machine, this is not so important, but if you can ensure that one of the amplifier outputs is limited to the range –1 to +1, then a real-time graph of this output can be drawn in the simulated oscilloscope at the top of the window. This "scaling" can be achieved by adjusting all the ICs and constant inputs to summers and integrators by the same constant factor. (It is slightly more complicated when multipliers are involved.) Conversely, in a real analogue computer, it is essential that voltages should not remain small over a long period of time (passing through zero is unavoidable) otherwise accuracy is lost. In the simulation, this is not important, as the computer can represent numbers down to 10–34 or less, with no loss of accuracy.

Control of the computation sequence

To run a problem, you should first draw its circuit on paper. This will tell you how many summers, integrators and multipliers are required. Remember that multiplying by a constant is done using a potentiometer, not a multiplier. Because of limitation of space in the programming window, a fixed number (10) of active components is allowed, but they can be configured to be summers, integrators, or multipliers, as you require. The first action is therefore to select the number of each type of component. The time of computation should also be entered. Press OK. You will then find that some of the cells provided for the potentiometer values will be enabled, while others will be "greyed out", depending on whether it is permissible to use them. Enter the potentiometer values, and the calculation is then ready to run. To monitor the calculation, select one of the outputs from the active components using the "radio buttons". Then press OK.

The underlying code has been written to try to avoid "crashing" the computer in the case of overflow. If there is something unexpected in the output, then you can change any of the potentiometer values, and try again. What you cannot do at this stage is to replace a summer by an integrator for example; to do that, you have to start again by pressing "Clear and Restart". [If at any stage it is not clear what to do next, press "OK" to get further instructions.]

You can also choose a file that is to be used to save the output (the time variable, and all the outputs from the active components are saved, not only the one that has been selected for output on the screen). If you run the problem, and then select a file, the output will not be saved; you have to run the program again before saving takes place. Typical screen shots (including an example of damped simple harmonic motion) are shown in the Appendix.

## Problems to be Solved

A ramp generator

Figure 3. Circuit for ramp generator

The computer already outputs the time, but by integrating a constant, you can generate another signal that varies linearly with time (and will be able to use this as an ordinary variable if time appears explicitly in a calculation). Configure one of the active components as an integrator and enter a value for the integration time. Then click OK. The integrator will automatically become component number 1. Enter a negative value in its IC box, and a positive value in its "Constant" box. This ensures that the ramp starts negative and increases with time. Choose a sensible time range (e.g. if the values you have entered in the potentiometer boxes are of order 1, then the time range should also be of order 1; if the "constant" potentiometer is 0.01 then a time of 100 would be more suitable). Select the output of component 1 for plotting, and run the problem. Change the values of the potentiometers, and the integration time if necessary, to become familiar with the effects of the IC and "Constant" settings (the combination 0 and 1 gives an output equal to t).

If N is the number of atoms of a radionuclide in a sample, then the equation governing the variation of N is

with initial condition N = N0 at t = 0.

l is called the decay constant, and is related to the half-life t by the equation

lt = ln(2).

Since typical values of N might be 1010 to 1015, this is an example where scaling is rather important. We therefore introduce a scaled (or machine) variable n, defined by n = N/N0. The equations then become

and the circuit for solving the problem is as shown. It may also be necessary to scale the time variable. For example, if the half-life is 10 years, then not much will happen during a computation time of a few seconds! Therefore we may scale 1 unit of the variable t to represent 1 year of real time (this will happen automatically if the half-life is expressed in years). As in the previous problem, one integrator is required, but it now has a positive IC while, instead of having a constant input, the input is a negative constant multiplied by the output of the same integrator. Monitor the output of the integrator, and see how it varies for different l. Record a few graphs of n against t.

Figure 4. Circuit to calculate radioactive decay

A damped vibrating system

A particle of mass m is acted on by a force that pulls it back towards the origin (y = 0) and has a magnitude proportional to the distance y from the origin. This force can therefore be represented by -ky, where k is a constant. Such a force can be generated by a spring which is stretched and compressed as the particle moves, or by a pendulum swinging under gravity (in which the restoring force is proportional to the distance from the bottom of the swing, provided this distance is small). When the mass is displaced from the origin and released, it performs an oscillatory motion known as "simple harmonic motion", and this is represented mathematically by a sine function of time. A sine function extends to infinity but, in practice, the oscillation will gradually die away due to various types of friction. The simplest type to consider is a force proportional to the velocity of the particle and always directed opposite to its direction of motion. This can be represented by -b(dy/dt), where b is a constant. This type of force can be generated by air resistance.

The differential equation for this problem is obtained by writing down Newton’s second law: Force = mass x acceleration, giving

,

with ICs y = y0, dy/dt = 0 at t = 0.

The usual simplification is to write k/m = w2 and b/m = 2S, to get

.

Since there are two differentiations in the problem, we will require two integrators for its solution. Assume that their outputs are y, and dy/dt, or y and  for short. These are connected by the equation

,

and so can appear as the output and input, respectively, of one of the integrators (say No. 2). This integrator also has an initial condition, which gives y0. The original differential equation can be written

.

This may be wired up as an integrator (say No. 1) with an output and two inputs proportional to  and y (obtained by potentiometers with negative values). Normally y will be chosen as the variable to monitor on the screen, but you may also display the variation of .

Figure 5. Circuit for damped SHM

First display the results for y. With the damping-factor potentiometer set to a fairly low value, and w2 and y0 set to fairly high values (~ 1), adjust the integration time so as to get several cycles of oscillation on the screen. Increase the damping-factor potentiometer gradually and observe the damping of the oscillations. Try to establish the condition for critical damping (that is, where the voltage falls to zero as quickly as possible, without overshooting); once you have found it, see whether the value of 2S agrees with theory (S should be equal to w). Plot and save files for a few waveforms to show undamped, slightly damped, critically damped, and heavily damped motion. Record the values of the constants (selected by the potentiometers) on the graphs.

Let y1 represent the amount of a particular radionuclide present at time t and suppose that it decays, at a rate l1, into a second radionuclide. Let y2 be the amount of this present at time t, and let l2 be its rate of decay into a third radionuclide, and so on. The differential equations representing this cascade are:

, with IC y1 = y0 at t = 0,

(stable)

all the other variables having IC = 0 at t = 0.

The simulated computer, having 10 integrators, allows one to investigate a series having a maximum of 10 members.

Introduce the machine variables:

Y1 = y1/y0, Y2 = y2/y0, Y3 = y3/y0, Y4 = y4/y0, … .

This allows the equations to be written in the form:

The circuit for this problem is shown below. Since each potentiometer is associated with a particular input terminal, we have to insert twice as many values as there are decay constants. Set it up for a series of four elements, the first three of which are radioactive, with decay constants 1, 0.2 and 0.5. Save the output and read into Excel, and draw the variation of all four elements on the same graph.

Figure 6. The first three members of a radioactive decay series. If the series ends with a stable nuclide, then the last integrator has no potentiometer or feedback loop.

## Other Problems that can be Solved

Other problems that can be solved

1. A sine-wave can be generated using two integrators (the case of the vibrating system considered earlier, but with the damping process omitted). Two other integrators can then model a vibrating system (including damping) but with no initial condition. Use the sine-wave as an additional driving force for the vibrating system, and investigate the phenomenon of resonance, the transient behaviour at small times, etc.

2. Simulate Schrödinger’s time-independent equation in one dimension, for example for an electron in a parabolic potential well. The basic equation can be written in a suitable system of units so that the physical constants (mass of electron, Planck’s constant, etc.) reduce to a multiplier of ×1:

where y is the wave-function, E is the total energy of the electron and V(x) the potential function – in this example kx2. Note that we use the independent variable in the analogue computer (normally the time t) to represent the space-variable x. Obtain the potential V(x) by integrating a constant twice, so giving a variation proportional to x2. Use a multiplier to multiply the wave function by (E - V(x)) (both of which are varying). The problem therefore requires four integrators and one multiplier. Use ICs y = given at x = 0 to get the even eigenstates, and dy/dx = given at x = 0 to get the odd eigenstates. An acceptable wave-function is obtained by adjusting the potentiometer representing E until the wave-function is constrained within a range of x near the left-hand side of the graph. It will eventually diverge (shoot off to infinity) but the aim is to move this divergence point as far to the right as possible.

Non-linear terms can be introduced into the equation for a vibrating system, for example. In some cases, the behaviour of an oscillator can be stabilised in this way (see the second illustration in the Appendix), but sometimes the behaviour becomes unstable, leading to chaos or overload. Many non-linear effects can be introduced using multipliers.

## Appendix

Appendix

The following picture shows the appearance of the analogue computer screen when it is solving a particular example of damped SHM as described earlier.

In the first stage, two integrators have been selected, and the integration time set to 50 units. In the second stage, the second integrator (i.e. second row of matrix) has been given an input equal to 1 × output of integrator 1, and no initial condition. The first integrator (i.e. top row of matrix) has been given an initial condition of 1, an input equal to –4 × the output of integrator 2 (i.e. w2 = 4) and an input equal to –0.1 × the output of integrator 1 (i.e. 2S = 0.1). It has also been selected as the variable to be displayed in the graphics window. At this stage, we can click OK, and change the values of any of the "potentiometers", including the initial conditions and the time range. We cannot change the assignment of active devices as summers, integrators and multipliers except by clicking "Clear and Restart" (or by quitting the program). If "Save" had been selected, then the values of time and the outputs of both integrators would have been saved in the specified file, ready to be input into Excel.

This illustrates a simulation of van der Pol’s equation, which represents an oscillator circuit having positive feedback for small amplitudes and negative feedback for large amplitudes. The natural frequency of the oscillator is set by potentiometer 2 in the first row, and potentiometer 1 in the second row, and gives w2 = 1. Potentiometer 1 in the first row gives the positive feedback. The negative feedback is obtained by multiplying the output of integrator 1 by the square of the output of integrator 2, using the multiplier (3rd device in the matrix). The differential equation is

with w2 = 1, a = 0.1 and b = 0.5.

C.J.Evans, Dec.2008