This notebook plots the Fourier Sine Series of f(x) = 1/x on the interval (0, 2).  Note that f(x) is NOT piecewise smooth on (0, 2), so we don't have a theorem that says that the Fourier Sine Series converges.  

First, compute the coefficients (Subscript[B, n]) and put them in a list called B.  These integrals all converge, since f(x) * Sin(n π x/L) is approximately n π/L when x is small.  The integrand does not blow up near x = 0 even though f(x) does blow up.

L = 2;
f[x_] =(( 1)/x);
(*Sine Series coefficients in a list*)
B = Table[(2/L)NIntegrate[f[x]Sin[n π x/L], {x, 0, L}], {n, 100}];
Manipulate[Plot[{f[x], (∑_(n=1)^nTerms)B[[n]] Sin[n π x/L]}, {x, -0.5L, 1.5L}, PlotRange -> {-10,10}], {{nTerms, 20}, Range[1,100], Appearance -> "Labeled"}, ControlType -> Slider, SaveDefinitions -> True]