f



HoldForm[1*2*3] should give 1 x 2 x 3 not 2 x 3

HoldForm[] is loosing the 1* when it apparently should not:

In[1]:= HoldForm[1*2*3]
Out[1]= 2 x 3

In[2]:= HoldForm[1*1*1]
Out[2]= 1 x 1 x 1

In[3]:= HoldForm[3*2*1]
Out[3]= 3 x 2

In[4]:= HoldForm[2*2*2]
Out[4]= 2 x 2 x 2

In[5]:= HoldForm[2*1*3]
Out[5]= 2 x 3

In[6]:= HoldForm[1*2]
Out[6]= 1 x 2

In[7]:= HoldForm[1*2*1]
Out[7]= 1 x 2 x 1

Q.E.D.



0
aoe (14)
2/25/2009 9:07:18 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

3 Replies
1109 Views

Similar Articles

[PageSpeed] 37

Indeed, the same happens with Hold and HoldComplete. I'd say this is a
bug.

Cheers -- Sjoerd

On Feb 25, 11:07 am, "Q.E.D." <a...@netzero.net> wrote:
> HoldForm[] is loosing the 1* when it apparently should not:
>
> In[1]:= HoldForm[1*2*3]
> Out[1]= 2 x 3
>
> In[2]:= HoldForm[1*1*1]
> Out[2]= 1 x 1 x 1
>
> In[3]:= HoldForm[3*2*1]
> Out[3]= 3 x 2
>
> In[4]:= HoldForm[2*2*2]
> Out[4]= 2 x 2 x 2
>
> In[5]:= HoldForm[2*1*3]
> Out[5]= 2 x 3
>
> In[6]:= HoldForm[1*2]
> Out[6]= 1 x 2
>
> In[7]:= HoldForm[1*2*1]
> Out[7]= 1 x 2 x 1
>
> Q.E.D.


0
2/26/2009 12:52:45 PM
I think the answer is probably hinted at in the help to HoldComplete
(which holds more than HoldForm, but still displays the behaviour you
have mentioned).

"HoldComplete affects only evaluation; input transformations are still
applied:"

Times[1,2,3] -> Times[2,3] is likely an "input transformation" rather
than an evaluation

0
yatesd (39)
2/26/2009 12:53:50 PM
"Q.E.D." <aoe@netzero.net> wrote in message 
news:go31o6$ffv$1@smc.vnet.net...
> HoldForm[] is loosing the 1* when it apparently should not:
>
> In[1]:= HoldForm[1*2*3]
> Out[1]= 2 x 3
>

Another interesting case, is if you replace the above with

In[16]:= HoldForm[1*2*1]
Out[16]= 1 2 1

So, adding a '1' at the end, brings back the '1' at the front?

Mathematica 7.0 on Windows XP SP2

--Nasser


0
Nasser
2/26/2009 1:02:51 PM
Reply: