grafikimport matplotlib.pyplot as plt import numpy as np # Функции прямых def line1(x): return (151 - 5*x) / 9 def line2(x): return (103 - x) / 7 def line3(x): return 37 - 2*x x = np.linspace(0, 20, 200) # Построение прямых plt.plot(x, line1(x), label='5x1+9x2=151') plt.plot(x, line2(x), label='x1+7x2=103') plt.plot(x, line3(x), label='2x1+x2=37') # Вершины области vertices = [(0,0), (18.5,0), (14,9), (5,14), (0,14.714)] vx, vy = zip(*vertices) plt.fill(vx, vy, alpha=0.3, label='Допустимая область') plt.scatter(vx, vy, color='red') for (x_, y_) in vertices: plt.text(x_, y_, f'({x_:.1f}, {y_:.3f})', fontsize=8) # Линии уровня levels = [500, 1000, 1325] for L in levels: y_level = (L - 27*x) / 85 plt.plot(x, y_level, '--', label=f'L={L}') plt.xlim(0, 20) plt.ylim(0, 20) plt.xlabel('x1') plt.ylabel('x2') plt.title('Геометрическое решение двойственной задачи') plt.legend() plt.grid(True) plt.show()