How to simulate a continuous signal passing through a capacitor (simple coupling capacitor) the differential equation for the current flowing through a serial capacitor (see for example https://www.allaboutcircuits.com/textbook/direct-current/chpt-13/capacitors-and-calculus/) indicates that one must take a derivative of the signal but in the literature, a serial capacitor (for instance a coupling capacitor) is often considered as a unit that just eliminates a continuous component of the signal. Well. Is it necessary to take a derivative or just get the first moment of the stochastic signal and eliminate it in order to simulate the passing of that signal through the coupling capacitor?
Is it necessary to take a derivative

Yes

or just get the first moment of the stochastic signal and eliminate

That's just a very crude approximation of taking the derivative. In some cases that's sufficient, but in most it's not.
For DC blocking the capacitor is typically used together with a resistor to form a high pass filter. The approximation is often &quot;good enough&quot; if the corner frequency of the high pass is well below any signal frequency of interest.