Questions tagged [inequality]

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'.

273 questions
9
votes
3 answers

Gini Coefficient in Julia: Efficient and Accurate Code

I'm trying to implement the following formula in Julia for calculating the Gini coefficient of a wage distribution: where Here's a simplified version of the code I'm using for this: # Takes a array where first column is value of wages # (y_i in…
9
votes
15 answers

Comparing IEEE floats and doubles for equality

What is the best method for comparing IEEE floats and doubles for equality? I have heard of several methods, but I wanted to see what the community thought.
Craig H
  • 7,949
  • 16
  • 49
  • 61
9
votes
3 answers

What is the difference between != and <>?

Perhaps this is a rather newbie-ish question, but I'm curious. I have tried searching for it, but I suppose I lack the correct terminology to search properly. Difference between != and <>. On searching again, "inequality", I found one that discusses…
francium
  • 2,384
  • 3
  • 20
  • 29
6
votes
2 answers

Can floating point equality and inequality tests be assumed to be consistent and repeatable?

Assume two floating point numbers x and y, neither of which are Nan. Is it safe to assume that equality and inequality tests will: a. Be consistent with each other: E.g. is the following guaranteed true: (x >= y) == ((x > y) || (x == y)) b. Be…
5
votes
2 answers

Java optimization: speed of inner loops inconsistent?

My friend and I are stumped. In these two blocks of code, why is the first inner loop faster than the second inner loop? Is this some sort of JVM optimization? public class Test { public static void main(String[] args) { int[] arr = new…
Corey Farwell
  • 1,856
  • 3
  • 14
  • 19
5
votes
2 answers

Mathematica: finding the conditions for the real part of a complex number to be positive, unexpected/redundant output of Reduce

I need to find the conditions for the real part of a complex number to be negative. I thought Reduce would be perfect for this, but it gives redundant output (even after simplification). For example: In[543]: Reduce[{Re[-1 - Sqrt[a - b] ] < 0, a >…
mab
  • 153
  • 5
5
votes
4 answers

Java Wrapper's Comparision

public static void main(String[] args) { System.out.println((Integer.valueOf("5000") <= Integer.valueOf("5000"))); System.out.println((Integer.valueOf("5000") == Integer.valueOf("5000"))); } The above code prints true and false…
5
votes
1 answer

Measuring income inequality using the R survey package

I'm working with American Community Survey microdata using the survey package, and am hoping to calculate some basic income inequality statistics. I've set up the following as my design: testsurv <- svrepdesign(data=test, repweights = test[,8:87],…
user115457
  • 51
  • 1
5
votes
1 answer

How to auto prove simple inequality of real numbers in Coq?

Is there a way to automatically prove simple inequalities like 1/2 >= 0?, i.e. Require Export Coq.Reals.RIneq. Local Open Scope Z_scope. Local Open Scope R_scope. Example test: /2 >= 0. I haven't much experience with ring or field, and I am having…
thor
  • 21,418
  • 31
  • 87
  • 173
5
votes
4 answers

Generate a random number larger or smaller than the previous random number

I am trying to generate a random number larger than and smaller than the previous random number, but cannot figure out how. I have this so far: number = (int)( max * Math.random() ) + min; guess = (int)( max * Math.random() ) + min; if…
Sam Mitchell
  • 194
  • 2
  • 18
5
votes
1 answer

Why can't I use operator< on 'std::deque'?

Ran cppcheck on my code base and received the following error: Dangerous iterator comparison using operator< on 'std::deque'. But a deque's iterator is a random access iterator, and random access iterators support inequality operators. So what…
Evan
  • 1,348
  • 2
  • 10
  • 20
4
votes
1 answer

Performance problems: Solving an inequality with several assumptions in Mathematica

I need to prove an inequality (or find a counter example) given several assumptions (also inequalities). Unfortunately the inequality to prove is a quite long and complicated expression. There are about 15 variables and FullSimplify's output fills…
lumbric
  • 7,644
  • 7
  • 42
  • 53
4
votes
2 answers

Python: Pass inequality as string in dict for evaluation

I need to pass inequalities to a function for evaluation within the function. Is there a way to evaluation the inequality if passed as a string? Or must I pass a representation of the inequality and use if/else statements to generate the sign?
Jason Strimpel
  • 14,670
  • 21
  • 76
  • 106
4
votes
0 answers

Oracle Partition Range by Date Precision

My understanding is that there is no fractional second for a Date data type. If that is true, then why do the three queries below not all have Pstart=6 and why do they not all have no filter predicate? That is, for a Date data type is it true that…
4
votes
3 answers

Inequalities and Parenthesis in Python

So in python, truth conditions can be easily checked and with parenthesis it prioritize the order of true conditions, e.g. these are easy to understand: >>> 3 > 2 True >>> (3 > 2) is True True But what does these mean, I couldn't grasp the logic of…
alvas
  • 115,346
  • 109
  • 446
  • 738
1
2
3
18 19