import numpy as np # pip install numpy
# Параметры
a = 5.82
b = 0.8
p = 0.485
z = 2
t = 1
x0 = -1.5
delta_x = 0.2
n = 25
# Функция
def y(x):
return (4 * x ** 2) / b ** 2 - z if -1.5 <= x <= 1.5 else np.sin(p * x) + (np.sin(x) / 4) + (
np.sin(x) / 9) if 1.5 < x < 2.5 else np.cos(x + np.cos(a * t)) if x >= 2.5 else None
# Табулирование функции
x_values = [x0 + i * delta_x for i in range(n)]
y_values = [y(x) for x in x_values]
# Вывод
for x, y_val in zip(x_values, y_values):
print(f"x = {x:.2f}, y = {y_val:.4f}")
import numpy as np # pip install numpy
# Параметры
a = 1.678
b = 19.792
x = 3.67
z = 2
# Функция
y = (a**2 * np.log(2 / a)) / np.sin(x + np.sqrt(x + b**2)) + np.exp(x / z)
# Вывод
print(f"y = {y:.4f}")