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

learn more… | top users | synonyms

0
votes
0answers
22 views

Recursion and Its Stoppage Criteria

Let there be a recursive function V whose first value is set at 0. How can I find its converged value in such a way that the recursion stops when the difference between the newest and the one before ...
0
votes
0answers
39 views

Value Iteration (Recursive iteration) to Minimize (Optimize) a Function

I have a function that I call as "Value". I am trying to find the minimum of this function and this function is a function of 4 other functions. One of these four functions is recursive based on the ...
2
votes
1answer
69 views

Is it possible to find the close form solution of following Recurrence relation using Mathematica?

Example 1 F(0,t)=t F(n+1,t)=F(n,2*t) Example 2 F(0,y,t)=t F(n+1,y,t)=F(n,y+1,t*y) When I tried to manually solve above ...
1
vote
2answers
89 views

n fold convolution of a function via a recursion function

I wanted to write a recursion function to calculate the n-th convolution of a function f[x_]. I wrote the function ...
3
votes
1answer
67 views

Calling results of applying f to expr inside NestList

Being new to Mathematica, I try to follow the suggestions of using NestList, Map, Table ...
0
votes
1answer
48 views

Interactive Application using Manipulate for Fibonacci Series

I am working on creating interactive app using Manipulate function on fibonacci series using SeriesCoefficient. I want to plot the fibonacci numbers based on the slider of Manipulate function. I ...
5
votes
1answer
132 views

Calculating the Feigenbaum Constants

I would like to calculate the $δ$ and the $α$ Feigenbaum constants for the Logistic Map: \begin{equation} x_{n+1}=4μx_n(1-x_n)=f(x_n) \end{equation} as part of an undergraduate assigment of mine. I ...
2
votes
1answer
100 views

How to approximate the solution of a system of quartic equations

In an attempt to evaluate the point at which the cycle 2 becomes unstable for the given map: \begin{equation} x_{n+1}=μ-x_n^4=f(x_n), \quad μ \in \mathbb{R} \end{equation} I have so far managed to ...
4
votes
2answers
247 views

A problem about recursion formula of de Casteljau algorithm

I use Mathematica to implement the de Casteljau algorithm $$\vec{P}_{k,i}(u_0)=(1-u_0)\vec{P}_{k-1,i}(u_0)+u_0\vec{P}_{k-1,i+1}(u_0)$$ The graphics that de Casteljau algorithm generated as follows: ...
3
votes
1answer
51 views

Extending matrix (x,y-axis + data) via Interpolation. Looking for elegant & efficient way to write

Please, feel free to edit the title, if necessary. Hi, this is my code working, but actually, the size of my real dataset is 100x100. So, this is very inefficient way. What would be the most ...
3
votes
1answer
59 views

How to use currying to write a tail recursive function for summing factorials given a certain bound

I am very confused about how can i use currying to write a tail recursive function for summing factorials within a certain bound or summing the bounds i.e. given [1,5] i should be getting ...
5
votes
0answers
71 views

Improve recursive function (memoization)

These days I am trying to rewrite the following recursive function, in order to gain some speed. It is crucial because I end up using 4-5 similar functions, and I need to decrease execution time. ...
1
vote
1answer
45 views

Solve a backward-forward equation with a loop

I want to solve this recursive equation X[t+1] = 0.8 X[t] + 0.04 P[t+1] + 119.6; P[t_] := 0.4 X[t] + 0.8 P[t + 1]; P[t_] := S[t] X[t] - g[t]; and with these ...
2
votes
1answer
29 views

How to change the number display of output from RecurrenceTable

Is there a way to change how numbers are displayed in the output from RecurrenceTable? ...
4
votes
3answers
193 views

Recursive definition of nested functions

This is probably very easy, but I cannot figure out a way to define a function like: $$ g_h = ( 1 + f_1(1+f_2(1+f_3(.. (1 + f_h)))))$$
0
votes
1answer
53 views

Use Recurrence Table with Generating Function

I tried to use Generating Function to solve Fibonacci series using following function. Input: ...
5
votes
2answers
308 views

Implementation of a complex recurrence relation for polynomials

