If I have list1={x^a, x^b, x^c}
and list2={1,2,3}
, how do I substitute one into the other to get {1^a, 2^b, 3^c}
? ie. substitution of x
Edit: I need help with a more complicated example. Namely this:
If I have list1={e^(u[1]+a[1]), e^(u[2]+a[2]), e^(u[3]+a[3])}
and list2={1,2,3}
, how do I substitute one into the other to get {e^(1+a[1]), e^(2+a[2]), e^(3+a[3])}
? ie. substitution of u[i]
MapThread
with pure functions:MapThread[#1 /. x -> #2 &, {list1, list2}]
. $\endgroup$ – Szabolcs Oct 30 '15 at 13:03