# Tagged Questions

Questions on optimizing Mathematica code for higher performance. This may mean faster execution, lower memory usage or both. Not to be confused with mathematical optimization.

663 views

### How to find all the positions of max value of a list efficiently?

For Example, list=RandomInteger[{1,100},2000]. Yes,I know Position[list,Max[list]] can do. But it's based on pattern matching!...
89 views

### Orthogonality relations of Hermite polynomials

The Hermite polynomials are orthogonal. $$\int_{-\infty}^\infty H_m(x) H_n(x) e^{-x^2}\, \mathrm{d}x = \sqrt{ \pi} 2^n n! \delta_{nm}$$ Does Mathematica not use this relationship? Because running <...
716 views

### Why is calling Dot with many arguments so inefficient?

Say I want to multiply a reasonably large list of symbolic matrices. ...
580 views

### Performance problems in new Sequence functions

The new-in-10.1 Sequence* family of functions should provide newly optimized methods for handling sequence problems. Happily in some cases they do! For example ...
130 views

### Constructing lists in an efficient way

I have a list of functions and I want to separate them into two lists: a list that contains the functions that have at least one zero and a list that contains the functions that do not have ...
53 views

### NaNs in tabular data and import performance

I'm working with some data files that are just too large for Import. I tried using ReadList, specifying either ...
57 views

### Returning functions that are partly evaluated

I have some performance issues when calling Table[{h, Slow1[h, n]}, {n, nlist}, {h, 0.1, 10, 0.5}]; for a given list ...
309 views

### Why does partitioning increase Dot execution speed?

I have noticed that multiplying a list of matrices can be significantly sped up by partitioning the list, calculating the product of the partitions matrices, and then multiplying the results. ...
46 views

### What is the right way to remove head of a number? [duplicate]

I often have a number for which I want to remove its head, e.g. {1}. I know of two ways to remove the head: {1}[[1]] # & @@ {1} Neither of these methods seem ...
266 views

Observe: ...
139 views

### Slow program- Mathematica shuts down

I've been trying to draw dynamic pictures of level sets of certain polynomials. The code right now looks like that : ...
157 views

### Combinatorics: Placed errors

Consider a vector of length n where each element can take one of the values U, X, ...
106 views

### Speed up the auxiliary function magicSquare when $n$ is doubly-even

Today, I saw a question about magic square (please see here). When $n$ is doubly-even, namely for Mod[n,4]==0 ...
100 views

### Computing the coefficients for Gaussian integral

I wrote a small script to find the Gaussian integral points and weights: ...
99 views

### Is it possible to sum the results of a Map - Apply?

I am fairly new to functional programming and would like to replace a For[] loop that sums the results over a Dataset. This may be a bit different since the ...