Linked Questions

2
votes
1answer
2k views

Simple subtraction question [duplicate]

I have two lists. a = {{2, 2}, {3, 3}, {4, 4}, {5, 5}}; b = {1, 1}; I want to subtract a from ...
1
vote
2answers
188 views

How to extend “List-of-numbers-with-number” arithmetic to “List-of-X-with-X” arithmetic? [duplicate]

I'll start with a couple of examples (since this is all one can get from the documentation anyway). First, adding lists of numbers equal length is done term-by-term. E.g. ...
2
votes
1answer
285 views

adding offset to a list of points [duplicate]

I'm trying to duplicate this behaviour: {a,b,c}+1={a+1,b+1,c+1} in two dimensions. In other words I want to have: ...
3
votes
0answers
80 views

Extending listability to coordinates [duplicate]

I noticed that one can subtract a since real number value from all elements in an array by writing something like {5, 4, 3, 2, 1} - 5 which outputs ...
533
votes
19answers
133k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
41
votes
5answers
6k views

How to implement the general array broadcasting method from NumPy?

A friend of mine introduced array broadcasting in the Python NumPy package which is very convenient (and also highly efficient). The idea is perfectly shown in ...
18
votes
6answers
6k views

Multiplying two dimensional data by a constant

I have a list of lists of the form: {{1, 2}, {2, 4}, {2, 8}} But I want to multiply only the second dimension of that data by a constant. I know I could do this ...
12
votes
8answers
832 views

How to use Map inside MapThread?

Given this input lst1 = {{a, b, c}, {d, e, f}}; lst2 = {1, 2}; and the goal is to generate this output ...
9
votes
6answers
488 views

Adding list of list to a list

Hello I need some help on how to add a list to a list of list. The program would have to do as below: {{0,0}, {0}, {0,0,0}}+{1,2,3,4,5,6} will give ...
8
votes
3answers
334 views

Improving Map Function on Lists

Dealing with spectral data (2D lists) where offsets (corresponding 1D list) must be removed from each individual spectrum. Looking for feedback on improvements over my current method. ...
7
votes
3answers
332 views

Mapping a function over the parts of a deeply nested Array

I have two tensors: tensorS = Array[Subscript[s, #1, #2, #3, #4] &, {2, 16, 16, 19}]; tensorR = Array[Subscript[r, #1, #2, #3] &, {2, 16, 19}]; ...
5
votes
4answers
225 views

Greater operator should give greater element [duplicate]

4>3 gives True. What is the "greater_operator" to obtain the result 4? For lists accordingly: ...
3
votes
3answers
727 views

How to multiply specific columns in a matrix of data?

So I need to make a plot of some ~2000 data points I have from a spreadsheet. I'm able to import the data just fine, it stores it like so sundat {{280.,0.082},{...
7
votes
1answer
436 views

MapThread Alternatives

I want to add two matrices, the first one containing a 2D vector at each position the other one a list of 2D vectors. The 2D vector from the first matrix should be added to each of the 2D vectors at ...
7
votes
2answers
143 views

multiplying/dividing two unequal lists

I have two list which are not equal dimension: listA = {{{1, 2}, {2, 2}, {3, 4}}, {{1, 1}, {2, 2}, {3, 3}}}; listB = {{4, 4}, {5, 5}}; And I want to divide them ...

15 30 50 per page