loss2 function

Difference between two successive components