This code solves the RLC series circuit using GSL for differential equation solver. The system parameters are L=47mH, C=47 nF, and R=500 ohm. The initial voltage is 10 V. See the MIT OpenCourseWare text for more details.
Use the following command to compile.
gcc rlc-series.c -o rlc-series -lgsl -lgslcblas -lm