Suppose I have the heat equation, with IC and BCs: $${\partial T \over{\partial t}}=k{\partial^2 T \over{\partial x^2}}$$ $${\partial T \over{\partial x}}(0,t)=0, \hspace{5mm}T(L,t)=B$$ $$T(0,0)=A, \hspace{5mm} T(x,0)=B$$
I tried working on the solution and got $$T(x,t) = B + \sum_{n=1}^{\infty} A_{n} \, \cos\left({{(2n-1)\pi x}\over{2L}}\right)\exp\left(-k \, t \, \left({{(2n-1)\pi}\over{2L}}\right)^2\right)$$ $$A_{n} = {2\over L}\int_{0}^L (A-B) \, \cos\left({{(2n-1)\pi x}\over{2L}}\right) \, dx $$ When I checked the graph for $T(x,0)$, however, $T(x,0)=A, 0\leqslant x <L$. How can I find the correct solution $T(x,t)$, where $T(x,0)=A, x=0; T(x,0)=B, 0< x \leqslant L$?