Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help to clarify 'Map', 'Apply', and 'Thread'.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15713] Re: Help to clarify 'Map', 'Apply', and 'Thread'.
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 5 Feb 1999 03:42:13 -0500 (EST)
  • References: <795386$kd1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ersek, Ted R wrote in message <795386$kd1 at smc.vnet.net>...

>As I said at the beginning the third argument of Thread can be an
>integer (positive or negative) or a list of such integers, but I don't
>know what this might do for you.

Ted,
Hope these examples will help:

Make h[ f threads through elements of f[..] with head h ] ( all other
elements of f[..] regarded as atomic)

In[1]:=
Thread[
          h[1, 2],
          k[1, 2],
          h[1, 2]
     ],
     h
]

Out[1]=
    h[
      f[1, k[1, 2], 1],
      f[2, k[1, 2], 2]
    ]

Make h[ f threads through elements of f[..] with head h that are in
positions 1 through 2] ( all other elements of f[..] regarded as
atomic)

In[2]:=
Thread[
          h[1, 2],
          k[1, 2],
          h[1, 2]
     ],
     h,
    {1,2}
]

Out[2]=
h[
   f[1, k[1, 2], h[1, 2]],
   f[2, k[1, 2], h[1, 2]]
]


Elements threaded through must be of same length.

In[3]:=
Thread[f[h[1, 2], h[1]], h]

Thread::"tdlen": "Objects of unequal length in \!\(f[\(\(h[\(1, 2\)]\),
\ \(h[1]\)\)]\) cannot be combined."

Out[3]=
f[h[1, 2], h[1]]

Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565





  • Prev by Date: Re: Help to clarify 'Map', 'Apply', and 'Thread'.
  • Next by Date: Re: a tricky limit
  • Previous by thread: Re: Help to clarify 'Map', 'Apply', and 'Thread'.
  • Next by thread: RE:Help to clarify 'Map', 'Apply', and 'Thread'.