Re: [Q] Thread ??
- Subject: [mg2723] Re: [Q] Thread ??
- From: B.W.v.d.Zwet at stud.tue.nl ("Bart van der Zwet")
- Date: Sat, 9 Dec 1995 01:56:19 -0500
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
Hello mma-users,
A while ago Scott Herod posted a question on the mathgroup.
A number of people responded to this with the answer to use Unevaluated or
some trick like that.
In[1]:= blat[p_,q_]:=Module[{}, Plus @@ (Variables[p]^q)]
In[2]:= blat[{a+c,b+d},x]
Out[2]:= a^x + b^x + c^x + d^x
In[3]:= Outer[blat,{a+c,b+d},{x}] // Flatten
Out[3]:= {a^x + c^x, b^x + d^x}
If this is the output you want blat to produce then you can also do :
In[4]:= SetAttributes[blat, Listable]
In[5]:= blat[{a+c,b+d},x]
Out[5]:= {a^x + c^x, b^x + d^x}
Yours,
Bart van der Zwet
Student Mathematics
Eindhoven University of Technology
The Netherlands
e-mail : B.W.v.d.Zwet at stud.tue.nl