# How to derive resistance as a function of time to keep current constant in circuit?

Having found this answer to an electronics question, a subsequent question would be; in a primitive circuit having only one voltage source or sink in series with a resistor $R$, charging a capacitor, if we are in some sense able to steer a resistance $R(t)$ as a function of time, can we try to reshape the (dis-)charging to some other shape, for example linear?

Of course that would not be a very mathematical question.

The mathematical question would rather be something like: can we derive this function $R(t)$?

Own work so far: I've been thinking about maybe using Maxwells equations but my instincts tell me they would be a bit of overkill.

$\begin{cases} V(t)=RI(t) \\ I(t)=-C\frac{dV}{dt} \end{cases}$ $\quad\to\quad V(t)=-RC\frac{dV}{dt}$
If the resistor is standard (constant value) solving the ODE leads to $\quad V(t)=V_0e^{-\frac{t}{RC}}\quad$, so an exponential decay of voltage.
Suppose that we want a linear decay, such as $\quad V(t)=V_0(1-\alpha t)$, then the resistor must be variable, so that $\quad \frac{dV}{dt}=-V_0\alpha \quad\to\quad V=(-R(t)C)(-V_0\alpha)=V_0(1-\alpha t)$ $$R(t)=\frac{1-\alpha t}{\alpha C}$$ At this point, we come back to a physical problem : How can the resistor varie ? It isn't indicated in the wording of the question, so, we cannot go further. In any case, $\frac{dV}{dt}$ must be constant, hence the current $I$ must be constant. This means that the resistor must be very special : For any voltage applied, he must let pass a constant current through it.