Skip to main content

Questions tagged [recursion]

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

1 vote
2 answers
145 views

Speed up calculation of recursively defined list

I have two lists $a$ and $b$ of length $n$ and $n-1$ respectively (typically I have $n \approx 1000$). I have to compute a list $\theta$ of length $n$ which is defined recursively by the following ...
Matteo's user avatar
  • 283
0 votes
0 answers
102 views

Recursive Sum not evaluating correctly

I'm trying to evaluate the following sums that nest into eachother: $$ m_k=\frac{k}{k-1} \left(e^{\gamma}+ \sum_{i=1}^{k-2} {k-1\choose i} \frac{m_i}{i} \right) \\ m_1=e^\gamma $$ and $$ \kappa_n = ...
Mick Stukes's user avatar
1 vote
2 answers
162 views

Recursion with Sum

Using RSolve I tried without success to convert the recursive relation to a non-recursive function. How can I do this? ...
granular_bastard's user avatar
1 vote
1 answer
104 views

Plot of a recursive expression having a parameter

I have a recursive expression defined as $$ h_u= (1-a)(1-b) h_{u-1} + \sum_{k=2}^{u-1} (1-a) b h_{u-1-k} - \sum_{k=2}^{u} h_{u-k} - \sum_{k=1}^{u+1} \Lambda_{u,k} $$ where $\Lambda_{u,k} = \sum_{m=u-k+...
Rosy's user avatar
  • 53
2 votes
1 answer
110 views

Evaluate a double sum using Mathematica

I am evaluating using Mathematica, the double sum $\sum_{u=0}^\infty \lbrace \sum_{k= u+1}^{u+y}[\dfrac{(1-a)}{4} (3/4)^k + 3a[(\dfrac{1}{2})^{k-1} - (\dfrac{3}{4})^{k-1} ]\rbrace $, where $'a' $ is a ...
Rosy's user avatar
  • 53
3 votes
4 answers
322 views

Factorial implementation using FixedPoint

I implemented the factorial function: fact[0] = 1 fact[x_Integer?Positive ] := x*fact[x - 1]; f[4] yields 24 as expected I tried a different version of the ...
ExpressionCoder's user avatar
0 votes
0 answers
64 views

Compile error in recursive code due to large integer

I am trying to implement a compiled version for the original algorithm that is supposed to run faster . It works fine for small iteration loop number when max=100. However, when loop number gets ...
Aschoolar's user avatar
  • 893
2 votes
1 answer
116 views

Implement recursion one step at a time with a function of more than one variable

i am trying to implement a recursive difference equation step by step, by implementing rules, similar to Rojo's method in this thread: How can I evaluate only a single step of a recursive function? ...
StevieP's user avatar
  • 23
3 votes
2 answers
389 views

Recursive function in Mathematica

I need to implement the following recursive function in Mathematica. $$F[-2*a,b,2b;2]=\left(\frac{a-1/2}{a-1/2+b}\right)F\left[-2*(a-1),b,2b;2\right]$$ The conditions of the functions are: if $a=0$, ...
Jasmine's user avatar
  • 1,225
4 votes
3 answers
292 views

How to create a sequence of functions defined recursively?

I'm trying to create a Table of functions where each new element is defined recursively via indefinite integration of the previous one. I've tried doing: ...
TC159's user avatar
  • 149
2 votes
2 answers
325 views

Why does System`Private`ConstructNoEntry[Quantity, 1, "kg"] enter a Recursion?

System`Private`ConstructNoEntry[BesselJ, 0, x] works fine, and outputs BesselJ[0, x] However, ...
matheorem's user avatar
  • 17.2k
1 vote
0 answers
93 views

Solving a 2D recurrence diagonal-by-diagonal

I have a 3D recurrence relation -- which I know can be hard for Mathematica to work with, so I boiled it down to 2D. We have two functions, $f_1(i,j)$, $f_2(i,j)$ defined on the state space $\{(i,j) | ...
black's user avatar
  • 251
0 votes
0 answers
82 views

How to do this recursion relation in Mathematica effectively?

I have a function $h_{\Delta,l}(r,\eta)$ satisfying \begin{equation} h_{\Delta,l}(r,\eta)=\tilde{h}_{l}(r,\eta)+\sum_{k}\frac{c(k)}{\Delta-(1-l-k)}r^{k}h_{1-l+k,l+k}(r,\eta) \end{equation} where $k$ ...
Vayne's user avatar
  • 101
1 vote
1 answer
117 views

RSolve with integer and boolean variable

I have a recurrence relation with two variables $i, b$ where $i \in \{0, \ldots, n-1\}$ for some parameter $n \in \mathbb{N}$; and $b\in \{0,1\}$. I tried to solve it using RSolve, but the function ...
black's user avatar
  • 251
2 votes
1 answer
132 views

Pattern match with "+" sign

Can you pattern match with a "+" sign? Here is the recursion...(which does not work) ...
PiE's user avatar
  • 437

15 30 50 per page
1 2 3
4
5
44