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

learn more… | top users | synonyms

3
votes
1answer
73 views

Speedier Algorithm or Set of Steps to Increase Speed of Coefficient Generation

Good morning. I am working with higher powers of the Generalized Euler Number generating function $$\left[\frac{n}{\sum_{j=0}^{n-1}\exp{\left(w_n^jx\right)}}\right]^\alpha$$ where $w_n=\exp{\left(...
0
votes
0answers
25 views

Nest function with an incremental parameter? [closed]

Usually, if we use the Nest[] command, it nests the function directly as in Nest[f,x,3] ...
2
votes
2answers
94 views

Recursion: How can i program this expression?

i have the following expression: Vt[EA_, V0_, Cm_, B_] := EA + (V0 - Cm)*B For EA and Cm ...
0
votes
0answers
37 views

Computing with recursion; how can I use values with lower indices without recomputing them? [closed]

I have to implement the following expression. V(tk+1)=max{(m×Ctk)/S_tk ,0} S(tk+1)+(Vtk-max{(m×Ctk)/Stk ,0} S(tk+1))×B(tk+1)/Btk How can I implement it so that ...
1
vote
1answer
121 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 ...
9
votes
2answers
132 views

Evaluating summations involving Fibonacci numbers in terms of Fibonacci numbers

There are many summations involving Fibonacci numbers which Mathematica 10.4 is able to evaluate directly in terms of Fibonacci numbers. For example, Mathematica evaluates the summation given below as ...
2
votes
1answer
78 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 ...
0
votes
2answers
96 views

How to define nested recursive sequence? [duplicate]

I have Conway's Challenge sequence at hand i.e. $a_n=a_{a_{n-1}}+a_{n-a_{n-1}}$ for $\ n \geq 3$ and $a_1=a_2=1$. I have basically no idea how to define this in Mathematica.
1
vote
1answer
41 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: ...
4
votes
0answers
31 views

Maximum number of recursions lower than $RecursionLimit

Consider the following code segment: f[x_]:=Module[{y}, Print[counter++]; Return[f[x+1]]; ]; $RecursionLimit=20; counter=0; f[0] The function terminates ...
1
vote
0answers
23 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: ...
1
vote
1answer
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: ...
0
votes
0answers
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 ...
0
votes
0answers
49 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
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 ...
3
votes
1answer
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 ...
1
vote
2answers
107 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 ...
5
votes
1answer
147 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 ...
3
votes
1answer
60 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 ...
4
votes
1answer
68 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!+...
5
votes
0answers
79 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
50 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
107 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 ...
0
votes
3answers
86 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:...
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
206 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)))))$$
1
vote
1answer
69 views

Use Recurrence Table with Generating Function

I tried to use Generating Function to solve Fibonacci series using following function. Input: ...
0
votes
1answer
71 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
89 views

Generating Functions with multiple arguments

I want to solve the recurrence of Ackermann function using Generating Function in Mathematica. ...
6
votes
4answers
596 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
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 ...
1
vote
1answer
154 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
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 <...
2
votes
0answers
56 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
2answers
103 views

Why does this recursive pattern guard not work?

I have the following list: ...
3
votes
1answer
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 ...
1
vote
2answers
129 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
148 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
71 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
247 views

Speeding up this recursive function

I have a recursive function defined like this: ...
4
votes
3answers
236 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 ...
11
votes
2answers
298 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 ...
1
vote
3answers
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 ...
3
votes
3answers
183 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 ...
6
votes
5answers
293 views

Calculating N-th step of recurrent sequence

I am figuring out how to calculate the $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 ...
5
votes
1answer
138 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 ...
2
votes
1answer
149 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
71 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
94 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 ...
1
vote
0answers
53 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 ...