calculations for figure 4.3-4.4