Re: Re: Solving Alphametics with Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg38678] Re: [mg38640] Re: [mg38638] Solving Alphametics with Mathematica
- From: Andrzej Kozlowski <andrzej at platon.c.u-tokyo.ac.jp>
- Date: Sat, 4 Jan 2003 07:26:34 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Actually, I made a mistake in my message by copying the wrong code from my notebook. The code: NMinimize[{Abs[eq], a == 4 && 0 <= b <= 9 && 0 <= e <= 9 && 1 <= g <= 9 && 0 <= l <= 9 && 0 <= m <= 9 && 0 <= s <= 9 && ss && Element[a | b | e | g | l | m | s , Integers]}, Variables[eq]] also works on my machine, what does not work is: NMinimize[{Abs[eq], 0<=a<=9 && 1 <= b <= 9 && 0 <= e <= 9 && 1 <= g <= 9 && 0 <= l <= 9 && 0 <= m <= 9 && 0 <= s <= 9 && ss && Element[a | b | e | g | l | m | s , Integers]}, Variables[eq]] However, the latter code seem to work on Allan's Microsoft Windows version of 4.2, which isn't any newer than mine (?) On Saturday, January 4, 2003, at 04:11 AM, Daniel Lichtblau wrote: > >> [...] and then tried: >> >> NMinimize[{Abs[eq], a == 4 && 0 <= b <= 9 && >> 0 <= e <= 9 && 1 <= g <= 9 && 0 <= l <= 9 && >> 0 <= m <= 9 && 0 <= s <= 9 && ss && >> Element[a | b | e | >> g | l | m | s , Integers]}, Variables[eq]] >> >> but disappointingly NMinimize was unable to find any solution that >> gave >> 0 for the minimum of Abs. > > You need to upgrade (to our in-house development kernel). > > In[6]:= NMinimize[{Abs[eq], a == 4 && 0 <= b <= 9 && > 0 <= e <= 9 && 1 <= g <= 9 && 0 <= l <= 9 && > 0 <= m <= 9 && 0 <= s <= 9 && ss && > Element[a | b | e | > g | l | m | s , Integers]}, Variables[eq]] > > Out[6]= {0., {a -> 4, b -> 7, e -> 3, g -> 1, l -> 5, m -> 9, s -> 8}} > > > Daniel > > Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/