Q 7.3  beam without spring p.173

matrix formulation

tad = {{1, 0, 1, 0}, {0, 1, L, 1}, {0, 0, L^2, 2  L}, {0, 0, L^3, 
            3 L^2}};
MatrixForm[tad]

tda = Inverse[tad];
MatrixForm[tda]

kk = 
        EI/L^3 {{12, 6  L, -12, 6 L}, {6 L, 4 L^2, -6 L, 
              2 L^2}, {-12, -6 L, 12, -6 L}, {6 L, 
              2 L^2, -6 L, 4 L^2}};
MatrixForm[kk]

para1 = {EI ->  1, L ->  1, P ->  1}

#1 Cantilever

dd = {0, 0, δ2, θ2};
ff = {-R1, -M1, P, 0};

ans = Solve[
          kk . dd == ff, {δ2, θ2, R1, 
            M1}][[1]]

yx = dd . tda . {1, x, x^2, x^3} /. ans

δx = yx /. para1

zu11 = 
      Plot[-δx, {x, 0, 1}, GridLines ->  Automatic, 
        AspectRatio ->  0.3, 
        PlotRange ->  {{0, 1}, {-0.4, 0}}]

qxa = D[δx, {x, 2}]
mxa = D[δx, {x, 3}]

zu12 = 
      Plot[{qxa , mxa}, {x, 0, 1}, PlotRange -> {-1, 1},  
        PlotStyle ->  {Hue[0.9], Hue[0.7]}, 
        AspectRatio ->  0.3]

Q 7.3  beam with spring ka p.173

#2 cantilever with a spring

dd = {0, 0, δ2, θ2};
ff = {-R1, -M1, P, 0};

kka = kk;
kka[[3, 3]] = 
        kka[[3, 3]] + ka EI/L^3;
MatrixForm[kka]

ans = Solve[
            kka . dd == ff, {δ2, θ2, R1, 
              M1}][[1]] /. ka-> 3

yx = dd . tda . {1, x, x^2, x^3} /. ans
δx = yx /. para1;

zu21 = 
      Plot[-δx, {x, 0, 1}, GridLines ->  Automatic, 
        AspectRatio ->  0.3, 
        PlotRange ->  {{0, 1}, {-0.4, 0}}, 
        PlotStyle ->  {Hue[0.9], Hue[0.7]}]

qxa = D[δx, {x, 2}];
mxa = D[δx, {x, 3}];
zu22 = 
      Plot[{qxa, mxa}, {x, 0, 1}, PlotRange -> {-1, 1},  
        PlotStyle ->  {Hue[0.9], Hue[0.7]}, 
        AspectRatio ->  0.3]

summary

Show[zu11, zu21]

Show[zu12, zu22]