       issues with expression manipulation functions

• To: mathgroup at smc.vnet.net
• Subject: [mg128267] issues with expression manipulation functions
• From: Alex Krasnov <akrasnov at eecs.berkeley.edu>
• Date: Wed, 3 Oct 2012 03:07:09 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-newout@smc.vnet.net
• Delivered-to: mathgroup-newsend@smc.vnet.net

```In the process of learning Mathematica, I discovered several items of
unusual behavior. I would appreciate any clarification.

(0) Several expression manipulation functions behave correctly with
HoldComplete subexpressions but not with Hold subexpressions. Example:

In:	Together[1/x+HoldComplete/x]
Out:	(1 + HoldComplete)/x

In:	Together[1/x+Hold/x]
Out:	x^(-1) + Hold/x

Another example:

In:	Factor[3+3*HoldComplete[x]+HoldComplete[x]^2, Extension -> {Sqrt, I}]
Out:	((-3*I + Sqrt - (2*I)*HoldComplete[x])*(3*I + Sqrt + (2*I)*HoldComplete[x]))/4

In:	Factor[3+3*Hold[x]+Hold[x]^2, Extension -> {Sqrt, I}]
Out:	(kernel crash)

Although the last example is clearly a bug, is there some difference in
behavior between HoldComplete and Hold that generally accounts for these
issues? The documentation mentions differences with respect to Sequence,
Unevaluated, Evaluate, and upvalues. Without knowing the internals of the
expression manipulation functions, I fail to see how any of these are
relevant here.

(1) FactorTerms behaves incorrectly if the independent form is more
complex than a symbol and not contained in the expression. Example:

In:	FactorTerms[x, x^2]
Out:	Sqrt[x]

In my understanding, FactorTerms should always return an equivalent
expression. Is this a bug or some sort of undocumented behavior? Does
FactorTerms require the independent form to be a symbol?

I am using Mathematica 8.0.4 on Windows.

Alex

```

• Prev by Date: How to speed up this inner loop?
• Next by Date: Sum pattern
• Previous by thread: How to speed up this inner loop?
• Next by thread: Re: issues with expression manipulation functions