For RLC and diode circuit:,
where
For example:
At t=0; V_L=V_C-I R-V_{diode}=20-0.12*(9+1)-0.8
this can be used to calculate which will give us I(t+dt).
With I(t) we can calculate
We can repeat the above step to calculate the charge Q(t+dt) and current I(t+dt) for each time step t.