[Date Index]
[Thread Index]
[Author Index]
RE: RE: Help to clarify 'Map', 'Apply', and ' Thread'.
*To*: mathgroup at smc.vnet.net
*Subject*: [mg15712] RE: [mg15702] RE: [mg15626] Help to clarify 'Map', 'Apply', and ' Thread'.
*From*: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
*Date*: Fri, 5 Feb 1999 03:42:12 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
Earlier I asked what one might do with the third argument for Thread.
***The help browser says******
Thread[f[args], h, n]
threads f over objects with head h that appear in the first n args.
Thread[f[args], h, -n]
threads over the last n args.
Thread[f[args], h, {m, n}]
threads over arguments m through n.
*********************
After a while I was able to come up with some meaningful examples of
what this does. First I clear all global variables. The examples are
given below and pretty much do what the help browser says.
In[1]:=
Clear["Global`*"]
In[62]:=
lst1=f[
g[x1,y1],
g[x2,y2],
g[x3,y3],a,b,c];
Thread[lst1,g,3]
Out[62]=
g[f[x1,x2,x3,a,b,c],f[y1,y2,y3,a,b,c]]
In[63]:=
lst2=f[a,b,c,
g[x1,y1],
g[x2,y2],
g[x3,y3]];
Thread[lst2,g,-3]
Out[63]=
g[f[a,b,c,x1,x2,x3],f[a,b,c,y1,y2,y3]]
In[64]:=
lst3=f[a,
g[x1,y1],
g[x2,y2],
g[x3,y3],c,d];
Thread[lst3,g,{2,4}]
Out[64]=
g[f[a,x1,x2,x3,c,d],f[a,y1,y2,y3,c,d]]
In[65]:=
Thread[lst3,g,{2,-3}]
Out[65]=
g[f[a,x1,x2,x3,c,d],f[a,y1,y2,y3,c,d]]
Cheers,
Ted Ersek
Prev by Date:
**Re: Mathematica as an Object**
Next by Date:
**FindRoot question (number of variables)**
Previous by thread:
**Displaying the intermediate steps of an evaluation**
Next by thread:
**FindRoot question (number of variables)**
| |