Q:

Calculate function with all values in range?

I am trying to make a mathematical simulation to find when a condition is met. My approach was to define the conditions and make a while loop that increases the values of x and y. See the code below:
# Initialize the variables.

x1list = []
y1list = []
x2list = []
y2list = []

x = 0
y = 0
i = 0

while i < 10:

  # Update data.
  i += 1
  x += .1
  y += .1

  func1 = x + y - 1
  func2 = x * y

  cond1 = func1 < func2 < 1

  if cond1:
    x1list.append(x)
    y1list.append(y)

The problem with this code is that it only calculates the condition when x and y increase at the same rate. Sure, I could change the rates, but that would not really solve the problem.
What I want to do is to calculate the condition in a range, say x(-10,10) and y(-10,10). I was thinking about making an array with all x values and another one with all y values, but, then, I don't know how to calculate the condition with all those values.
Another idea that I had was to take a single value of x and test it with all y values, then increase x and test again and again.
How should I approach this problem?

A:

Method 1: 2D 'simulation' grid

I was thinking about making an array with all x values and another one with all y values, but, then, I don't know how to calculate the condition with all those values.

import numpy as np

x = np.arange(-10, 10, 0.1)
y = np.arange(-10, 10, 0.1)

# Create 2D simulation meshes for x and y.
# You can read the API entry for meshgrid to learn about options for index 
# ordering, mesh sparsity, and memory copying
X, Y = np.meshgrid(x, y)

func1 = X + Y - 1
func2 = X * Y
cond = np.logical_and(func1 < func2, func2 < 1.0) # intrinsic `and` does not work here

# now cond can be used as a 'mask' for any masked-array operations on X and Y
# including for numpy boolean indexing:
print('(X, Y) pairs')
for xy_pair in zip(X[cond], Y[cond]):
    print xy_pair

Method 2: nested loops

Another idea that I had was to take a single value of x and test it with all y values, then increase x and test again and again.

import numpy as np  # no slower or memory-intensive than `from numpy import arange`

X = []
Y = []
for y in np.arange(-10, 10, 0.1):
    for x in np.arange(-10, 10, 0.1):
        if (x+y-1 < x*y) and (x*y < 1.0):
            X.append(x)
            Y.append(y)

print('(X, Y) pairs')
for xy_pair in zip(X, Y):
    print xy_pair

Which method to choose?

How should I approach this problem?

That depends entirely on what you want to do with (x, y) pairs that evaluate to True. If you edit your question with a bit more guidance, it might become obvious which is the more straightforward solution for your use case.
For instance, Method 1 provides 2D arrays for plotting the solution space while Method 2 provides compact python lists for databasing.
Warning: conditional operators
It also must be pointed out that mathematical expressions with multiple conditional operators do not make sense in Python. This line:

cond1 = func1 < func2 < 1

if evaluated using standard order of operations as cond1 = (func1 < func2) < 1 would have an intermediate evaluation of cond1 = (True/False) < 1, which would implicitly recast True as 1 and False as 0, but would not correctly evaluate the mathematical expression func1 < func2 < 1.
EDIT:
@(Eric Duminil)'s answers provide alternative concepts for solving the underlying mathematical problem, the two methods above assumed your problem needed to be solved numerically on a discrete mesh, and that having those discrete solution points was necessary for whatever code followed.
@Uriel's answer may appear to work, but see my note on conditional operators for why that can be misleading.
Also, I originally typed and to combine the 2D conditional statements, but this is incorrect and results in an error. Use np.logical_and instead.

