Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Kernel crashes in ReplaceAll - with or without Maximize failure

0 views
Skip to first unread message

DrMajorBob

unread,
Nov 23, 2009, 6:54:45 AM11/23/09
to
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

--
DrMaj...@yahoo.com

Sjoerd C. de Vries

unread,
Nov 24, 2009, 5:50:22 AM11/24/09
to
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

> 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 =

> DrMajor...@yahoo.com


dh

unread,
Nov 25, 2009, 2:34:16 AM11/25/09
to

DrMajorBob wrote:

>

> eq /. Last@%

>

>

>

> {5567805932804389/509872338168900, {x -> 7}}

>

> 10.92

>

>

> eq /. Last@%

>

>

> 3 x^2)/10 + x^3/150

>

>

>

>

> eq /. Last@%

>

>

> 3 x^2)/10 + x^3/150

>

>

>

> result:

>

>

>

> 3 x^2)/10 + x^3/150

>

>

>

> eq /. Last@%

>

>

> Same here, without LessEqual:

>

> Maximize[proxy, x, Integers]

>

>

> 3 x^2)/10 + x^3/150

>

>

> eq /. Last@%

>

>

>

> Maximize[proxy, x]

>

>

> 3 x^2)/10 + x^3/150

>

>

> {$Version, $ReleaseNumber}

>

>

> 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

DrMajorBob

unread,
Nov 25, 2009, 11:03:18 PM11/25/09
to
Assuming works, but using Integers as the third argument should also work,
and it doesn't.

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]

Maximize[{1/379250494936462 + (105718301111983 x)/31715490333595 - (


3 x^2)/10 + x^3/150, x <= 20}, x, Integers]

Bobby

On Tue, 24 Nov 2009 03:38:52 -0600, dh <d...@metrohm.com> wrote:

> 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
>
>
>


--
DrMaj...@yahoo.com

0 new messages