# Using RC circuits to solve differential equations

As I was thinking about RC circuits it dawned upon me that under the correct configurations one could very efficiently solve differential equations by programming them into an RC circuit (the applications of this would be something like a very very fast hardware implementation of machine learning).

If you have a set of linear first order coupled differential equations $\dot{x} = f(x_1, x_2, x_3,...,x_n)$ and you set $n$ output capacitors such that after a time $t$, $q_i(t) \propto g(x_i(t))$ for some function $g$.

Under this paradigm, if you want to make a statement like $\dot{x}_i + \dot{x}_j$ somewhere in the circuit then you'd essentially add the currents $i_i + i_j$.

Is there a trivial way of doing this. I wouldn't know where to start trying to implement something like this.

I would be happy if someone could simply implement schematically using nothing but resistors, capacitors, diodes, and batteries the differential equation $$\dot{x} = -x$$ in a circuit, which would lead to harmonic output.

• Check out analog computers. – Mike Dunlavey Mar 16 '17 at 19:50
• You can't make an oscillator with the components you specified. If you add op-amps (so-called because they were used to implement the operations in analog computers) to the mix, you should be golden. – The Photon Mar 16 '17 at 20:28
• Is there a proof that such a thing is impossible? I was thinking something like a coupling of capacitors such that as one discharges the other charges up? – theideasmith Mar 16 '17 at 20:33
• @theideasmith Easy proof. $\frac{dx}{dt} = 2$. The solution to that is $x(t)=2t +C$. If your representation of $x$ requires energy proportional to it, you need to be adding energy into the system the whole time. Likewise, to have oscillation, you need energy to not be diminishing. – Cort Ammon - Reinstate Monica Mar 16 '17 at 20:35
• @theideasmith, your idea was actually implemented many years ago, before desktop computers were available. As mentioned in others' comments, they were called analog computers, and (if memory serves) they used an electrical device called an op-amp (operational amplifier). If you search some of the older literature (e.g., circa 1950's - 1970's), you will no doubt find many examples of what you are trying to do. – David White Mar 16 '17 at 20:46

Consider this circuit: If the capacitor is initially charged, the system is governed by these equations:

$$\frac{{\rm d}v}{{\rm d}t} = \frac{-i(t)}{C}$$ $$i(t) = \frac{v(t)}{R}$$

where $v(t)$ is the voltage difference from the upper node to the lower node.

Thus,

$$\frac{{\rm d}v}{{\rm d}t} = \frac{-v(t)}{RC}.$$

But this will not lead to oscillation. For oscillation you actually want

$$\ddot{x} = -x$$

To get this behavior in an electrical circuit, you'll need to add inductors or some kind of active device (like a transistor or amplifier) to your bag of parts.