Re: Kernel crashes in ReplaceAll - with or without Maximize failure
- To: mathgroup at smc.vnet.net
- Subject: [mg105241] Re: Kernel crashes in ReplaceAll - with or without Maximize failure
- From: dh <dh at metrohm.com>
- Date: Wed, 25 Nov 2009 02:33:46 -0500 (EST)
- References: <hedt65$lnj$1@smc.vnet.net>
DrMajorBob wrote: > Two years ago this worked properly, with the output shown: > > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > proxy = Rationalize[eq, 10^-15] > Maximize[{proxy, x \[Element] Integers, x <= 20}, x] > eq /. Last@% > > 1.96128*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 > > 1/509872338168900 + (10 x)/3 - (3 x^2)/10 + x^3/150 > > {5567805932804389/509872338168900, {x -> 7}} > > 10.92 > > Today the same code outputs a Maximize failure and crashes the kernel: > > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > proxy = Rationalize[eq, 10^-15] > Maximize[{proxy, x \[Element] Integers, x <= 20}, x] > eq /. Last@% > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 > > 1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150 > > Maximize[{1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150, x \[Element] Integers, x <= 20}, x] > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 /. x > > Ditto with this code (moving Integers to the third argument): > > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > proxy = Rationalize[eq, 10^-15] > Maximize[{proxy, x <= 20}, x, Integers] > eq /. Last@% > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 > > 1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150 > > Maximize[{1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150, x <= 20}, x, Integers] > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 /. Integers > > Odder yet, the kernel doesn't crash in Fit, Rationalize, or even Maximize, > but rather, in ReplaceAll (which does nothing), yet AFTER the FE outputs a > result: > > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > proxy = Rationalize[eq, 10^-15] > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 > > 1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150 > > Maximize[{proxy, x <= 20}, x, Integers] > > Maximize[{1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150, x <= 20}, x, Integers] > > eq /. Last@% > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 /. Integers > > Same here, without LessEqual: > > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > proxy = Rationalize[eq, 10^-15] > Maximize[proxy, x, Integers] > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 > > 1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150 > > Maximize[1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150, x, Integers] > > eq /. Last@% > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 /. Integers > > And same here, after outputting a correct result: > > data = {{0, 0}, {10, 10}, {20, 0}, {30, 10}}; > eq = Fit[data, {1, x, x^2, x^3}, x] > proxy = Rationalize[eq, 10^-15] > Maximize[proxy, x] > > 2.63678*10^-15 + 3.33333 x - 0.3 x^2 + 0.00666667 x^3 > > 1/379250494936462 + (105718301111983 x)/31715490333595 - ( > 3 x^2)/10 + x^3/150 > > {\[Infinity], {x -> \[Infinity]}} > > {$Version, $ReleaseNumber} > > {"7.0 for Mac OS X x86 (64-bit) (February 19, 2009)", 1} > > What's going on???? > > Bobby > Hi Bobby, with version 7.0.1 on Vista, the following does not evaluate: Maximize[{proxy, x \[Element] Integers, x <= 20}, x] The parser seems to have problems with: x \[Element] Integers It seems to work if one put this condition in an "Assuming": Assuming[x \[Element] Integers, Maximize[{proxy, x <= 20}, x]] Daniel