All Questions
Tagged with recursion memoization
17
questions
3
votes
1
answer
235
views
Recursive function Catalan triangle
I'm trying to learn how to build a recursive function. However, I'm not sure to understand how to set a "limit".
Here is what I'm trying to make.
I want a function that gives me the i,j ...
0
votes
2
answers
160
views
Memoization and recursions
My question is bolded within the text below.
Memoization speeds up a recursion that needs to recall a prior rule other than the last one calculated. For instance, on my machine, the following take 0....
0
votes
1
answer
143
views
Memoization Involving More than one Variable [duplicate]
Good morning. I would like to know if there is a way to implement memoization if there is more than one variable involved in the memoization; or more accurately, for my problem, have the memoization ...
2
votes
0
answers
142
views
Why does this memoized function cause the kernel to quit? [closed]
The following memoized recursive function causes the kernel to beep and quit.
...
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
1
answer
142
views
a recursive function using memoization
I have looked at a lot of these cases, e.g. Can one identify the design patterns of Mathematica? and the included ones.
My trimmed example, here establishing the 'initial conditions' (where the ...
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 ...
2
votes
2
answers
131
views
Memoization and finding already calculated DownValue
The problem of plotting an expensive function discussed in this question caught my attention. As an exercies I tried to solve it using memoization as follows
...
1
vote
1
answer
93
views
Forward iterations of coupled recursion equations
I need to do forward iterations of a system of 16 coupled recursion equations that track the frequency of genotypes over time in a biological model. I find that the iterations run slowly (it takes ~ ...
4
votes
4
answers
759
views
Memoization of a function defined by a recurrence relation [duplicate]
I have a function which is defined by the following recurrence relation
$$h_{n}(x)=h_{n-1}(x)+\frac{\mathrm{e}^{-x^2}}{2^n n!}H_{n}(x)H_{n-1}(x)$$
with the initial condition $h_{0}(x)=0$ and where the ...
1
vote
1
answer
238
views
Which data tabulation concept is best suited for discrete dynamic programming problems (e.g. for optimum series of account withdrawals)?
A bank account has starting balance, which shall be completely withdrawn in n steps, such that the sum of benefits of withdrawals is maximum. Remaining balance yield interest between steps such that ...
7
votes
2
answers
2k
views
How does one clear the memory of a recursive function
I want to implement the recursive function
v[n_] := v[n] = v[n-1] + f[n-1] + Random[NormalDistribution[0,s]]
to get ...
4
votes
2
answers
214
views
Assigning function values in a memoized recursive module
I have a complicated recursive module which I have memoized.
I realised that certain isomorphs of inputs to this function will give the same output. Therefore I decided to memoize all such input-...
3
votes
1
answer
306
views
Kernel crashed after $RecursionLimit = Infinity
$RecursionLimit = Infinity;
T[n_, k_]:= T[n, k] = If[n == 0 || k == 1, 1, T[n, k-1] + If[n<k, 0, T[n-k, k]]];
Table[T[n!, n], {n, 1, 9}]
Without ...
37
votes
3
answers
3k
views
How to clear parts of a memoized function?
I have a function of two variables, e.g.:
f[a_, b_] := f[a, b] = something f[a - 1, b - 1] etc
With the above code I used the concept of memoization to speed up ...