Tagged Questions

For questions about defining recursive functions, recursive algorithms and solving recursive equations.

744 views

40 views

Why doesn't recursive transformation stop when rules no longer match?

In an exercise where I was trying to pick out consecutive words starting with the same letter, i.e. I wanted: ...
97 views

66 views

Use Recurrence Table with Generating Function

I tried to use Generating Function to solve Fibonacci series using following function. Input: ...
66 views

Table where an element depends on the sum of previous elements

I'm trying to create a table whose elements will be a sum over previously declared elements up to a certain iteration. I've reduced what I'm trying to do to the simplest form (posted below): ...
87 views

Generating Functions with multiple arguments

I want to solve the recurrence of Ackermann function using Generating Function in Mathematica. ...
595 views

Paying off an installment

How do I determine the weekly installment I have to pay, if my loan is, let's say, loan=5000, with interest rate of 2% every ...
571 views

Improve speed in this tree - memoization won't suffice

I have two functions, one of which calls the other. I need to do some calculations but I was unable to optimize my code to do it efficiently. In search I came across the memoization technique, which ...
152 views

Bounded random walk

I have a random walk algorithm that I want to implement, but I am getting a recursion depth issue. I am making a list of points that Z particles can be in over the ...
101 views

NestList using Sum of already generated numbers

I need to do list of numbers, which are generated by recursion like a_t = Sum[a_i, {i,0,t-1}]*b I can do it using Module and <...
52 views

Why does this function recur forever? [closed]

I am trying to solve Project Euler Problem 31, but I don't want answers for that. I just want to know why this function recurs forever. It just keeps subtracting one forever, on the ones where it goes ...
137 views

Find random $n$ combinations of values with a given sum

This problem is described in the related StackOverflow question: Find all combinations of coins when given some dollar value. I would like generate a list of $n$ combinations of values that sum up to ...
51 views

Making a table or expression based on previous values

I would like to illustrate rational expectations based on the following equation p[[t+1]] == 1/(1 - ψ (β - 1)) m[[t+1]] - ψ (β - 1)/(1 - ψ (β - 1)) p[[t]] by ...
127 views

Symbolic expression for recursion

Is it possible to get symbolic expression for recursive function? In particular I am checking if a symbolic expression is possible (i.e. f[n]) for the following code: ...
144 views

Maximizing a recursive functional equation

I would like to maximize a recursive functional equation but I am struggling with setting up the problem correctly. The equation I am interested in captures the nature of a decision process over time ...
70 views

I can not solve this equation for recurrence [closed]

Use RSolver to solve RSolve [{f [n + 1] == f [n] + 2 n + 1, f [1] == -3}, f [n], n] but I do not get solution Edit my solution
245 views

Speeding up this recursive function

I have a recursive function defined like this: ...
297 views

How to “inform” successive ContourPlot calculations?

I need to draw some contour plots of very non-linear functions. As a simple example, take a Mandelbrot Set divergence contour near $z\approx i$. (Just to be clear, I'm not trying to write a ...
225 views

Limit n->Infinity of recursive sequence

I have defined a recursive sequence a[0] := 1 a[n_] := Sqrt[3] + 1/2 a[n - 1] because I want to calculate the Limit for this ...
50 views

cantor set intervals

I have been trying to figure out how to get the values for the limits of the Cantor set intervals (see here). The formulas that i could find only gave the interval themselves but what i need is only ...
180 views

What's wrong with this while loop index definition?

For[k = 1, k < 4, k++, T = Table[i^2, {i, 0, k}]; f[k] = T; ] In the above, I wish to define a function $f$ by $f(k)=\{0^2,...,k^2\}$ for $k=1,2,3$, but the ...
146 views

Problem with implementing Regula Falsi [closed]

I checked the "Questions that may already have your answer" and didn't really find what I need. It's actually pretty basic. I want to solve an equation manually with Regula Falsi. I dont need a ...
68 views

Floor function issue [closed]

While attempting to evaluate a recurrence relation an error with the Floor function is encountered. Computing an example to verify the floor function works correctly I ran the code ...
93 views

Extreme Slowdown with Fold

I am doing a finite difference model, and need to create a list recursively. For a small list, Fold is extremely fast, but when the list becomes large enough, Fold becomes extremely slow. Here is the ...