New answers tagged

2 votes

Speed up calculation of recursively defined list

a[i_] = i; b[i_] = -i; RecurrenceTable[{θ[i] == a[i] θ[i - 1] - b[i - 1]^2 θ[i - 2], θ[0] == 1, θ[1] == a[1]}, θ, {i, 1, 1000}]
  • 45.8k
3 votes

Speed up calculation of recursively defined list

A common approach to speed recursive calculations like this is memoization. In Mathematica, this can be as simple as using the ...
1 vote

Why association slows down compiled function in the following example?

SelDataAssociation is 3x slower because it calls SelDataCompiled 3 times. Are you looking for a convenient way to call your ...
3 votes
Accepted

Is there any way to speedup the list selection further?

This is quite fast. Does it compile too? (I haven't installed a compiler.) ...
2 votes

How to speedup comparison in the following example?

If one avoids repetition and explicit iteration, then one get fast code without compiling: ...
  • 10.8k
2 votes
Accepted

How to speedup comparison in the following example?

You forgot to inline the zmin. ...
  • 56.7k
1 vote

Speed up summation of many inverse matrices

Note: This answer is only for the $2\times 2$ case, and it uses the explicit formula for the matrix inverse. The same idea may also work for other small dimensions, which is the case that OP seems to ...
  • 10.8k

Top 50 recent answers are included