Let's consider two tables given by
T1 = Table[{i,j,f1[i,j]},{i,0,2},{j,0,3}];
T2 = Table[{i,j,f2[i,j]},{i,0,2},{j,0,3}];
The functions f1 and f2 are expensive to compute, so that I want to compute the tables T1 and T2 only one time.
I now want to obtain the table T3 defined as
T3 = Table[{i,j,f1[i,j] f2[i,j]},{i,0,2},{j,0,3}];
However, as I already know T1 and T2, I want to estimate T3 without any reevaluation of f1 and f2, but using only operations on the already known tables T1 and T2.
How would you perform such an operation on the lists ?
T1 = Flatten[Table[{i,j,f1[i,j]},{i,0,2},{j,0,3}],1]? – jibe Apr 24 '14 at 06:56T3[[All, 3]] *= T2[[All, 3]];Once you understandPartthis will make sense. :-) There are many other ways, e.g. what chris just posted, but this one is usually faster, and IMHO easier to read once you are familiar withPart. Please see my answer to the linked (duplicate) question for a longer explanation. – Mr.Wizard Apr 24 '14 at 07:02;in the second lineT3[[All, All, 3]] *= T2[[All, All, 3]];, Mathematica displays some strange intermediate expressions which do not correspond to the actual content ofT3. What is the origin of this display which gives rise to confusion ? – jibe Apr 24 '14 at 07:24T3[[All, All, 3]] *= T2[[All, All, 3]]should be simply the content of the third column of each element of the finalT3tensor. Are you sure the content is different? – Mr.Wizard Apr 24 '14 at 07:43T3tensor and not just the third column. This limited display made me believe that Mathemetica had misdone the affectation. Thanks again for your kind help. – jibe Apr 24 '14 at 07:52