Linked Questions

4 votes
1 answer
937 views

Using Thread or MapThread over multi-level, ragged lists [duplicate]

This may be a rather strange question. I will try to create a sort of minimal working example. Suppose that I have two lists, list1 and ...
Andrew's user avatar
  • 10.6k
24 votes
6 answers
2k views

MapThread over sublists of different length

I have a list which looks like this: l={{1,0,3,4},{0,2},{0,0,1,3},{1,2,0}}. Now I would like to count how many 0s the sublists contain in the first, second,... slot....
RMMA's user avatar
  • 2,710
21 votes
9 answers
764 views

MapThread with non-rectangular lists

MapThread works fine and dandy with rectangular list structures: MapThread[f, {{{a, b}, {c, d}}, {{1, 2}, {3, 4}}}, 2] <...
wxffles's user avatar
  • 14.2k
8 votes
6 answers
250 views

Duplicate mapped elements in Riffle

What is the best way to do this? in: {a, b, c} {d, {e, f}, g} out: {{a, d}, {b, e}, {b, f}, {c, g}} ...
martin's user avatar
  • 8,678
8 votes
5 answers
1k views

correct way to map a function on entries down the pages in a 3D matrix?

updated: added another method to the methods I tried below for completion. This is new way of doing it, but most likely not very efficient, did not time it I can only visualize 3D matrices in my ...
Nasser's user avatar
  • 144k
6 votes
2 answers
1k views

How to combine elements of two matrices?

Given two matrices m1 and m2, e.g.: m1 = {{a1, b1}, {c1, d1}} m2 = {{a2, b2}, {c2, d2}} How can one obtain the following? ...
dnet's user avatar
  • 958
1 vote
2 answers
402 views

Thread over a nested list top to bottom until non-list elements are found

I have a nested list: list = {1, 2, {3, 4}, f[a], {2, h[b]}} I would like to apply a function g to all elements of the ...
ecoxlinux's user avatar
  • 979
1 vote
2 answers
253 views

Element-wise join multiple lists [closed]

The following question is related to: Elementwise join I have the following code: ...
mrz's user avatar
  • 11.7k
4 votes
1 answer
196 views

Joining table of tuples with table of scalar values [closed]

I have a table of dimension $M \times N \times Q$ of 3-tuples {x,y,z} that represent points, and another table of dimension $M \times N \times Q$ of scalar values. ...
QtizedQ's user avatar
  • 185
3 votes
2 answers
135 views

Add new coordinate to list of lists with different lengths

I want to turn the list list1 = {{a},{b,c},{d,e,f,g}} into { {{1,a}}, {{2,b},{2,c}}, {{3,d}, {3,e}, {3,f}, {3,g}} } How ...
AJHC's user avatar
  • 369