lists and inequalities

artydent shared this problem 2 months ago
Not a Problem

First question: Is Geogebra supposed to support lists of inequalities (e.g. {x+2y<=5, x>=0, y-2x>=1})? Or is it something that Geogebra just doesn't complain about but we shouldn't expect reliable results?


If such lists are supported then I might have been stumbled upon a bug:


I was using such lists of inequalities, and it seemed worked fine, but now I am noticing that I sometimes get wrong results with swapped variables x and y.

19d6346a9a505865c54124b6a3cde2cc

I can't always reproduce it. So far I only got those problems when using the Iteration to construct a conjunction of inequalities from such a list:

L_0 = {x + 2y ≤ 5, 2x + y ≤ 6, x - 2y ≥ 0, y ≥ 0}
Element(Iteration(Flatten({Element(L, 1) ∧ Element(L, 2), If(Length(L) < 3, {}, Take(L, 3))}), L, {L_0}, Length(L_0) - 1), 1)

And I think (not quite sure though) the problem only ever started to happen when there was an inequality containing only one variable (e.g. "y>=0"), in which case this inequality and/or some of the following in the list produced swapped "x" and "y" in the constructed conjunction. Once that problem had occurred, only changing the list (e.g. replacing "y>=0 by "0x+y>=0" would sometimes rectify the problem, but not always. Often, such problems would keep occurring even when those one-variable inequalites were replaced or removed.

Comments (5)

photo
1

replacing "y>=0" by "0x+y>=0"

That sounds like the solution - you need to make sure lists contain only the same "type" of object

photo
1

So I guess when it comes to inequalities, there are three types (like the https://help.geogebra.org/t... suggests):

  • polynomial inequalities in one variable
  • quadratic inequalities in two variables
  • inequalities linear in one variable

Is that correct? Or are there different types in this context?

And as long as I stick to one type, working with lists is safe?


Is there a way (via scripting if necessary) to access the internals of an inequality somehow to make a new inequality out of it? For equations (which are also automatically simplified in a certain way) there is LeftSide and RightSide, but I couldn't find anything like that for inequalities.

Or alternatively, is there a way to construct an inequality (or any other object for that matter) from a suitable text object?

photo
1

Try Min() and Max() to get the boundaries of an inequality

photo
1

I guess Min() and Max() only work for inequalities with just one variable, or am I missing something?

Anyway, I am handling this with Javascript now.

photo
photo
1

if I have in:y>=0 and I do x>=-infinite&&in then do I get the type equal to x+y>=0 ?

© 2021 International GeoGebra Institute