how to solve more inequalities all together instead of one by one by using sagemath?

83 Views Asked by At

If I want to solve two or more inequalities in the same input like those ones:

solve((x-1)<8,x)

solve((x-1)<15,x)

I would like to have the two solution all together. But in the output I have only the solution of the last inequality.

How to create a vector of inequalities as in put and a vector of solution as output?

1

There are 1 best solutions below

1
On BEST ANSWER

If you add multiple variables, then you can solve separate inequalities with one call to solve. For your example:

sage: x,y = var('x,y')
sage: solve([x-1 < 8, y-1 < 15], x, y) # solve the list of inequalities for x and y
[[x < 9, y < 16]]

I hope this helps ^_^