I'm looking for the best function to apply the product of the last two elements of sublist elements to each element:
Example:
(*Input:*)
{{x1, y1, z1}, {x2, y2, z2}, ...}
(*Desired output:*)
{{x1, y1, z1, y1 z1}, {x2, y2, z2, y2 z2}, ...}
I know I could just use a Do
loop with an index k
and do it element by element with AppendTo
, but I guess there is a faster method.