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

learn more… | top users | synonyms

2
votes
0answers
22 views

How to speed up solution of system of recurrence equations

I was wondering how I can improve the speed on this method for solving a particular system of coupled recurrence equations. The system is $$ \begin{align*} &V(m)=\alpha + \beta V(m+1)+\beta ...
0
votes
2answers
52 views

Express recursion formula by Nest function

I'm fairly new to Mathematica and I have to express a formula by Mathematicas Nest-function. I'd like to find the solution for my formula by my own, thats why I ...
0
votes
0answers
28 views

Does the two function for the same input leads to same output?

The first function is y[n_]:=x[n]+0.5*x[n-1]+0.25*x[n-2] the other is y[n_]:=a*x[n+1]+b*x[n]+c*x[n-1] Does exist some ...
0
votes
1answer
69 views

Calculating a function repetitively without using a For loop

In my programme I have defined all these functions: ...
2
votes
1answer
108 views

Can Mathematica solve this type of recurrence?

I have the following recursively defined equation: ...
0
votes
2answers
58 views

Writing a function with variable arguments [duplicate]

I want to write a function which takes multiple arguments varying from 1 to n, where each argument is a triplet. sublistProduct[{$a_1,b_1,c_1$},{$a_2,b_2,c_2$},...] = { $\Pi_{i=1}^{i=n}a_i ...
2
votes
2answers
104 views

How to create a recursive TreeGraph

How could I create a recursive tree graph, such as one defined by the following: A family of trees $T_n$ are defined recursively as follows, for all integers $n \ge 1$. The tree $T_1$ consists of a ...
2
votes
1answer
79 views

How to solve for the closed form of this recurrence?

For integers $L,k \geq 0$: $$T(L,k) = \begin{cases} 0 & \text{if }k \geq d, \text{ever}\\ -a_{k} & \text{if }L=0 \text{ and } k<d\\ a_dT(L-1,k+1) - a_{k}T(L-1,0)& \text{if } L>0 ...
5
votes
1answer
180 views

Compile, “global variables” and recursion

I am trying to do something similar to this, namely to make a Compile'd function outer that itself calls a ...
1
vote
0answers
33 views

Index change in a recursive definition

Assume I have the following recursive definition: ...
2
votes
1answer
50 views

Evaluate recursive funtion as a whole before computing a recursive step

I'll try to make a basic example of my problem with $n$ being an array of elements, ex. $\{1,2,2,3,3,3\}$: If i have a sum which needs a computed value i would like to compute it beforehand and store ...
2
votes
2answers
66 views

Recursion problem

I try to make designation a = {Subscript[a,1], Subscript[a,2], Subscript[a,3]} but receive mistake $RecursionLimit::reclim: Recursion depth of 1024 ...
1
vote
1answer
82 views

Iteration convergence of Newton approximations

I am trying to determine for which initial values Newton's approximation of specific functions (EX: f(x)=x^2 -1)converge and to what numbers it will converge to. *Where Newton's approximations are ...
2
votes
1answer
61 views

Getting the first $n$ terms of a recursion relation

Given a recursion relation, I would like to generate the first $n$ terms (automatically) without having to go term by term. Background Each term is of the form $a_{n}(t)$, that is, $a_{n}$ is a ...
2
votes
1answer
44 views

How do I make Mathematica nest argument changes?

I want something like Nest[f,x,n], but what where f is an argument change like a pushforward and x[t] is a function, for example, symbolically, and not in any sort of code: $$ F{x[t]} \equiv x[2t + ...
2
votes
2answers
66 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 ...
2
votes
1answer
57 views

RSolve and a recurrence relation

In the book An Introduction to the Analysis of Algorithms there is a recurrence relation for the number of compares used in Quicksort algorithm: $$ C_N=N+1+\sum_{0≤k≤N-1}\frac{1}{N}(C_k+C_{N−k−1}) $$ ...
4
votes
1answer
100 views

How can I implement this recurrence equation in Mathematica?

I asked a similar question yesterday but today I realized that I was implementing the wrong function. I have tried changing the implementation but I can't get it to work. Problem: There is a river ...
0
votes
1answer
46 views

Recurrence doesn't work together with maximize

When I'm trying to use a recurrence relation involving maximize it simply fails to compute anything... ...
2
votes
2answers
166 views

How can I express this recurrence function in Mathematica?

\begin{equation} r_{i+1}=r_{i}+V_{i}{\Delta}t \end{equation} Where \begin{equation} V_{i}=(0.01, 0.40) \end{equation} and ${\Delta}t$ is the difference in time. My implementation (this is for ...
1
vote
1answer
36 views

RecurrenceTable [closed]

I got an error saying ...
0
votes
2answers
67 views

Help Solving A Recusive System: “$RecursionLimit::reclim: Recursion depth of 256 exceeded.”

Was wondering if anyone had any tricks/ideas on solving this system of recursive equations I have. Essentially my goal is to have J2 equal to zero, but to understand how tweaking several parameters ...
-2
votes
1answer
111 views

Recursion depth of 1024 exceeded [closed]

I'm not sure why this code is giving the error :( f[0] = 0; f[n_] := f[n] = DigitCount[n, 10, 1] + f[n - 1]; f[1016]
0
votes
1answer
36 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)=\intop_{x}^{\infty}K_{i,n-1}\left(y\right)dy$ where ...
0
votes
2answers
52 views

Solving linear recursions without constant depth in mathematica

Mathematica does not like this recurrence relation. I do not understand why? ...
0
votes
1answer
81 views

How to improve this function that selects parameters from arbitrary distribution using Recursion?

Below, I have defined a function using Which to select model parameters based upon various conditions. My questions are: Is there any danger in writing this function using Recursion? Is there a more ...
1
vote
2answers
59 views

Solving Recurrence equation for n

I have a recurrence equation $t_n$ which is defined as $$ t_n=2.5t_{n-1}-1.5t_{n-4},\qquad \text{for }n\geq5 $$ Where $$ \begin{align} t_1&=5\\ t_2&=10.5\\ t_3&=26.25\\ t_4&=62.625 ...
0
votes
1answer
75 views

Problem with recursion depth

I want to solve a problem where I need to compute the Euler-Lagrange equation. However I receive a recursion problem, and I don't understand why. ...
0
votes
1answer
59 views

Solving recursion equation with two parameters

I am trying to solve the following recursion equation, a(l,m)=l*a(l,m-1)+a(l-1,m) with initial condition; a(l,m)==0 if l=0 , a(l,m)==1 if m=1 I am trying to solve it ...
0
votes
1answer
68 views

Recursive definition of nested sums

I have a set of functions which take lists as arguments. They recursively nest sums, and I have defined them as follows ...
1
vote
1answer
74 views

How to rewrite and possibly speed up a recursive sum?

I have the following for-loop calculating a multiple nested sum ...
4
votes
1answer
103 views

Display level of recursion of a recursive function during execution

Given a recursive function, is there some simple way to display or store the value of recursion or "how many levels deep" the function is at a given time? For instance, if we wrote the recursive ...
1
vote
1answer
58 views

Implementation of a recursive function [duplicate]

I have been trying to implement a recursive function, but still struggle. Here's what I have written: ...
0
votes
0answers
78 views

Simple recursive function?

I'm new in Mathematica and need some help. I'm trying to make a recursive function but I'm not sure how to iterate through more than one item. To be more clear, take this pseudo code for example: ...
1
vote
0answers
57 views

Problem with converting recursive code to iterative

I am trying to convert a snippet that uses recursion into one that uses iteration for drawing an L-tree, but my code produces duplicate points. How do I avoid generating them? Recursive version: ...
1
vote
1answer
136 views

how to make a recursive function to analyse this file

I am stuck at this problem beginning We assume we have keyword k, and the structure in the file: file.txt ...
1
vote
1answer
94 views

Function to calculate finite difference

I wrote a function to calculate multivariate finite difference of different orders ...
0
votes
1answer
59 views

How to define y[n] = f1 y[n-1] + u[n]?

I need to define a recursion defined by the following equation $y(n) = f_1 y(n-1) + u(n)$ In which $f_1$ is a symbolic constant. I know the values of the sequence u and I know the initial value of ...
2
votes
2answers
133 views

Understanding `NestList` with multiple functions

General question For a function f[n, a], where a is a list and n is a whole number, what is ...
0
votes
1answer
101 views

Recursive functions taking list arguments

I wish to create a function that takes lists (e.g. {plus,plus,minus,0,minus,plus}) and uses the input list to calculate a corresponding value using a set of ...
0
votes
0answers
106 views

simulate a 32-bit signed integer overflow in a recurrence function

Considering the following recurring equation: which is this factorial function: I want to find the value of x where f(x) = 0. Actually, the solution is impossible with Mathematica, and it's ...
0
votes
0answers
50 views

Different kind of numeric erros when plotting recursive functions

I have been trying to plot some numeric solutions to a Hamiltonian system. Basically I have ...
1
vote
1answer
95 views

solve recursive factorial function [closed]

Is there a way to solve this recursive factorial function? a[n + 1] = (n+1)*a[n], a[10]=10 I am looking for the value of a[n] ...
3
votes
1answer
90 views

Mathematica taking too long to calculate recursive function

I have been trying to plot those specific recursively defined functions p1 and q1 in Mathematica: ...
5
votes
2answers
584 views

Variable that changes itself

I am trying to store a boolean value into a variable with the additional property that the value changes each time the variable is called. ...
0
votes
0answers
116 views

Nested Recursion Equation

I have been trying to solve a "nested recursion equation" using Mathematica. However, when I do something like this: ...
3
votes
3answers
187 views

Pare down list recursively

What is the best way to pare down a list whereby the $n$th number is removed from the list recursively? This ...
5
votes
0answers
147 views

Second order differential equation with boundary conditions solving repeatedly

I want to solve a second order differential equation in the interval[-1:1], which does not have a analytic solution, \begin{eqnarray} y''(x) &=& k \phi^2(x)y(x) \\ \phi(x) &=& ...
1
vote
1answer
167 views

Define a Recurrence Table involving other tables

I'm relatively new to using Mathematica. Previously I used Matlab, but lately I noticed that the numbers i got in both of them do not match (mostly it seems that Matlab lacks precision...). The ...
5
votes
2answers
235 views

Plotting two recursive functions

I'm trying to plot two recursive functions (p and θ) on a map. So far I have: ...