The uniform beam AB of length L has built-in ends and carries a distributed load that varies with x, as shown in Fig. (a). Given L and w(x), write an algorithm that determines the bending moments at the two ends. Apply the algorithm to the beams shown in Figs. (b) and (c).