find_instance function
A point that meets a condition, or an empty list when there is none.
How to write it
find_instance(condition, variables, domain)
Over the reals or the integers; a point of a curved region comes as fractions that meet it.
- condition
- The condition; join several with and. Takes a condition, true or false.
- variables
- A variable, or a list of variables such as [x, y]. Takes a variable, or a list of variables.
- domain
Examples
find_instance(x + y > 10 and x - y < 2 and x < 5, [x, y], real)In the solver,
Open in the solverfind_instance(x + y > 10 and x - y < 2 and x < 5, [x, y], real)gives[[x -> 9/2, y -> 6]].find_instance(x^2 + y^2 = 1 and x > 3/5 and y > 3/5, [x, y], real)In the solver,
Open in the solverfind_instance(x^2 + y^2 = 1 and x > 3/5 and y > 3/5, [x, y], real)gives[[x -> 21/29, y -> 20/29]].find_instance(x^2 + y^2 = 50 and x > y and y > 0, [x, y], integer)In the solver,
Open in the solverfind_instance(x^2 + y^2 = 50 and x > y and y > 0, [x, y], integer)gives[[x -> 7, y -> 1]].
Related functions
- find_root
Find a root numerically, from a starting value.
- eliminate
Eliminate variables from a system of equations, leaving equations in the others.
- least_squares
The least-squares solution of A x = b.
- solve_identity
Find the values of the parameters that make an equation true for every value of the variable.
- linear_solve
Solve a linear system A x = b given by its matrix and right-hand side.
- solve_all
Describe the complete solution set of equations and inequalities.