绘制线性不等式系统的解 [英] Plot the solution of a system of linear inequalities

查看:154
本文介绍了绘制线性不等式系统的解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个[-1,1]中的数字数组:

I have two arrays of numbers from [-1,1]:

a = 2*np.random.sample(100)-1b = 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