# Tagged Questions

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

73 views

### Neat way to apply Newton's Method [duplicate]

What are different and elegant ways of applying Newtons method to $f(x)=x^3-x-1$? Newton's Method is: $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$ Being a beginner I can't really figure out how to create ...
747 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: ...
31 views

73 views

### How to use recursion to find a logical dual

I want to make a little function that goes through a propositional formula and gives it's dual. Here is what I currently have: ...
22 views

### Solving recurrence equation depending on a parameter

I have a recurrence relation which depends on a parameter $t$ and I am trying to solve it using RSolve. This is what I typed: ...
85 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 have:...
200 views

### Import nested JSON file [duplicate]

For a project where I receive JSON messages from a web server I was trying to convert these messages into a format that can be used easily within Mathematica. Because JSON also consists of key-value ...
23 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 ...
48 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 ...
79 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 ...
103 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 ...
70 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 ...
141 views

### Calculating the Feigenbaum Constants

I would like to calculate the $δ$ and the $α$ Feigenbaum constants for the Logistic Map: $$x_{n+1}=4μx_n(1-x_n)=f(x_n)$$ as part of an undergraduate assigment of mine. I ...
104 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: $$x_{n+1}=μ-x_n^4=f(x_n), \quad μ \in \mathbb{R}$$ I have so far managed to ...
249 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: ...
59 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 ...
65 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 1!+2!+3!+4!+...
78 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. ...
49 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 ...
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? ...
203 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)))))$$
66 views

### Use Recurrence Table with Generating Function

I tried to use Generating Function to solve Fibonacci series using following function. Input: ...
67 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: ...
145 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
246 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 ...
181 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 ...
69 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 ...
112 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: ...
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 ...