绘制线性不等式系统的解 [英] Plot the solution of a system of linear inequalities
问题描述
我有两个[-1,1]中的数字数组:
I have two arrays of numbers from [-1,1]:
a = 2*np.random.sample(100)-1
和
b = 2*np.random.sample(100)-1
.这两个数组定义了以下线性不等式系统
a = 2*np.random.sample(100)-1
and
b = 2*np.random.sample(100)-1
. These two arrays define the following system of linear inequalities
a [i] * x + b [i] * y <= 1,因为i = 0,1,...,99
a[i]*x + b[i]*y <= 1 for i = 0,1,..., 99
此系统的解集是凸多边形.如何使用matplotlib绘制它?据我了解,fill_between
仅在两个不等式的情况下允许这样做.
The solution-set of this system is a convex polygon. How to draw it using matplotlib? As I understand,fill_between
allows to do this only for case of two inequalities.
推荐答案
您可以使用fillplots软件包( http://fillplots .readthedocs.org )可以完全满足您的需求. http://fillplots.readthedocs.org/en/latest/examples提供了一些示例.html .
You can use the fillplots package (http://fillplots.readthedocs.org) that does exactly what you are looking for. A few examples are available at http://fillplots.readthedocs.org/en/latest/examples.html.
这篇关于绘制线性不等式系统的解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!