How to approximate identity function using Fourier sine series

160 Views Asked by At

I want to approximate identity function $g(x) = x$ for $x \in [0,x_c]$ with $x_c<\pi/2$ by finite (sum) Fourier sine series $f(x)$. $f(x)<x_c$ is required for $x \in [0,\pi]$, $f(x)$ is assumed to be a $2\pi$-periodic function (that is, we can know everything about $f(x)$ by looking at its values for $x \in [-\pi,\pi]$), and approximation needs to be close within precision of $k$ fractional digits in binary or decimal for $x\in [0,x_c]$. $k$ is not fixed.

The question is, how many sine terms would be required to satisfy this, in function of $k$ (and $x_c$)?