function u = analyticalSolution(k,f,uhat,l,tauhat,intf,int2f,x)

B = uhat;
A = -tauhat/k + (1/k)*intf(l);
u = -int2f(x)/k + A*x + B;