I would like to implement the recurrence relation for the polynomials $U_n(x)$ appearing in the large order asymptotics of the Bessel functions. The recurrence in question is: ...
0
votes
1answer
58 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): ...
3
votes
0answers
80 views

Generating Functions with multiple arguments

I want to solve the recurrence of Ackermann function using Generating Function in Mathematica. ...
6
votes
4answers
581 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 ...
9
votes
2answers
568 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 ...
1
vote
1answer
144 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 ...
0
votes
2answers
99 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 ...
0
votes
0answers
93 views

Why do Precision and Accuracy level off in this calculation?

I am confused by this behavior, where Precision and Accuracy seem to reach a bottom and deteriorate no further as I perform more iterations on this calculation. Have I misunderstood something about ...
2
votes
0answers
50 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 ...
6
votes
1answer
75 views
5
votes
5answers
268 views

Calculating N-th step of recurrent sequence

I am figuring out how to calculate $N$-th step of a square root approximation sequence: $$x_{n+1} = \frac12\left(x_{n} + \frac{a}{x_n}\right),$$ where $a$ is a number the root of which is to be found ...
5
votes
1answer
133 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 ...
3
votes
1answer
50 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 ...
1
vote
2answers
119 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: ...
9
votes
1answer
139 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 ...
1
vote
1answer
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
2
votes
1answer
239 views

Speeding up this recursive function

I have a recursive function defined like this: ...
11
votes
2answers
285 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 ...
3
votes
3answers
185 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 ...
1
vote
3answers
46 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 ...
3
votes
3answers
166 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 ...
2
votes
1answer
134 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 ...
1
vote
2answers
63 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 ...
3
votes
1answer
92 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 ...
2
votes
1answer
110 views

Modifying Game of Life code so that the lattice can be seeded with life forms

I want to modify Game of Life code so that the lattice can be seeded with one or two new life forms like: ...
1
vote
0answers
49 views

recursion and if-statements

So im trying to write a recursion module in mathematica (specifically for strassen multiplication but this doesn't matter). My issue is I don't really know how if statements work in mathematica and if ...
0
votes
1answer
32 views

Modify code to avoid recursion limit warning [closed]

I programmed a recursive function and I want to see the evolution depending on the number of trials. I want to find the value of k for which the difference between $rec_i^k$ and $rec_i^{k+1}$ is equal ...
2
votes
0answers
42 views

Convergence of a recursive function

I am trying to study the convergence of a function that is defined by recursion. We want to find for which 'j' the difference between $ g_i^j $ and $ g_i^{j+1} $ is equal or smaller than $10^{-3}$ . ...
1
vote
2answers
119 views

Function to Represent Recursive Integral

I'd like to represent the following recursive integral equation to evaluate/graph (for $n\leq3$): $$K_{i,n}\left(x\right)=\int_{x}^{\infty}K_{i,n-1}\left(y\right)dy$$ where ...
1
vote
1answer
80 views

Define recursive function over two indices

I have $x_i=(i-1)/50$ for $i=1,\ldots,51 $. Given a function $ f(x) = x^2 $, I want to find $y_i^k$ given by \begin{eqnarray} y_i^1 &=& f(x_i) \\ y_i^{k+1} &=& ...
2
votes
0answers
49 views

Why doesn't RSolve work here? [closed]

RSolve[ {θ[n + 1] == θ[n] + 0.25*ϕ[n], ϕ[n + 1] == ϕ[n] - 2.5*Sin[θ[n]], θ[0] == π/2, ϕ[0] == 0}, {θ[n], ϕ[n]}, n] What's wrong with my code? I know ...
7
votes
3answers
225 views

Deleting any list that contains a negative number

We had another nice question in a student activity today. The increasing sequence of positive integers $a_1,a_2,a_3,\ldots$ has the property that $$ a_{n+2}=a_n+a_{n+1} \text{ for all } n\ge 1. $$ ...
7
votes
1answer
234 views
4
votes
2answers
231 views

Finding large Collatz Sequences, trying to improve speed

Background: I am already very much in love with Mathematica but I am also a novice. So far I have only gathered experience in procedural programming in Python. Generally speaking I am trying to ...