# 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+1}^{u-k+y}(1-a)\frac{1}{4}\left(\frac{3}{4}\right)^{m-1}$$. Here $$u$$ is the recursion index taking integer values in $$\mathbb{N}_0$$. $$y$$ is a parameter taking integer values in $$\mathbb{N}$$. $$a$$ and $$b$$ are fixed constants.

The initial value is $$h_0 = \frac{a}{(1-a)(1-b)}\left[ (b+a)^{2} M_1 - (1-b) M_2\right]$$ with $$M_1 = \sum_{u=0}^{\infty} \sum_{k=u+1}^{u+y} (1-a) \left[ \left(\frac{3}{4}\right)^{k-1} - \left(\frac{1}{2}\right)^{k-1}\right]$$ and $$M_2 = \sum_{k=1}^{y} (1-a) \left[ \left(\frac{3}{4}\right)^{k-1}\right]$$. $$h_0$$ is the initial value (also depends on the parameter $$y$$) of $$h_u$$ for a given value of $$y$$.

My attempts:
a = 5/6;   b = 1/46;
\[CapitalLambda] = FullSimplify@Sum[(1 - a)/4 * (3/4)^(m - 1), {m, u - k + 1, u - k + y}];

M1 = FullSimplify@Sum[(1 - a) (3/4)^k - 1 - (1/2)^(k - 1), {u, 0, Infinity}, {k, u + 1, u + y}];

 M2 = FullSimplify@Sum[(1 - a) (3/4)^(k - 1), {k, 1, y}];

h[0] = a/((1 - a) (1 - b)) ( (b + a)^2 M1 - (1 - b) M2);

h[u_] := h[u] = (1 - a) (1 - b) h[u - 1] + FullSimplify@ Sum[(1 - a) b h[u - 1 - k], {k, 2, u - 1}] h[u - 1 - k] + FullSimplify@ Sum[h[u - k], {k, 2, u}] - FullSimplify@ Sum[\[CapitalLambda] , {k, 1, u + 1}];.

T = Table[ {u, h[u]}, {u, 1, 30}] // N Grid[T, Frame -> All

I fixed $$y$$ and ran the Mathematica program several times and generated a table of values of $$h[u]$$ for $$\lbrace u,0,30\rbrace$$ and compiled them in excel. But this is the hard way around.

I would like to know if a table of values of u for each value of the parameter y and also their asymptotic values can be generated using Mathematica. I used $$'Manipulate'$$ as described in Defining a recursive function with additional parameters that can be used in a Manipulated ListPlot to generate a plot by including the parameter inside the recursive function but there too, I am getting an empty plot. I also tried using $$RSolve$$ , but that too did not give me any result.

Can I get some help in resolving the above mentioned issue?

Many thanks.

• Please provide your expressions in Mathematica code (InputForm) that can be copied and pasted into a notebook. Aug 26, 2022 at 14:07
• @ Bob Hanlon I have edited my post .
– Rosy
Aug 27, 2022 at 7:02
• In M1 the term (3/4)^k - 1 should be (3/4)^(k - 1) . I have not checked for other typos. I did notice, however, than many of the intermediate sums can be performed symbolically, saving a lot of computing time. Aug 28, 2022 at 23:16
• Sums in h[u] are ill-defined for u = 1 and u = 2. Aug 29, 2022 at 1:43
• @bbgodfrey: For u = 1 and u = 2, won't the sums go to zero as the summation is from k = 2 to 0 for u =1 and the sum is from k = 2 to 1 for u = 2 ? I will include the assumption in the sum to avoid this case. Thanks for pointing it out.
– Rosy
Aug 29, 2022 at 6:36

Quantities appearing in the question include

m1 = Sum[(3/4)^(k - 1) - (1/2)^(k - 1), {u, 0, Infinity}, {k, u + 1, u + y}]
// Simplify
m2 = Sum[(3/4)^(k - 1), {k, 1, y}] // Simplify
Λ[u_] = Sum[(3/4)^(m - 1), {m, u - k + 1, u - k + y}] // Simplify
(* 4 (3 + 2^-y - 3^y 4^(1 - y)) *)
(* -4 (-1 + (3/4)^y) *)
(* 3^(-k + u) 4^(1 + k - u - y) (-3^y + 4^y) *)


Since Λ[u] appears in the recurrence relation only as a Sum, it makes sense to perform that Sum outside the recurrence relation:

sΛ[u_] = Sum[Λ[u], {k, 1, u + 1}]
(* -(1/3) 4^(2 - u - y) (3^(1 + u) - 4^(1 + u)) (-3^y + 4^y) *)


From the question,

h[0] = Simplify[((b + a)^2 m1 - (1 - b) m2) a/((1 - a) (1 - b))]
(* (a (-4 (-1 + (3/4)^y) (-1 + b) +
4 (3 + 2^-y - 3^y 4^(1 - y)) (a + b)^2))/((-1 + a) (-1 + b)) *)


and

h[u_] := h[u] = Simplify[(1 - a) (1 - b) h[u - 1] + (1 - a) b
Sum[h[u - 1 - k], {k, 2, u - 1}] - Sum[h[u - k], {k, 2, u}] - sΛ[u]]


(This expression corrects a few typos in the question.) Sample results are

h[1]
(* 28/3 (-1 + (3/4)^y) - 4 (-1 + (3/4)^y) a (-1 + b) +
4 (3 + 2^-y - 3^y 4^(1 - y)) a (a + b)^2 *)

h[2]
(* 37/3 4^-y (3^y - 4^y) - (a (-4 (-1 + (3/4)^y) (-1 + b) +
4 (3 + 2^-y - 3^y 4^(1 - y)) (a + b)^2))/((-1 + a) (-1 + b)) +
(1 - a) (1 - b) (28/3 (-1 + (3/4)^y) - 4 (-1 + (3/4)^y) a (-1 + b) +
4 (3 + 2^-y - 3^y 4^(1 - y)) a (a + b)^2) *)


At this point, it is convenient to computer the first thirty h,

h[30];


which takes about ten minutes. With that result stored automatically in the notebook, the desired plots are obtained quickly.

 ListPlot[Table[{u, h[u] /. {a -> 5/6, b -> 1/6, y -> yy}},
{yy, -2, 2}, {u, 0, 30}], Joined -> True, PlotRange -> All,
PlotLabels -> Range[-2, 2], ImageSize -> Large, AxesLabel -> {u, h},
LabelStyle -> {12, Bold, Black}]


Apart from y = 0, which yields an identically zero curve, other values of y yield growing oscillatory solutions. (Replacing b -> 1/6 by b -> 1/46 yields asimilar curves.)

• Thanks a lot for the neat description of the method. One last question though, how may I find the asymptotic values of h[u] as y tends to infinity?
– Rosy
Aug 30, 2022 at 13:14
• @Rosy Because the solution appears to be oscillatory and growing in amplitude, I do not believe that there is a constant value at infinity. By the way, the recurrence relation can be converted into a form that RSolve` can be used, but the resulting answer is extremely complicated and probably not of much use. Aug 30, 2022 at 14:08
• Thank you for your inputs.
– Rosy
Aug 31, 2022 at 8:14