Distribute
- Subject: [mg2808] Distribute
- From: SEIKENA at gar.union.edu ("Arnold Seiken")
- Date: Tue, 19 Dec 1995 02:41:01 -0500
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
What is the rhyme or reason to the way Distribute works?
In[57]:=
Distribute[h[{a,b,c}, {1,2,3}], List]
Out[57]=
{h[a, 1], h[a, 2], h[a, 3], h[b, 1], h[b, 2], h[b, 3], h[c, 1], h[c, 2],
h[c, 3]}
In[58]:=
%/.h->Plus
Out[58]=
{1 + a, 2 + a, 3 + a, 1 + b, 2 + b, 3 + b, 1 + c, 2 + c, 3 + c}
But,
In[59]:=
Distribute[Plus[{a,b,c}, {1,2,3}], List]
Out[59]=
{{1 + a, 2 + b, 3 + c}}
and,
In[56]:=
Distribute[Plus[{a,b,c}, {1,2,3,4}], List]
Thread::tdlen: Objects of unequal length in {a, b, c} + {1, 2, 3, 4}
cannot be combined.
Out[56]=
{1 + a, 2 + a, 3 + a, 4 + a, 1 + b, 2 + b, 3 + b, 4 + b, 1 + c, 2 + c, 3 + c,
4 + c}