# How to Prepare an Op Amp Circuit to Do Complex Mathematics

By adding a capacitor to an operational-amplifier (op amp) circuit, you can use the op amp circuit to do more-complex mathematical operations, like integration and differentiation. Practically speaking, you use capacitors instead of inductors because inductors are usually bulkier than capacitors.

## Create an op amp integrator

Here is an op amp circuit that has a feedback element as a capacitor. The circuit is configured similarly to an inverting amplifier.

The cool thing about this op amp circuit is that it performs integration. The circuit electronically calculates the integral of any input voltage, which is a lot simpler (and less painful!) than banging your head on the table as you try to integrate a weird function by hand.

Watch and learn how this circuit performs this incredible feat called integration. First, you use a KCL equation at Node A:

i_{R}(t) + i_{C}(t) = i_{N}(t)

Ohm’s law (*i = v/R*) gives you the current through the resistor:

You get the current through the capacitor using the *i-v* relationship of a capacitor:

For ideal op amp devices, the circuit gives you *v*_{G}*(t)* = 0 (virtual ground) and *i** _{N}* = 0 (infinite input resistance). Substituting these op amp constraints for

*i*

_{R}*(t)*and

*i*

_{C}*(t)*into the KCL equation gives you

Then integrate both sides of the preceding equation. You wind up with the following output voltage *v*_{o}*(t)*:

The initial output voltage *v*_{o}*(0)* across the capacitor — that, is the voltage at *t* = 0 — is 0. If *v*_{o}*(0)* = 0, then the output-voltage equation reduces to

The op amp circuit accepts an input voltage and gives you an inverted output that’s proportional to the integral of the input voltage.

## Derive an op amp differentiator

With op amp circuits where the resistor is the feedback element and the capacitor is the input device (like the one shown here), you can perform differentiation electronically.

You follow the same process as the one you use to find the relationship for an op amp integrator. Begin with a KCL equation at Node G:

i_{R}(t) + i_{C}(t) = i_{N}(t)

The current through the resistor is given by Ohm’s law (*i = v/R*):

The current through the capacitors is given by the *i-v* relationship of a capacitor:

For ideal op amp devices, the circuit gives you *v** _{G}* = 0 (virtual ground) and

*i*

*= 0 (infinite input resistance). Substituting these op amp constraints for*

_{N}*i*

_{R}*(t)*and

*i*

_{C}*(t)*into the KCL equation gives you the following:

Solving for *v** _{o}*, you wind up with the following output voltage

*v*

_{o}*(t)*:

So if you are given an input voltage, you won’t even raise a sweat in getting its derivative as an output. The inverted output is simply proportional to the derivative of the input voltage.