Skip to main content
added 10 characters in body; edited tags
Source Link
rm -rf
  • 89.3k
  • 21
  • 297
  • 479

A simple problem I aam facing is here:

list1 = RandomReal[{1, 2}, {3, 4, 30}];
list2 = RandomReal[{10, 20}, {3, 4, 30}];
Map[Map[(# + 1+Min[#]) &, #] &, #] &/@list1;

works fine, but whenever such a nested Map appears, I think there might be a better solution thatthan what I am doing here. Now my problem is if I want to use a MapThread over thisthe above function like the following, I stumble upon errors

MapThread[Map[Map[(# + 1/Min[#2]) &, #] &, #1] &, {list1, list2}];

Including this example and for even more nested situationsituations, is there any general coding practice that is elegant, efficient and native to MMA functional language paradigm. Hope some one can help me with this type list manipulation here.

A simple problem I a facing is here

list1 = RandomReal[{1, 2}, {3, 4, 30}];
list2 = RandomReal[{10, 20}, {3, 4, 30}];
Map[Map[(# + 1+Min[#]) &, #] &, #] &/@list1;

works fine but whenever such nested Map appears I think there might be a better solution that what I am doing here. Now my problem is if I want to use a MapThread over this above function like the following I stumble upon errors

MapThread[Map[Map[(# + 1/Min[#2]) &, #] &, #1] &, {list1, list2}];

Including this example and for even more nested situation is there any general coding practice that is elegant, efficient and native to MMA functional language paradigm. Hope some one can help me with this type list manipulation here.

A simple problem I am facing is here:

list1 = RandomReal[{1, 2}, {3, 4, 30}];
list2 = RandomReal[{10, 20}, {3, 4, 30}];
Map[Map[(# + 1+Min[#]) &, #] &, #] &/@list1;

works fine, but whenever such a nested Map appears, I think there might be a better solution than what I am doing here. Now my problem is if I want to use a MapThread over the above function like the following, I stumble upon errors

MapThread[Map[Map[(# + 1/Min[#2]) &, #] &, #1] &, {list1, list2}];

Including this example and for even more nested situations, is there any general coding practice that is elegant, efficient and native to MMA functional language paradigm. Hope some one can help me with this type list manipulation here.

Source Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75

MapThread on a nested Map

A simple problem I a facing is here

list1 = RandomReal[{1, 2}, {3, 4, 30}];
list2 = RandomReal[{10, 20}, {3, 4, 30}];
Map[Map[(# + 1+Min[#]) &, #] &, #] &/@list1;

works fine but whenever such nested Map appears I think there might be a better solution that what I am doing here. Now my problem is if I want to use a MapThread over this above function like the following I stumble upon errors

MapThread[Map[Map[(# + 1/Min[#2]) &, #] &, #1] &, {list1, list2}];

Including this example and for even more nested situation is there any general coding practice that is elegant, efficient and native to MMA functional language paradigm. Hope some one can help me with this type list manipulation here.