Inequalities are mathematical statements involving an order relation between two quantities, such as 'a is less than b' or 'a is greater than or equal to b'. These are usually expressed in symbols, i.e. 'a < b' or 'a>=b'.
Questions tagged [inequality]
273 questions
4
votes
2 answers
Defining == and < for structs with many data members
How to generalize the definition of < if the struct has arbitrarily many data members (< is to be defined using the order in which the data members are listed)? A simple example with 3 data members:
struct nData {
int a;
double b;
…

prestokeys
- 4,817
- 3
- 20
- 43
4
votes
1 answer
Implementation of Theil inequality index in python
I am trying to implement Theil's index (http://en.wikipedia.org/wiki/Theil_index) in Python to measure inequality of revenue in a list.
The formula is basically Shannon's entropy, so it deals with log. My problem is that I have a few revenues at 0…

Lucien S.
- 5,123
- 10
- 52
- 88
4
votes
4 answers
How to solve a system of inequalities?
I've reduced my problem (table layout algorithm) to the following problem:
Imagine I have N variables X1, X2, ..., XN. I also have some (undetermined) number of inequalities, like:
X1 >= 2
x2 + X3 >= 13
etc.
Each inequalities is a sum of one or more…

Vilx-
- 104,512
- 87
- 279
- 422
3
votes
1 answer
How can I limit the possible integers used in my solutions in prolog?
I have been trying to learn prolog but I am having issues with limiting the possible integers that can be used in my solutions. For example, In my SWI terminal, I ran
[X,Y,Z] ins 0..1,X #\= Y, Y #\= Z, Z#\= Y.
and as output I got
X in 0..1,
X#\=Y,
Y…

Spencer Woolfson
- 131
- 4
3
votes
1 answer
rolling value based on an inequality *rolling* condition of a column in data.table R
I've got a large data.table (~50M rows) with multiple ID columns (ID1, ID2) that groups rows. I'd like to shift the Value column based on an inequality rolling condition as i will outline below. what is rolling condition? I just made that term up.…

Ankhnesmerira
- 1,386
- 15
- 29
3
votes
1 answer
R function to plot inequalities with shading
Suppose I have a set of inequalities:
-2x + y <= -3
1.25x + y <= 2.5
y >= -3
And I can summarize the information as follows:
mat <- matrix(c(-2, 1, 1.25, 1, 0, 1), nrow = 3, byrow = TRUE)
dir <- c("<=", "<=", ">=")
rhs <- c(-3, 2.5,…

Adrian
- 9,229
- 24
- 74
- 132
3
votes
2 answers
Ada: Importing the inequality operator "/="
I don't want to use an entire package, but I do want to import a few features, such as the "/=" operator. I know that renames allows me to do this with most functions, but with the inequality operator I get the error, explicit definition of…

John Perry
- 2,497
- 2
- 19
- 28
3
votes
1 answer
Using fill_between and min/max to represent inequalities
My code:
import matplotlib.pyplot as plt
import numpy as np
# x > 0
x = np.linspace(0,17, 100)
#x2>=0
y0 = (x*0)
#-x1+x2 <= 1
y1 = 1+x
#x1+6x2 <= 15
y2 = 15/6 - (1/6)*x
#4x1-x2 <= 10
y3 =…

hkj447
- 677
- 7
- 21
3
votes
2 answers
Find smallest integer that satisfies floating point inequality equation
I am looking for a fast algorithm that finds the smallest integer N that will satisfy the following inequality where s, q, u, and p are float numbers (using the IEEE-754 binary32 format):
s > q + u * p / (N - 1)
where N can be any positive integer…

Yeshe Tenley
- 31
- 5
3
votes
6 answers
Pyhonic use of if statements for inequalities applied to chunked list
Given the following lists in Python:
l1 = [0,1000,5000,10000,20000,30000,40000,50000] #8 values, 7 intervals
v1 = [1,2,3,4,5,6,7] #7 values
v2 = [a,b,c,d,e,f,g] #7 letters
I want to check whether a number is contained in any interval, and return…

Zizzipupp
- 1,301
- 1
- 11
- 27
3
votes
1 answer
How to use solveset with several inequalities
How can I use sympy.solveset to solve a set of inequalities? I tried this:
from sympy.abc import x,y
from sympy import solveset, S
print(solveset([x > 2, x-1 < 3], x, S.Reals))
it should return something like:
2 < x < 4
However, it gives an…

Erel Segal-Halevi
- 33,955
- 36
- 114
- 183
3
votes
2 answers
JavaScript says 10 is lower then 9
I'm trying to learn JavaScript and when I started the MDN Tutorial, I tried to do the first exercise alone, which worked okay so far. But there is one really weird situation.
The Game generates a Random number from 1 - 100 and the User has 10…

SHRX
- 559
- 1
- 6
- 17
3
votes
1 answer
MATLAB symengine fails on a logical statement
I want to make matlab agree with the following simple statement:
(x-a)^b>=0 when x>0, a>0, b<0, x>a
In order to do so I write:
syms x a b
assume(x>0 & a>0 & b<0 & x>a);
isAlways((x-a)^b>=0,'Unknown','error')
And get the following error…

Bogdan
- 864
- 10
- 18
3
votes
1 answer
Using external orderby without using used query inequality in firebase firestore
Is there anyway i can escape GeoPoint as first order in this postion?
If i remove GeoPoint from orderby it triggered the below error and if i put the GeoPoint as first orderby, as instructed as below, it mislead the second orderby…

General Omosco
- 606
- 1
- 10
- 20
3
votes
1 answer
Fill a region of an image based on inequality equations
I want to plot a filled-in region on a 2D plot using matplotlib in python. The implicit region is defined by,
def f(x,y):
return sqrt(2*x*y)-x-y
I want to add to an existing image a filled-in region in the XY plane defined by the two…

ahle6481
- 723
- 1
- 6
- 10