Linked Questions

2 votes
1 answer
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 ...
user2987529's user avatar
2 votes
1 answer
505 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: ...
Shb's user avatar
  • 701
1 vote
2 answers
238 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. ...
kjo's user avatar
  • 11.7k
3 votes
0 answers
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 ...
ZWei's user avatar
  • 53
602 votes
19 answers
156k 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 ...
52 votes
6 answers
11k 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 this ...
matheorem's user avatar
  • 17.1k
22 votes
9 answers
8k 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 ...
Matthew Kemnetz's user avatar
15 votes
8 answers
1k 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 ...
Nasser's user avatar
  • 143k
12 votes
8 answers
678 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 ...
Mr. Pi's user avatar
  • 391
3 votes
4 answers
2k 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},{...
Amara's user avatar
  • 33
8 votes
3 answers
392 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. ...
OpticsMan's user avatar
  • 576
7 votes
3 answers
414 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}]; ...
bst's user avatar
  • 127
5 votes
4 answers
239 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: ...
mrz's user avatar
  • 11.7k
9 votes
4 answers
380 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 ...
atapaka's user avatar
  • 3,954
7 votes
1 answer
523 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 ...
Wizard's user avatar
  • 2,720

15 30 50 per page