import math
# 1. Вычисление формул
x, y, z = 5, 6, 7
b = math.log(x**2 + math.exp(-3 * y**2) / math.sin(y)**2)
print(f"b = {b:.3f}")
try:
a = math.tan((x + y)**2 - math.sqrt(math.cos(z)**2 / math.tan(z**2)))
print(f"a = {a:.3f}")
except ValueError:
# Запасной расчет для tg^2(z), так как при tg(z^2) под корнем минус
a = math.tan((x + y)**2 - math.sqrt(math.cos(z)**2 / math.tan(z)**2))
print(f"a (с поправкой на tg^2(z)) = {a:.3f}")
# 2. Геометрическая задача
p1, p2, p3 = (0, 0), (2, 0), (1, math.sqrt(3))
d1 = math.hypot(p1[0] - p2[0], p1[1] - p2[1])
d2 = math.hypot(p2[0] - p3[0], p2[1] - p3[1])
d3 = math.hypot(p1[0] - p3[0], p1[1] - p3[1])
if math.isclose(d1, d2, rel_tol=1e-5) and math.isclose(d2, d3, rel_tol=1e-5):
s = (math.sqrt(3) / 4) * d1**2
h = (math.sqrt(3) / 2) * d1
print(f"Треугольник равносторонний.\nS = {s:.3f}\nh = {h:.3f}")
else:
print("Треугольник не является равносторонним.")