# Determining the voltage ripple when the transient is over (mistake in result)

Well, I have the following code:

Clear["Global*"];
u = 5;
\[Tau] = (1/2)*10^(-3);
c = 10^(-6);
r = 1000;
y = u*Sum[((1 - E^((-t + \[Tau] + 4 n \[Tau])/(c*r)))  HeavisideTheta[
t - 4 n \[Tau]] HeavisideTheta[
t - \[Tau] - 4 n \[Tau]]) - ((1 - E^((-t + (3 + 4 n) \[Tau])/(
c*r))) HeavisideTheta[t - 4 n \[Tau]] HeavisideTheta[
t - (3 + 4 n) \[Tau]]), {n, 0, Infinity}];


And I want to find the ripple in the voltage given by y when the transient part of that function is over. I can do that by finding the period time of that function and I found that I can use:

$$\lim_{\text{k}\to\infty}\left|\text{y}\left(\left(2\text{k}+3\right)\tau\right)-\text{y}\left(\left(2\text{k}+1\right)\tau\right)\right|\tag1$$

Programming that in Mathematica, gives the following code:

FullSimplify[
Limit[Abs[(y /. t -> (2*k + 3)*\[Tau]) - (y /.
t -> (2*k + 1)*\[Tau])], k -> Infinity]]


And Mathematica returns:

Interval[{0, 20}]


Which is wrong, because it must return (I know that that is the good answer):

$$\frac{5 (e-1)}{1+e}\approx2.31059\tag2$$

Where is my mistake, is it a coding mistake? Or a mathematical mistake? Thanks for any help.

Not an answer just trying to clarify what you are looking for. I evaluate your code

Clear["Global*"];
u = 5;
τ = (1/2)*10^(-3);
c = 10^(-6);
r = 1000;
y = u*Sum[((1 - E^((-t + τ + 4 n τ)/(c*r))) HeavisideTheta[
t - 4 n τ] HeavisideTheta[
t - τ - 4 n τ]) - ((1 -
E^((-t + (3 + 4 n) τ)/(c*r))) HeavisideTheta[
t - 4 n τ] HeavisideTheta[t - (3 + 4 n) τ]), {n, 0,
Infinity}];


Plot[y, {t, 0, 25/1000},