Skip to main content

All 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}$ ...
Arbuja's user avatar
  • 81
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 ...
Bravyi's user avatar
  • 21
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 ...
Hugo Andrade's user avatar
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 ...
Matteo's user avatar
  • 283
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 ...
Aschoolar's user avatar
  • 893
1 vote
1 answer
122 views

Recursive relationship too slow

Writing: ...
πρόσεχε's user avatar
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 ...
Just Some Old Man's user avatar
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 ...
user135626's user avatar
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 ...
tajiri_numero_1's user avatar
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 ...
István Zachar's user avatar
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 ...
Kai's user avatar
  • 2,099
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. ...
CasperYC's user avatar
  • 1,642
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 ...
J Bausch's user avatar
  • 151
0 votes
1 answer
182 views

how to improve the performance of this recursion code in mathematica

...
look's user avatar
  • 37
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 ...
მამუკა ჯიბლაძე's user avatar

15 30 50 per page