How do changes in temperature contribute to the expansion and contraction of materials?