Creating a subset of a list according to a condition
I wonder if there is a simple way of creating a subset of a list according to a condition. I encountered this problem a few days ago when I was designing an applet for "Linear Programming". I first constructed a list of integer points (list1). I then tried to create another list (list1_1) which contains the elements of list1 lying in the feasible region (named "sol"), using the command "IsInRegion". Originally I thought that there should be a simple command to do so, and I was surprised that I couldn't find one after looking through all the commands in the "List Commands" category.
I finally found of a way out as follows. Since a boolean variable is assumed the value '1' or '0' for 'true' or 'false', I create another list list1_1 by dividing each element (i, j) in list1 by IsInRegion[(i,j), sol] so that all the elements not in the feasible region would becomes undefined (since they are divided by 0), while all the elements in the feasible region would become unchanged (divided by 1). (See the attached.) We can remove these undefined elements using the command "RemoveUndefined".
I don't know whether this way is the only possible way to achieve my aim. If anyone knows a simpler way please kindly share with us.
(The final ver of "Linear Programming" is upload to GeoGebraTube at https://www.geogebra.org/ma... .