tr_error = 0.1  # truncation error allowed

# 1. Initial calculations
n_k_est = int(k_est * n_param)  # estimated meaningful directions
N_terms_est = int(math.factorial(l_exp + n_k_est) / (math.factorial(n_k_est) * math.factorial(l_exp)))  # estimated number of terms
M = int(factor_MNt * N_terms_est)  # estimated number of samples