# Tagged Questions

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

212 views

### Solving with DSolve recursively

I need to find $f(x,n)$ in the interval [0,1] defined by recursion, $$\frac{d f(x,n+1)}{dx} = f(x,n)$$ with boundary conditions $f(0,n+1) = 1$ and $f(x,0)=1+ x$ Using ...
70 views

### RSolve with simple initial condition

Suppose we have the following equation: $$g_ma_m=r_ma_{m-1}$$ with initial condition $a_L=d$ and $L$ might be negative. The following command ...
1k views

### How to find a recurrence relation for a numerical sequence?

This question was inspired by Vladimir Reshetnikov's question (How to find a recurrence relation for a sequence?): Given a finite sequence of numbers, how can we find in MMA a recurrence relation ...
244 views

### How to find a recurrence relation for a sequence?

I have a sequence given by an explicit formula for n-th term: ...
363 views

### Implementing local variables of a recursive function with either Module or Block

First, some quick background: I have been eagerly learning Wolfram and Mathematica for two months now, and along the way have written about 250 pages of teaching material that has ballooned into a ...
151 views

### Recursive function with array of variables

I am trying to create a recursive function which works with an increasing array of variables. Since the formula is quite complex, i will try to simplify my example to the core of my problem. The ...
205 views

### How can I make a “self-referential” replacement operation self-contained?

Fairly often I find use for replacement rules that call themselves on the right-hand side of the rule, e.g.: ...
81 views

### Specifying Range of RSolve

When I input RSolve[{0 == q[n + 1]^2 + 3 q[n + 1] + 2 q[n + 1] q[n] - 6 q[n] + q[n]^2, q[0] == 1}, q[n], n] I get two complicated-looking complex solutions: <...
407 views

### Integrating a periodic function

I have a periodic function ff: ff := Function[x, Piecewise[{{ff[x - 1], x >= 1}, {2 x, 0 <= x < 1}, {ff[x + 1], x < 0}}]] Plotting it works fine: <...
38 views

### Scoping in recursive function leading to unexpected results

I'm trying to implement Ramer-Douglas-Peucker line simplification in Mathematica, and I'm running into an issue with recursion. My implementation of the algorithm is below: ...
254 views

### Programming a recursive FFT with Mathematica

I'm trying to program a FFT using a recursive function in Mathematica, though my program is not getting me anywhere at the moment. Could you say what's wrong with it and what I can do to make it work? ...
132 views

421 views

### Creating a dynamic plot directly from the recurrence relation

I have the following recurrence relation that has no general solution: $$x(t+1) = \frac{x^2 + x(1-x)(1-sh)}{x^2 + 2x(1-x)(1-sh) + (1-x)^2(1-s)}$$ In Mathematica language it gives: ...
281 views

### Faster Ways to compute recursive summation

It takes a long time to compute the summation below, and I'd like to know if there are some better ways to compute things faster. I have used $3$ ways to calculate, but they are very unsatisfactory. I ...
526 views

### Nested list to graph

The following nested list can be regarded as a representation of a (tree) graph: ...
137 views

### How to define a function that operate with a base case recursively? [duplicate]

Let's start from the simplest case: say I have a function $f(x)=x$, and let's say I want to define a new function (of $x$) to be its $n$-th power $(f(x))^n$. How should I write the code? I tried: <...
349 views

114 views

### How to solve the recursion equation that include the uncertain value i in it?

I write the following code of a recursion equation, but it can not work correctly. ...
360 views

### calculating a sequence of functions using iteration

I am trying to compute a sequence of functions using iteration and keep running into problems trying to use built in looping commands because of the recursive nature of the definition. The code below (...
428 views

### Concatenation of lists in a Fibonacci-like pattern

I am trying to create a List of elements that follow the general pattern: $$X_{n+1} = X_n X_{n-1}$$ where the operation on the right hand side is concatenation, i.e., joining. I want to achieve the ...
166 views

### Explicit, closed formula for recursive integral as a function of the recursive parameter

This is a follow-up of this question/answer. I'm working on a recursive integral more complicated than the one on the linked question, but this one can be used as an example. I would like to obtain ...
275 views

### Computing a series in terms of exponential function

Is there any way to compute the following series in terms of exponential function ? $$\sum_{k=0}^\infty Y_1(k)\;x^k$$ where $$Y_1(k) = \frac{(k - 1)!}{k!}Y_3(k - 1)$$ Y_2(k) = \frac{(k - 1)!}{k!}...
2k views

### Why do I get an error message when for this type of recursion?

When I type the following code: mus[] = 0; mus[x__] := First[List[x]] + mus[Rest[List[x]]] What one would think would happen is that if, ...
703 views

### Solving a nonlinear system of recurrence equations

I am having two problems regarding Mathematica, and both of them are happening because it does not accept such inputs: ...
294 views

### How can I use a recursive function in a Module

I have a question about using a recursive function in a module. I made the following example to illustrate the question. The followwing code works: ...
464 views

### Solving recurrence sequence using an ODE

I'm trying to solve the recurrence a[n] == 0 for n < l a[l] == 1 a[n] == (l + 2(n - l) a[n - l] + (n - l)(n - 1) a[n - 1])/n(n - l + 1) for n >= l using ...