function u = analyticalSolutionWithJumps(k1,f1,k2,f2,uhat,l,tauhat,intf1,int2f1,intf2,int2f2,x)

B = uhat;
C = (1/k2)*(tauhat + intf2(1));
A = (1/k1)*(k2*C+intf1(1/2));

D = -(1/k1)*int2f1(1/2)+(1/2)*(A-C)+uhat;

u = 0*x;
idx1 = find(x<=1/2);
x1 = x(idx1);
u(idx1) = -(1/k1)*int2f1(x1) + A*x1 + B;
idx2 = find(x>1/2);
x2 = x(idx2);
u(idx2) = -(1/k2)*int2f2(x2) + C*x2 + D;