Question about thread
- Subject: [mg2581] Question about thread
- From: sherod at boussinesq.Colorado.EDU (Scott Herod)
- Date: Mon, 27 Nov 1995 21:31:00 -0500
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: University of Colorado at Boulder
I have a question about the way Thread behaves. From the description
in the _Mathematica_ book, I would expect it to return lists. For
example
Mathematica 2.2 for Solaris
Copyright 1988-93 Wolfram Research, Inc.
License valid through 28 Nov 1995.
-- Open Look graphics initialized --
In[1]:= Thread[f[{a,b},x]]
Out[1]= {f[a, x], f[b, x]}
But that doesn't always seem to be the case.
In[2]:= blat[p_, q_] := Module[{}, Plus @@ (Variables[p]^q)]
In[3]:= blat[a+b,x]
x x
Out[3]= a + b
In[4]:= Thread[blat[{a+c,b+d},x]]
x x x x
Out[4]= a + b + c + d
Why isn't Out[4] the same as
In[5]:= Outer[blat, {a+c, b+d} , {x}] // Flatten
x x x x
Out[5]= {a + c , b + d }
Scott Herod
Applied Mathematics
University of Colorado, Boulder
sherod at colorado.edu