Solution for the One-dimensional Diffusion Equation
The coefficient
A_n is in turn determined from the initial condition. We require
\begin{equation*}
u(x,0)=g(x)=\sum_{n=1}^{\infty} A_n \sin(n\pi x/L).
\end{equation*}
The coefficient
A_n is the Fourier coefficients for the function
g(x) . Because of this,
A_n is given by (from the theory on Fourier series)
\begin{equation*}
A_n=\frac{2}{L}\int_0^L g(x)\sin(n\pi x/L) \mathrm{d}x.
\end{equation*}
Different
g(x) functions will obviously result in different results for
A_n .