Questions tagged [inequalities]

69 questions
0
votes
1 answer

"Counting Inequalities in Heaps"

Does the following code have any errors in terms of counting how many values are less than or equal to a value "z" input by the user? In particular, I would like someone to look at the final function of this code to tell me if there are any errors.…
John Friedrich
  • 343
  • 5
  • 21
0
votes
1 answer

How to solve a combined set of linear equations and inequalities in Matlab?

I have a problem that involves a system of linear equations and inequalities. The problem is defined by Ax = 0 and Cx > 0 (A and C are matrices, x is a vector of variables to be solved for). This problem likely has a range of solutions. I'd like to…
Moot
  • 2,195
  • 2
  • 17
  • 14
0
votes
3 answers

How to use inequalites in cmd code

I was making a code to find square roots for practice with basic cmd coding. However, when I type in a negative number, or an imperfect square, then it goes in an infinite loop. I know how to fix it, but I need to be able to use inequalities( Less…
user1377474
  • 1
  • 1
  • 1
-1
votes
1 answer

How to write an inequality in R

Sorry, I am an R newbie and I am having some difficulty How would I write the following inequality in R: x > 10 is twice more likely than x < 10 I tried this function and it didn't work : X = 10 f = function(X,Y) { if ((2(X) >= 10 & X <= 10) {…
-1
votes
1 answer

fmincon with nonzero inequalities constraint

I want to solve a minimization problem in MATLAB. fmincon(): x = fmincon(fun,x0,Aeq,beq, nonlcon) subjects to the nonlinear inequalities c(x) defined in nonlcon such that c(x) < 0 Is it possible to change c(x) < 0 to c(x) ≤ 0 and use…
-1
votes
2 answers

How to write chained inequalities (a <= b <= c) in if functions

How can you write the following in if functions in R Supposing you have X ranging from 121 to 212 and Y ranges from 122 to 212, how can you write an if function to represents something like: if 121 <= X <= 212 and 122 <= Y <= 212; then do…
user3770793
  • 1
  • 1
  • 2
-1
votes
1 answer

inequalities issue: 0<=-0.0 is not true

I have an if statement within a for loop which runs through a number values of x and calculates a value of h based on the x. I have included the code below. At time zero (t=0.0) xa=-0.0 and xb =0.0. The problem arrises when x=0. At x=0 I want the…
user3771983
  • 37
  • 2
  • 9
-3
votes
1 answer

Comparing inequalities for Go bigInt?

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 big int a to a big int b? Am I meant to subtract b…
Luke
  • 23
  • 3
1 2 3 4
5