MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Kernel crashes in ReplaceAll - with or without Maximize failure


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

-- 
DrMajorBob at yahoo.com


  • Prev by Date: Re: Setting global InputAutoReplacements
  • Next by Date: Re: Setting global InputAutoReplacements
  • Previous by thread: Re: A little C program calling MathLink
  • Next by thread: Re: Kernel crashes in ReplaceAll - with or without Maximize failure