For a simple RC circuit with a resistor and capacitor in series with a controlled voltage source, the derivation for the voltage across the capacitor and resistor is easy, i.e. substituting current \$I\$ as a derivative of charge \$Q\$ in and \$Q/C\$ for the capacitor then integration which leads to the equation
$$V_c = V_\text{source}\left(1-e^{-t/RC}\right)$$
and
$$V_r = V_\text{source}e^{-t/RC}$$
How would this equation change in case we don't have an ideal capacitor and ideal resistor? How would we come to this differential equation in this case? For example, the separation of ions in a fluid can be done by supplying low voltages which would act like a capacitor charging up and the separation of ions takes place and there is resistance inside the fluid itself. Both of them are unfortunately not ideal in this case.