Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- %matplotlib inline
- arr=np.array([[-1,1,2,-1,2],
- [9,-1,-6,5,6]])
- arr=np.vstack([arr,[2,-1,2,1,0]])
- arr[0]+=arr[1]
- arr[2]-=arr[1]
- arr[1]=arr[1]*5-arr[0]
- # Строим графики
- plt.plot(x, y1, label=r'$y\geqslant2$')
- plt.plot(x, y2, label=r'$2y\leq25-x$')
- plt.plot(x, y3, label=r'$4y\geq 2x - 8$')
- plt.plot(x, y4, label=r'$y\leq 2x-5$')
- plt.xlim((0, 16))
- plt.ylim((0, 11))
- plt.xlabel(r'$x$')
- plt.ylabel(r'$y$')
- # Закрашиваем область допустимых планов
- y5 = np.minimum(y2, y4)
- y6 = np.maximum(y1, y3)
- plt.fill_between(x, y5, y6, where=y5>y6, color='grey', alpha=0.5)
- plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement