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:
a = math.tan((x + y)**2 - math.sqrt(math.cos(z)**2 / math.tan(z)**2))
print(f"a (с поправкой) = {a:.3f}")
# 2. Геометрическая задача (переопределяем x, y, z как координаты точек)
x = (0, 0)
y = (2, 0)
z = (1, math.sqrt(3))
# Вычисление длин сторон по формуле √((x2-x1)² + (y2-y1)²)
d1 = math.sqrt((y[0] - x[0])**2 + (y[1] - x[1])**2)
d2 = math.sqrt((z[0] - y[0])**2 + (z[1] - y[1])**2)
d3 = math.sqrt((x[0] - z[0])**2 + (x[1] - z[1])**2)
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("Треугольник не является равносторонним.")