281 questions
2
votes
2
answers
129
views
What formula does Gini() from ineq package use to get the Gini coefficient in R?
I'm writing a paper and I want to declare how I obtained some Gini coefficients using the Gini() function from the ineq package, but when looking for what formula Gini() from ineq uses, I do not find ...
0
votes
1
answer
41
views
Execution time of inequality with numpy array
Getting two widely different execution times in the below
import numpy as np
import time
array = np.arange(0, 750000)
param = 20000
t1 = time.time()
for _ in range(param):
array <= 120
print(...
0
votes
1
answer
105
views
Proving non-linear equations and inequalities involving rational numbers in Coq
I'm trying to formalize a stable-coin protocol using the Coq Interactive Theorem Prover. The proofs I have involve a lot of manipulation of linear and non-linear equations involving rational numbers. ...
0
votes
0
answers
41
views
Sympy is struggling to evaluate an inequality relational Kronecker delta function after subbing in values to a numerical value
I'm trying to evaluate this function after subbing in all the respective values. For some reason, this function ends up stopping here and can't be evaluated further into a numerical value.
I've tried ...
0
votes
0
answers
27
views
Is there a compact formula for the number of natural solutions of a linear inequality with real coefficients?
I have an inequality in integer nonnegative x,y
x+a*y<=c
where a,c - real positive.
The number of solutions equals
sum (int(c-i*a)+1 for i in range(int(c/a)+1)
Is there a compact (O(1)) formula ...
1
vote
1
answer
66
views
Using sympy to solve an inequality with two variables
I'm trying to use Sympy to solve 0 < x + y <= 4 in the case where both x and y are positive integers or 0, in the hopes to have it return a list of tuples that solves the inequality.
import ...
0
votes
1
answer
80
views
How to solve an inequality that contains standard deviation in python?
I have the past 19 days of stock price stored in the pd.dataframe and I am trying to find out the price P that is smaller than (mean - 2.5*standard deviation), where mean and standard deviation are ...
2
votes
1
answer
56
views
Why does sympy.solve produce empty array for certain inequalities
sympy's solve seems to generally work for inequalities. For example:
from sympy import symbols, solve;
x = symbols('x');
print(solve('x^2 > 4', x)); # ((-oo < x) & (x < -2)) | ((2 < ...
0
votes
0
answers
29
views
What is the correct way to compare static immutable strings and mutable strings in Rust? [duplicate]
I am new to Rust & I am having trouble to compare mutable strings and immutable strings.
Please find below a code block which should exit if "exit" is entered.
But I am having problem ...
0
votes
1
answer
79
views
Using sympy to solve a two-sided inequality with absolute value
Relatively simple math problem, find the range over which 3 <= Abs[6 - x] <= 5. Not hard to solve by hand, and Mathematica nails it, with the answer 1 <= x <= 3 || 9 <= x <= 11.
The ...
1
vote
0
answers
72
views
How do you get the Simplify function to completely simplify an inequality in Mathematica?
I am working on testing whether a function lies in a given range. Somehow, the function Simplify does not provide the correct (obvious) answer. Why is that ?
The main function corresponds to the ...
0
votes
1
answer
71
views
when x >= 0 , y >= 0, and y must exceed x by at most 200, does it imply y > x?
The statement below:
y must exceed x by at most 200
can be written as
y - x <= 200
Does the statement imply y must exceed x? y > x ?
For my understanding:
y must exceed x by at most 200
this ...
0
votes
1
answer
283
views
Solve inequality in Sympy
I'm trying to solve a simple linear inequality in Sympy but can't seem to get it to work.
Basically, I want to be able to calculate the optimal values of a when the inequality happens to be false.
...
0
votes
0
answers
139
views
Convert all kinds of mathematical equations to a given variable with Python
I want to convert all kinds of mathematical equations to any given variable within that quation using Python. I want this to work with equations with multiple variables and with all kinds of ...
1
vote
1
answer
67
views
Sympy.solve is not isolating desired variable in inequality
I want to use nypy.solve to convert a formular to a certain variable. In my example I want to convert the formular a >= ((b-c)/2)*sy.tan(d) to the variable b. But somehow the result of Sympy is not ...
0
votes
1
answer
184
views
How to set not equal to constraint to a boolean vector variable
Suppose I have a simplified problem like this
x1 = cp.Variable(boolean=True)
x2 = cp.Variable(boolean=True)
sum = x1 + x2
prob = cp.Problem(cp.Maximize(sum))
prob.solve(verbose=True)
The possible ...
1
vote
1
answer
46
views
Fitting 16 variables in 17 inequalities in Python
I have 17 inequalities:
1: (x[0] + x[1] + x[2] + x[4] + x[6] + x[7])/(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6] + x[7]) >= 0.4
2: (x[3] + x[5])/(x[0] + x[1] + x[2] + x[3] + x[4] + x[5] + x[6]...
0
votes
0
answers
57
views
Python/scipy - Optimizing function with constraint greater but NOT equal to zero
I'm developping a code that find the optimized condition for two independent variables h and t that define the function W(h,t). I want to minimize this function because that is the weight function. ...
0
votes
1
answer
183
views
Estimating set cardinality by querying
I have the following problem for homework and I was wondering if you could provide some hints.
Your friend has in mind a set of numbers S ⊆ {1, ... , n}. If you ask him about a set Q ⊆ {1, ..., n} he ...
2
votes
1
answer
254
views
z3 solver using Sympy symbols
I'm trying to use Z3 to determine if an expression is satisfiable.I have created all equations that I want to use it as constraints using SymPy and the variables are Symbols.
the equations for example
...
0
votes
1
answer
564
views
Python inequality comparison dealing with floating point precision
I need to compare floating point numbers with inequalities:
if x >= y:
However, due to floating point precision issues, sometimes this fails when it should succeed (x = 0.21 and y= 0....
0
votes
1
answer
394
views
How to solve a single inequality equation in R?
I'm using Tim Gerrodette's inequality equation (1987), to look at power analysis of visual survey data, however i'm struggling of finding away to solve this for x, using R.
I have the following ...
1
vote
1
answer
181
views
How to prove strict inequality holds for no in Agda
I am currently working on one of the recommended question from the chapter Negation in plfa
Here is the question description:
Using negation, show that strict inequality is irreflexive, that is, n <...
0
votes
1
answer
251
views
Sympy can't solve inequality with radicals
I need to solve this inequality:
enter image description here
import sympy as sp
from sympy.abc import x,n
epsilon = 0.01
a = 2/3
xn = (n**3 + n**2)**(1/3) - (n**3 - n**2)**(1/3)
i tried to solve ...
0
votes
0
answers
427
views
Getting any feasible point from a system of linear inequalities in Python
I have a problem with solving a system of linear inequalities in Python.
What I need is basically draw n random feasible points from the inequality system. You could also call it a constraint system ...
0
votes
1
answer
194
views
Markov Inequality Plot in R
I have a Normal distribution CCDF plot made in R. I need to apply Markov inequality to this data and plot them at this same plot. How can I implement it? Any help is welcome.
My data and what I have:
...
3
votes
1
answer
72
views
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,...
3
votes
1
answer
243
views
Coq: Simpl in match pattern when having an inequality hypothesis
I have a definition involving match, similar like this:
Definition five (n: nat): bool :=
match n with
| 5 => true
| _ => false
end.
I try to proof something similar like this:
Theorem fiveT: ...
-1
votes
4
answers
1k
views
empty char array, the ways I check it are the same?
I have a char array and I want to check if it is null.
if(_char_array[0] != '\0') {...}
is the same as
if(_char_array != '\0') {...}
thanks
0
votes
1
answer
91
views
Solving coupled inequalities where the variables are array indices
I have a set of two arrays of numbers, and I need to find 3 indices of these arrays, such that 2 inequalities using the arrays are satisfied. We can assume the value of one index to simplify the ...
0
votes
1
answer
260
views
Variation without the cost of foods using the Diet Problem(Maximization Problem)
I've been looking for an algorithm that helps me to create the best possible diet based on a certain amount of nutrients. After a lot of research and attempts, it didn't succeed. But I found something ...
0
votes
1
answer
539
views
Equality operator with multiple values in JavaScript
Is there a simple way to compare multiple values to a single value in Javascript ?
Like, instead of writing :
if (k != 2 && k != 3 && k!= 7 && k!12)
Writing something like :
...
2
votes
1
answer
427
views
Fast way to solve system of non-linear equations and linear inequalities?
I have a set of polynomial equations and linear inequalities for real numbers.
How can I determine whether a solution exists?
I need no symbolic solution or a guarantee that the answer is correct, but ...
-2
votes
1
answer
326
views
find the smallest integer N, such that
I am stuck for quite a while now on the following task:
find the smallest integer N, such that A^N < N!
I want to do this in C# and A can be so big that there is no type that can store the results. ...
1
vote
0
answers
393
views
Plotting Inequalities in Sympy Python [duplicate]
I have this code that shows the area that satisfies inequalities but I need the lines (x=3 and y=x) to be shown on the graph as well.
Any help is appreciated!
My Code:
from sympy import *
x, y, z, t = ...
0
votes
0
answers
293
views
Graphing Inequalities in matplotlib python
I'm looking to create a program that will randomly generate lines (that are inequalities) and that will show the area that satisfies the constraints. If possible axes would go from 10 to -10 but I'm ...
0
votes
1
answer
44
views
How <> works when compared with multiple values?
I have a table and sample data as below.
create table MyTable
(
Col1 NUMBER,
Col2 VARCHAR2(30)
)
MyTable
Col1 Col2
1 | Val1
2 | Val2
3 | Val3
4 | Val4
Below is the query which is ...
2
votes
1
answer
96
views
Detecting inconsistency in a set of non-strict inequalities
Given a set of variables and a set of strict inequalities, it's straightforward enough to detect whether there is an inconsistency: make a directed graph whose nodes are variables; for each assertion ...
1
vote
1
answer
883
views
How to use correctly SLSQP algoritm with non-linear constraints?
I need to find the rectangle with max area inside an ellipse (which may be tilted).
The goal is to gerealize this problem to N dimension, so when we set N=2 we find our rectangle iside an ellipse.
...
1
vote
0
answers
41
views
Matlab Erroneously Adds +1 at End of Inequality
I am using Matlab to solve the inequality VR2>VR1 in terms of k. The equations are
When solve the inequality by hand, I get an answer of 2αy > k.
When I use Matlab, I get 2αy+1 > k or empty ...
-1
votes
1
answer
677
views
Failed assertion: line 677 pos 11: 'field == orders[0][0]'
I don't know why I can not access the data from flutter while using two "where". can any help me to solve this? what I want is to get all the documents between a period of time
Error
The ...
0
votes
1
answer
50
views
Errors with Inequality join in Hive
I am performing a self join in Hive and doing aggregations (percentile) on the window included in the join condition and I am getting the following errors -
Error1:
FAILED: SemanticException Line x: ...
1
vote
0
answers
248
views
Concentration index in Python
I am estimating successful Concentration Index into programming language R with IC2 package. Below you can see function and results
library(IC2)
data(hhbudgets)
calcSConc(hhbudgets[, "transporte&...
1
vote
1
answer
297
views
What is the best way to code a compound inequalities on a PANDAS dataframe?
In the below data frame I'd like to evaluate the following compound inequality:
df['B'] <= df['E'].shift(1) <= df['A']
df
A B C D E F G
Date ...
0
votes
1
answer
201
views
Inequality Constraint for a PYMC3 Model
I want to define an inequality constraint for a PYMC3 model. I found this post about defining an equality constraint (i.e., a+b1+b2=1) using pm.Potential. Does anyone know how to change that equality ...
0
votes
2
answers
180
views
Simplify negation of inequality
I have a sub goal that is of the following form:
~ (My_term1) < (My_term2)
where My_term1 and My_term2 are both real numbers.
Is there a way to rewrite it as (My_term1) >= (My_term2) ?
I tried ...
-1
votes
3
answers
75
views
Seperate array into three new arrays using inequalities in Python
I am trying to split an array into three new arrays using inequalities.
This will give you an idea of what I am trying to achieve:
measurement = [1, 5, 10, 13, 40, 43, 60]
for x in measurement:
...
0
votes
1
answer
707
views
how to solve non-linear inequalities with python like 12<x*y<14 and 2x + 3y>40?
I want to solve a system of nonlinear inequality equations, Simplify as follows:
12<xy<14 and 2x + 3*y>40, is there any way to find the minimum of x using python,
i konw how to solve linear ...
-3
votes
1
answer
2k
views
Comparing inequalities for Go bigInt? [closed]
I am trying to compare two big ints. I'm looking at the docs: https://pkg.go.dev/math/big#Int and I don't see an inequality operator, but I do see an equality one (Cmp).
How am I meant to compare a ...
0
votes
0
answers
165
views
Two-sided inequalities in PHP
In PHP, is there any way to express a two-sided inequality like this:
if( 10 <= $your_price < 15 ){echo 'Bingo!';}
without having to do
if( 10 <= $your_price and $your_price < 15 ){echo '...