Re: powersum with a function with variable count of parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg25303] Re: [mg25262] powersum with a function with variable count of parameters
- From: Matt.Johnson at autolivasp.com
- Date: Tue, 19 Sep 2000 03:45:28 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Peter-
In[12]:=
f[x_, power_List] := Plus @@ Map[Power[x, #] &, power]
In[14]:=
f[10, {1, 2, 3}]
Out[14]=
1110
In[15]:=
f[a, {x, y, z}]
Out[15]=
(a^x + a^y + a^z)
-matt
"Klamser" <Klamser at t-online.de> on 09/17/2000 02:47:49 AM
cc:
Subject: [mg25303] [mg25262] powersum with a function with variable count of
parameters
Hi,
how can I write a function f[x_,xi__]=10^x+10^xi, that returns
f[1,2,3]->10^1+10^2+10 ^3.
When i use the above definition, I only get
10^1+10^2^3
But I want to get
10^1+10^2+10 ^3
Regrads, Peter