All Questions
Tagged with recursion performance-tuning
35
questions
1
vote
1
answer
89
views
Most efficient way of defining the following sets for every step $n$
For each $n\in\mathbb{N}$, how do we compute sets $A_n$ and $B_n$ below:
Let $A_1=[0,2/3)$. Let $B_1=(2/3,1]$.
If $A_n$ is a union of intervals, then for each interval cut out the
middle $1/2^{n+1}$ ...
0
votes
0
answers
63
views
Recursion limit for NDSolve
I have a fairly complex equation containing many terms, I can use the NDSolve for solving the differential equation for lesser terms (6400ish). But can't do it for ...
2
votes
2
answers
107
views
Optimization of a Markov сhain with symbolic transition rate
I am trying to work on 1D random walk that can move to left, right or stay with probabilities $p_i$,$q_i$,$r_i$ that changes with the site $i$. I am trying to simulate this by using a recurrence ...
1
vote
2
answers
145
views
Speed up calculation of recursively defined list
I have two lists $a$ and $b$ of length $n$ and $n-1$ respectively (typically I have $n \approx 1000$).
I have to compute a list $\theta$ of length $n$ which is defined recursively by the following ...
0
votes
0
answers
64
views
Compile error in recursive code due to large integer
I am trying to implement a compiled version for the original algorithm that is supposed to run faster . It works fine for small iteration loop number when max=100. However, when loop number gets ...
1
vote
1
answer
122
views
Recursive relationship too slow
Writing:
...
3
votes
0
answers
108
views
Sowing Once into Each of Many Lists – Any Better than Append?
In general
I know to try to use Reap and Sow over Append or AppendTo due to superior performance. However, Reap and Sow are notorious for being difficult to understand how to use and how they work ...
0
votes
1
answer
119
views
Use of ParallelDo with an iterative or recursive calculation
Is it possible to use ParallelDo (or any similar parallelization method) to speed up the calculation of an iterative calculation, which takes a previous calculation ...
2
votes
1
answer
91
views
Optimize this computation of Liapunov exponent
Introduction
In dynamical systems there is an important exponent called Liapunov exponent. I'm trying to create a visual representation of Liapunov exponent for one dimension finite-difference ...
3
votes
2
answers
129
views
Join sublists on condition
I have a nested list of integers and want to join any sublist matching a condition to its left neighbouring sublist, iteratively. Conveniently, the joining condition is whether the length of the list ...
3
votes
1
answer
298
views
Help coding an Abelian Sandpile
I'm attempting to code an abelian sandpile. I thought a good way to go about it would be utilizing recursion, which I've never tried in MMA before. The code currently runs but doesn't seem to work (it ...
3
votes
1
answer
177
views
Recursive solution to the extended Josephus problem [duplicate]
The Josephus Problem is described here, with extension of killing every $k$th problem. In the simple case where every other person is killed, we can also use the binary trick.
...
2
votes
0
answers
52
views
Recursive function call in Fold: $RecursionLimit issue
I'm trying to generate a list of all local complements of a graph $G$. A local graph complement $G\star v$ for $v\in V$ is defined as taking the neighbourhood of the vertex $v$, and flipping the ...
0
votes
1
answer
182
views
6
votes
1
answer
483
views
Clever caching of a recursively defined function
I've got a function of the form f[n,s] where n is a natural number and s is a finite ...