# Basic Numerical Methods

**by**

**Al
Bernstein**

**Signal Science, LLC**

**www.signalscience.net**

### Numerical Differentiation

A numerical derivative can be
derived using the following approach:

The Taylor Series for about the point is given by equation
(1)

(1)

If we quantize by setting for ≡ an integer and ≡

then (2)

We set then

(3)

(4)

Subtracting equation (4) from
equation (3) gives

(5)

Equation (5) can be rewritten as

(6)

For a general
quantized point , equation (6) gives

or

(7)

Equation (7) will work when . If , then is implicitly modeled
by a second order polynomial. Higher order derivatives can be derived in the
same way.

### Numerical Integration

We start with the Taylor
series using equation (1) with , use equation (7) for and use equation (8)
for.

(8)

Then (9)

(10)

which is Simpson’s Rule. Higher order integration methods
can be derived in a similar way. For a general discussion on this approach for
deriving numerical methods see ^{1}^{}

### Electronic Implementation

This section shows how to implement a numerical algorithm in
a circuit design. For example if we start with Simpson’s Rule equation (10), we
can first modify it to be causal. This means that we can shift the indices so
that at time t=0 we use the index n (i.e. the system is not operating before
time t=0). We do this by changing the indexing (delaying by 1 sample) in
equation (10).

(11)

The block diagram is shown below in **Figure 1**

**
Block Diagram**

**Figure 1**

This is shown as a system that can be implemented in the
digital domain. The z^{-1 }and z^{-2} represent delays of 1 and
2 samples respectively. They could be implemented with digital electronics,
analog electronics or theoretically other mechanical or electrical systems
which provide a delay equivalent to one sample in time and gain elements.

### References

^{1}
Steve E. Koonin, *Computational Physics*,
Addison-Wesley, pp 2-6 (1986)