Re: Simplifying with assumptions
- To: mathgroup at smc.vnet.net
- Subject: [mg48988] Re: [mg48949] Simplifying with assumptions
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 25 Jun 2004 17:52:35 -0400 (EDT)
- References: <200406250658.CAA12398@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Mietek Bak wrote: > Hello, > > I'm a complete newcomer to Mathematica, so please excuse this possibly > silly question. > > I'm trying to determine if a formula will ever give an integer result, > assuming that all variables used in it are integer. I've been searching > through the built-in documentation, but my best guess didn't really do > anything: > > Simplify[Element[Sqrt[48 - n^2 + 8*x],Integers],Element[{n, x},Integers]] > > It would be best if I could somehow determine the set of combinations of > variables that would give an integer result -- if there are any. Is > there a way to do that in Mathematica? > > Thanks in advance, > Mietek Bak. I'm not sure what would be a good way to do this sort of thing in general. For relatively simple examples you can make progress if you assign integer values to one parameter, as below. In[7]:= InputForm[Table[ Reduce[{48-n^2+8*x==k^2, Element[{x,k},Integers]}, {x,k}], {n,10}]] Out[7]//InputForm= {False, (C[1] \[Element] Integers && x == -5 + 4*C[1] + 8*C[1]^2 && k == 2 + 8*C[1]) || (C[1] \[Element] Integers && x == -1 + 12*C[1] + 8*C[1]^2 && k == 6 + 8*C[1]), False, (C[1] \[Element] Integers && x == -4 + 8*C[1]^2 && k == 8*C[1]) || (C[1] \[Element] Integers && x == -2 + 8*C[1] + 8*C[1]^2 && k == 4 + 8*C[1]), False, (C[1] \[Element] Integers && x == -1 + 4*C[1] + 8*C[1]^2 && k == 2 + 8*C[1]) || (C[1] \[Element] Integers && x == 3 + 12*C[1] + 8*C[1]^2 && k == 6 + 8*C[1]), False, (C[1] \[Element] Integers && x == 2 + 8*C[1]^2 && k == 8*C[1]) || (C[1] \[Element] Integers && x == 4 + 8*C[1] + 8*C[1]^2 && k == 4 + 8*C[1]), False, (C[1] \[Element] Integers && x == 7 + 4*C[1] + 8*C[1]^2 && k == 2 + 8*C[1]) || (C[1] \[Element] Integers && x == 11 + 12*C[1] + 8*C[1]^2 && k == 6 + 8*C[1])} We see that for n odd we do not get solutions, and for n even we do. It is not hard to show that there are no solutions in the odd case. Putting n^2+k^2 on the right hand side, we have a value divisible by 8 on the left, and a sum of squares on the right. If one of {k,n} is even and the other odd, the sum of squares is odd. If both of {k,n} are odd, the sum of squares is divisible by 2 but not by 4. So the only possible way to get solutions has both of {n,k} even. Daniel Lichtblau Wolfram Research
- References:
- Simplifying with assumptions
- From: "Mietek Bak" <mietek@icpnet.pl>
- Simplifying with assumptions