Calculation of terms and patterns