Re: Raise lists of a list to powers
- To: mathgroup at smc.vnet.net
- Subject: [mg27105] Re: [mg27079] Raise lists of a list to powers
- From: Ranko Bojanic <bojanic at math.ohio-state.edu>
- Date: Sun, 4 Feb 2001 02:58:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Matthias.Bode at oppenheim.de wrote: I have a list of lists {{a,b,c},{d,e,f},{g,h,i},...}. 1. To each value 1 has to be added.(I can do that.) 2. The new values (a+1,b+1,...) have to be raised to a series of powers: a,d,g have to be raised to r; b,e,h have to be raised to s and c,f,i to t. There is no function governing the exponents r,s,t;they are just a list of values like-(1/256) or-(1/12). Map,Thread,Apply&c.so far knew to thwart my efforts most effectively. Thank you very much for your help. Matthias Bode E-mail: matthias.bode at oppenheim.de Internet: http://www.oppenheim.de Matthias: I don't know if I have understood correctly your question. Here is a way to solve problems of this type: If aLst={{a,b,c},{d,e,f},{g,h,i}}; powerLst={r,s,t}; then Transpose[Transpose[aLst+1]^powerLst] gives the list {{(1+a)^r, (1+b)^s, (1+c)^t}, {(1+d)^r,(1+e)^s,(1+f)^t}, {(1+g)^r,(1+h)^s,(1+i)^t}} If you wanted the list {{1+a^r, 1+b^s, 1+c^t}, {1+d^r,1+e^s,1+f^t}, {1+g^r,1+h^s,1+i^t} you should use Transpose[Transpose[aLst]^powerLst+1] Regards, Ranko