[Date Index]
[Thread Index]
[Author Index]
Listable
*To*: mathgroup at yoda.physics.unc.edu
*Subject*: Listable
*From*: toet at sunwise.tm.tno.nl (Lex Toet)
*Date*: Thu, 28 Apr 94 10:05:47 +0200
To MathGroup:
the Mma book states that Listable is equivalent to Thread[f[args]] (p. 274)
I want to apply a function to corresponding elements of several 2D matrices of
identical dimensions.
I found that making the function Listable does the job, just like MapThread
with level 2.
I do not understand this, since Listable should apply the function at level 1,
not level 2.
In[1]:= m1={{a,b},{c,d}};
In[2]:= m2={{A,B},{C,D}};
In[3]:= Thread[f[m1,m2]]
Out[3]= {f[{a, b}, {A, B}], f[{c, d}, {C, D}]} <- applies f at level 1, like expected
In[4]:= MapThread[f,{m1,m2},2]
Out[4]= {{f[a, A], f[b, B]}, {f[c, C], f[d, D]}} <- applies f at level 2
In[5]:= SetAttributes[f,Listable]
In[6]:= f[m1,m2]
Out[6]= {{f[a, A], f[b, B]}, {f[c, C], f[d, D]}} <- applies f at level 2 !?
So how can Listable be equivalent to Thread ???????
Prev by Date:
**Re: how to simplify Log[E^(2/3 x^(3/2))] ?**
Next by Date:
**long algebraic equations + simplification**
Previous by thread:
**ODE plus Algebraic eqns**
Next by thread:
**long algebraic equations + simplification**
| |