Create calculate_theta