How to calculate a recursive Function

168 Views Asked by At

Let $f(x)$ be defined as $f(5x/4)$. Let $x = 6$. The result should be $2$. How would I calculate this?

This equation arose while developing a game. Let's say you have a conveyor belt and you want to separate the items equally between $3$ lines. However, you only have a machine that separates them into $2$ lines equally. So you take one machine and on each of the $2$ out puts you put another machine, making $4$ equally separated lines. Than you take one of the lines and feed it back into the main line. When you have $6$ items per second, this should result in a result of $3$ lines with a total of 2 items per second. The Actual equations would be $f(x)=f(x + x/4)$. Hope this picture helps for visualization.

Edit: I don't think my function is right, because it tends to infinity.

I think it should be f(x)=x + f(x/4). And I think this should be an infinite sequence which should be convergent.

Edit: I think the infinite serize x + x/4 + x/16 + x/64 + x/256 ...

f(x)=x times the sum of 1/(4^i) where i = 1 and i goes to infinity. The infinite sum converges at 1/3. Meaning f(x) = x/3. If you use Wolfram Alpha, this is their syntax. Sum[Divide[1,Power[4,i]],{i,1,∞}]

Image of conveyor belt

3

There are 3 best solutions below

0
On BEST ANSWER

$$\text{in}(t_n)=6+\frac14 {\text{out}(t_n)}\\ \text{out}(t_n)=\text{in}(t_{n-1})$$

Asume that the limits exist and $$\lim_{n\to \infty}\text{in}(t_n)=\text{in}_0$$ and $$\lim_{n\to \infty}\text{out}(t_n)=\text{out}_0$$ then you have $$\text{in}_0=6+\frac14 {\text{out}_0}\\ \text{out}_0=\text{in}_0$$ and from this $$\implies \text{in}_0=6+\frac14 {\text{in}_0}\implies \text{in}_0=8$$ and $$\frac14 \text{out}_0=2$$

The sequence $$ \text{in}(t_n)$$ is increasing and bounded by $8$, so it must be convergent.

3
On

The reason why your equation is difficult to "solve" is just that you have mixed two different quantities up and called both $x$. Let's call $x$ the total number of items externally entering the system per unit time, and let's call $y$ the number of items actually entering your splitters per unit time. Then the correct equation analogous to the one you have written down is just that (in the steady state) $y = x + \frac{y}{4}$, essentially as you have observed.

This equation is easy to solve for $y$; we get $y = \frac{4}{3} x$. This is fine: it just says that no matter the number $x$ of items entering the system per unit time, we'll always have $\frac{y}{4} = \frac{1}{3} x$ i.e. $\frac{1}{3}$ of that rate of items circling back in the one of the four channels which feeds back into the inputs. (This is assuming that $x$ is constant and we are in the steady state.)

Everything still works out and the conveyor belts don't get clogged up because we can calculate that the number of items leaving the 3 remaining belts per unit time is (as you have said) just $\frac{3}{4} y = \frac{3}{4} \cdot \frac{4}{3} x = x$, i.e. per unit time the same number of items leave the system as enter.

7
On

Let's say we have an input rate of $x_i$ and the rate of items getting looped back through is $x_l.$ The total input rate into the system which divides into four conveyor belts is $x_i + x_l,$ so each conveyor belt will have a rate of $\frac{x_i + x_l}{4}.$ Then the rate of the loop will become the rate of one conveyor belt, so $x_l \leftarrow \frac{x_i + x_l}{4}.$

Equilibrium will occur when $x_l$ continuously gets the same value, so when $\frac{x_i + x_l}{4} = x_l,$ implying $x_l = \frac13 x_i.$ If $x_l$ starts below $\frac13 x_i,$ then $\frac{x_i}{4} > \frac{3x_l}{4}$ implies that $\frac{x_l + x_i}{4} > x_l,$ and similarly if $x_l$ starts out above $\frac13 x_i$ we obtain $\frac{x_i + x_l}{4} < x_l.$

This means that over time the system should naturally fall into a stable equilibrium where $x_l = \frac13x_i,$ which will lead to each output stream having $\frac13$ of the input as you desired.