I have this Solve:
Solve[6x1 + 30x2 + 8x3 + 15x4 - 3x5 + 2x7 == 1325 && -5x1 + 6x4 - x5 + 7x6 + 9x7 == 800 && 10 <= x1 <= 80 && 12 <= x2 <= 146 && 15 <= x3 <= 299 && 9 <= x4 <= 30 && 16 <= x5 <= 172 && 19 <= x6 <= 672 && 8 <= x7 <= 9, {x1, x2, x3, x4,x5, x6, x7}, Integers]
It returns 164254 results, which is very long. Is there a way to limit the number of returns to 100? What I am looking for is a way to avoid situations where Solve wants to return a large amount of data and limit that to some small number, to avoid unnecessary cpu usage. FindInstance is not an options, as it keeps running until I abort:
FindInstance[6x1 + 30x2 + 8x3 + 15x4 - 3x5 + 2x7 == 1325 && -5x1 + 6x4 - x5 + 7x6 + 9x7 == 800 && 10 <= x1 <= 80 && 12 <= x2 <= 146 && 15 <= x3 <= 299 && 9 <= x4 <= 30 && 16 <= x5 <= 172 && 19 <= x6 <= 672 && 8 <= x7 <= 9, {x1, x2, x3, x4,x5, x6, x7}, Integers, 100]
FindInstance[x1 + x2 == 1000000, {x1, x2}, PositiveReals, 10]which gives you 10 results. – Syed Nov 03 '23 at 03:42FindInstancedoes not work you, then I think you are out of luck. Why not just get all the solutions from Solve and then trim them to the number you want? any way. I do not see an option for what you want with Solve. – Nasser Nov 03 '23 at 05:02