Off[General::spell,  General::spell1]
    
Cs = {A2, B0, B1, B2}; 
    n = Length[Cs];
  
va = A2 x^2; 
    vb =  (B0 + B1 (x - L)  +  
          B2 (x - L)^2);
  
eqv1 = (D[va, x] - D[vb, x]) /. 
        x -> L
vb = 
        vb /. Solve[eqv1 == 0, 
              B1][[1]];
  
eqv = (va - vb) /. x -> L
vb = 
      vb /. Solve[eqv == 0, B0][[1]]
va2 = D[va, {x, 2}] ;  
    vb2 = D[vb, {x, 2}];
  
W = 
      Integrate[EI va2^2/2 - w va, {x, 0, L}] + 
        Integrate[EI vb2^2/2 - w vb, {x, L, 2  L}]
   
grad = {D[W, A2], D[W, B2]}
AA = Solve[
          grad == 0, {A2, B2}][[1]]
va = va /. AA
vb = vb /. AA
v = 
        va UnitStep[L - x] + 
          vb UnitStep[x - L];
v2 = 
        D[va, {x, 2}] UnitStep[L - x] + 
          D[vb, {x, 2}] UnitStep[x - L];

ve=(x^2) (((w (((2  L))^2))/(4 EI)) - ((w x (2  L))/(6 EI)) + ((w (x^2))/(24 EI)));
ve2 = D[ve, {x, 2}];
  
valw = {EI -> 1, L -> 1, w -> 1}; 
vw = v /. valw;  
    vew = ve /. valw;
v2w = v2 /. valw;  ve2w = ve2 /. valw;
  
Plot[{vw, vew}, {x, 0, 2}, 
      PlotStyle -> {Hue[1], 
          Hue[0.3]}]
Plot[{v2w, ve2w}, {x, 0, 2}, 
      PlotStyle -> {Hue[1], Hue[0.3]}]