Re: [sage-support] Re: equation solution in integer
On Sun, Apr 19, 2020 at 7:41 AM Bert Henry wrote: > > > wow, I didn‘t expect, that may „simple“ problem needs such deep math. I will > look for the math of polyhedrons to understand, what you wrote, because in > some number-crosswords (I don‘t know the correct english word) you search for > solutions of the m entioned type. Also you need it in some amphanumerics like > SEND+MORE=MONEY. > my maths teacher pointed to us that when one compares numbers by counting digits, one is actually doing logarithms in base 10 :-) > Thanks a lot for answering > Bert > > > Am Freitag, 17. April 2020 19:17:12 UTC+2 schrieb Bert Henry: >> >> I have the equation >> x + y = 15 >> an I'm looking for solution only in the range x=1..9 and y=1..9, x and y >> both integer >> Is there a sage-command to do that? >> >> Thanks in advance >> Bert Henry > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-support/9f7a36c6-4f04-4767-b116-d5eca7d9ab36%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAAWYfq3GHqeVEVEy%3DEZ5vUbNeg0N%2BKtqD-t4JAs%2BnHnqS1v9Pw%40mail.gmail.com.
[sage-support] Re: equation solution in integer
wow, I didn‘t expect, that may „simple“ problem needs such deep math. I will look for the math of polyhedrons to understand, what you wrote, because in some number-crosswords (I don‘t know the correct english word) you search for solutions of the m entioned type. Also you need it in some amphanumerics like SEND+MORE=MONEY. Thanks a lot for answering Bert Am Freitag, 17. April 2020 19:17:12 UTC+2 schrieb Bert Henry: > > I have the equation > x + y = 15 > an I'm looking for solution only in the range x=1..9 and y=1..9, x and y > both integer > Is there a sage-command to do that? > > Thanks in advance > Bert Henry > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/9f7a36c6-4f04-4767-b116-d5eca7d9ab36%40googlegroups.com.
[sage-support] Re: equation solution in integer
Matthias is hinting at a possible reformulation of the problem as finding integral points in a polyhedron. Let me expand. In RR^2, consider the set S of all (x, y) satisfying: x >= 1 x <= 9 y >= 1 y <= 9 x + y = 15 or if one prefers, -1 + x >= 0 9 - x >= 0 -1 + y >= 0 9 - y >= 0 -15 + x + y = 0 Since all the conditions used to define this set are of one of the following forms: (linear form in x and y) = 0 (linear form in x and y) >= 0 the subset S is what is called a "polyhedron" in R^2. The problem in your original post can now be rephrased as: Find all integral points in the polyhedron S. An introduction to polyhedra in Sage is at: http://doc.sagemath.org/html/en/reference/discrete_geometry/sage/geometry/polyhedron/constructor.html The polyhedron S can be input as S = Polyhedron(ieqs=[[-1, 1, 0], [9, -1, 0], [-1, 0, 1], [9, 0, -1]], eqns=[[-15, 1, 1]]), Check that our input represents the correct polyhedron: sage: print(S.Hrepresentation_str()) x0 + x1 == 15 -x0 >= -9 x0 >= 6 Find all integral points: sage: S.integral_points() ((6, 9), (7, 8), (8, 7), (9, 6)) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/3e9f5212-645d-40ce-bbd1-7549e2bf1f21%40googlegroups.com.