Re: Kernel crashes in ReplaceAll - with or without Maximize failure
- To: mathgroup at smc.vnet.net
- Subject: [mg105208] Re: Kernel crashes in ReplaceAll - with or without Maximize failure
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Tue, 24 Nov 2009 05:50:02 -0500 (EST)
- References: <hedt65$lnj$1@smc.vnet.net>
Hi Bobby, I don't get a crash, and my older Mathematica system doesn't handle this code any better than the new one. Both 5.2 and 7.01 report the same ReplaceAll warning and the ouput is the same apart from a difference in the very small constant term. Cheers -- Sjoerd On Nov 23, 1:54 pm, DrMajorBob <btre... at austin.rr.com> 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 > > -- > DrMajor... at yahoo.com