An introduction to Analog Computing: Approximating π

Abstract

Digital computation is very often presented as the only way of processing information. But this framing is historically and technically narrow.

Notes

This guide assumes the user is familiar with basic OpAmp circuits and basic electronics.

Part 1: The Plan

Our goal is to approximate π without embedding it directly into component values. What we can instead do is compute it from a geometric integral.

The idea is to generate the function:

The reason for choosing this specific function becomes clear when we interpret it geometrically: it represents the upper half of a unit circle centered at the origin.

We then integrate this function over the interval from 0 to 1, which corresponds to a quarter of the unit circle.

Formally, the relationship is:

Part 2: Required Circuits

To turn the mathematical idea into an actual analog system, you need a small set of functional blocks that together approximate the integral.

First, we must find a way to generate the input variable over time. This is typically done with a ramp generator. The output is a voltage that sweeps linearly from 0 to 1.

Next, we construct the function:

This part is nontrivial. And oh man, I really do mean nontrivial. It requires breaking the function into stages:

  1. Compute
  2. Subtract it from 1 to form
  3. Apply a square root approximation

Each of these steps requires a corresponding analog building block like multipliers, summing amplifiers and function approximators.

Once we produce the signal that represents , we will feed it into an integrator circuit. The integrator accumulates the area under the curve as sweeps from 0 to 1.

Finally, the output is scaled by a factor of 4 to recover the full constant:

This is how we approximate .

We will now design:

  1. A ramp generator that produces a voltage sweeping from 0 to 1.

  2. A squaring stage that computes , implemented using an analog multiplier or an equivalent nonlinear circuit.

  3. A summing amplifier that forms using a fixed reference voltage and the squared signal.

  4. A nonlinear approximation block that implements:

  1. An op-amp integrator that accumulates the input signal over the interval, producing:

  1. A final gain stage with gain 4 to produce:

Part 3: Ramp Generator

A ramp generator is a circuit that creates a linear rising or falling output with respect to time. We will use this ramp generator to produce a voltage that sweeps from 0 to 1.

Although not accurate and definitely not ideal, for the purposes of this tutorial we will be using the simplest ramp generator design possible: a Resistor and a capacitor.

Any and values will do here since the output will be between 0 and 1 at any point in time, but it shall not be fixed. This is what we want.

Part 4: Squaring Stage

In this stage, we feed the ramp output into an analog multiplier configured in a self-multiplication setup. The multiplier computes the product of the signal with itself, producing a voltage proportional to:

Part 5: Subtraction Stage

In this stage, we construct the signal .

We compare the squared signal from the multiplier against a fixed voltage . A differential amplifier (op-amp subtractor) is then used in order to compute the difference between these two voltages.

The circuit is configured such that:

By setting , the output becomes:

This produces a bounded signal that remains within a valid range for the subsequent square-root approximation stage.

Part 6: Nonlinear Approximation Stage

In this stage, we implement the transformation:

We will assume a log–antilog implementation, since it gives a controlled way of shaping nonlinear functions using standard op-amp building blocks.


Principle of operation

The key identity used is:

and:

This allows us to build nonlinear functions by moving signals into the logarithmic domain, manipulating them linearly, then converting them back.


Signal flow

We start with the signal:

1. Log stage

The input is passed through a log amplifier:

At this point, the signal is no longer linear in voltage. It represents the logarithm of the original waveform.


2. Scaling stage

We apply a gain of (1/2):

This step is critical because:

and:


3. Antilog stage

The signal is then passed through an exponential (antilog) stage:

Substituting:

which simplifies back to:


Extra note

We assume:

  • signals remain within the linear operating range
  • temperature drift is negligible

Part 7: Integration Stage

At this point, the signal entering the integrator is:

We now perform continuous accumulation over the sweep of (x).

An op-amp integrator implements:

So the integrator effectively accumulates:

Part 8: Scaling Stage (×4 Gain)

At last!

The integrator output corresponds to a quarter of a unit circle area. To recover π, we apply a fixed gain of 4.

This is implemented with a standard non-inverting op-amp amplifier:

Thus:

Conclusion

What we have built is not a digital computation of π, and not a symbolic derivation either. It is a continuous physical system that reconstructs a geometric constant through interacting analog stages.

The result is inherently approximate, but it emerges from the physics of the circuit rather than discrete arithmetic.