Calculation of composite function