Serious bug in FunctionExpand

• To: mathgroup at smc.vnet.net
• Subject: [mg25632] Serious bug in FunctionExpand
• From: Jack Goldberg <jackgold at math.lsa.umich.edu>
• Date: Mon, 16 Oct 2000 03:04:50 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi group;

I'll cut to the quick (whatever that means):

Let
p[x] = x^6-x^4+2x-10

This polynomial has two real root, x1 = 1.4774 and x2 = -1.4774.
The remaining 4 roots are complex with moderately sized imaginary parts. A
simple plot shows that  p[x] > 0  whenever x is exterior to [-x1,x2] and
is < 0 in (x1,x2).  From this we can conclude that

UnitStep[ p[x] ] = 1  for x exterior to (x1,x2)
UnitStep[ p[x] ] = 0  for x interior to (x1,x2)

We find

FunctionExpand[ UnitStep[p[x] ] -> 0

a terrible error from my perspective!  (I will now have to rewrite a key
component of my package on Piecewise Functions.)

I have done some exploring and can offer the following tidbits:

(1). Change 10 (the constant term in p[x]) to 10. and FunctionExpand gives
the correct answer as can be verified by Ploting the output of
FunctionExpand with UnitStep[ p[x] ].

(2). FunctionExpand gives the incorrect answer for almost all (but not
all!) changes in the constant term. Try the polynomial family

Table[ p[x_,k_] := x^6-x^4+2x - k, {k,30,120}]

(3). I believe part of the problem is due to the fact that p[x] is a cubic
in x^2.  I have tried many different polynomials and never had a problem
with FunctionExpand until I accidentally hit upon this one.

(4).  FunctionExpand fails with the 12th degree polynomial

q[x] = x^12-x^8+2x^4-10

obtain from p[x] by replace x with x^2.  BUT it works with

h[x] = x^3-x^2+2x-10

obtained from p[x] by replacing x^2 by x.

```

• Prev by Date: Re: Displaying 3D data as 2D + color ?
• Next by Date: A function to evaluate only parts matching a pattern
• Previous by thread: Re: Displaying 3D data as 2D + color ?
• Next by thread: A function to evaluate only parts matching a pattern