# All Questions

Tagged with
14 questions
Filter by
Sorted by
Tagged with
209 views

### How to correctly implement in a new function the scoping behavior of Table, Sum and other commands that use Block to localize iterators?

It is documented that "Block is automatically used to localize values of iterators in iteration constructs such as Do, Sum, and Table." Therefore the dummy index (iterator) in a Sum is shielded ...
75 views

### Local variables in sums and tables - best practices?

Stumbled on Local variables when defining function in Mathematica in math.SE and decided to ask it here. Apologies if it is a duplicate - the only really relevant question with a detailed answer I ...
222 views

### Cumulative total of columns in a matrix or table

I have the following: matrix1 = {{a, b, c, d}, {e, f, g, h}, {i, j, k, l}, {m, n, o, p}} (Note that it's the data that matters, not the fact it's defined as a ...
858 views

### How to speed up large double sums in a table?

I am calculating a 3-by-3 matrix whose elements are given as follows: $$M_{mn} = \frac{1}{N}\sum_{i=1}^N \sum_{j=1}^N (r^i_m - r^j_m)(r^i_n - r^j_n) \tag{1}$$ where $N$ is the total number of ...
506 views

### How to increase the evaluation speed of this somewhat complicated table / matrix operation?

I'd like to calculate the following one-dimensional array: OneDimArray = Table[(Norm[Sum[ MatrixA[[i,j]]VectorB[[j]],{j,N}]])^2,{i,N}] However this takes a very ...
124 views

### tabulating summation series with restrictions

Trying to solve this question for a good 5 hours but remained stuck. My intuition tells me I am missing something trivial that I've overlooked or forgotten. I am restricted only to the function 'table'...
66 views

### Unexpected result given by Sum [closed]

Consider the following (minimal?) working example: ...
53 views

### Sum up different arrays into a new array

I have a question regarding sums in arrays. So I have the following array: ...
59 views

### Summing results of a table

I have a simple table: example1 = Table[N[x^(x/r), 5], {r, 1, 10}, {x, 1, 10}] I want to create a new table ...
401 views

### Summing terms in Table

I have a table that looks like Table[m, {k, 10}, {j, k}, {i, j}] where, m is a square matrix that depends on the indices \$i, ...
37 views

### Partial Sum of Binary Sequence not Working

I have the following code: ...
109 views

### Accessing the elements in a table is slower than calculating each time?

This is a follow-up of How to accelerate combinations and sum calculations here? I have tried all tricks but when N reaches 35 the time is still intimidating in a 16-core server, which is far better ...