# How do I write this basic recursive formula into Desmos?

I want to graph a simple equation $$f(x)$$ which begins at $$(0,1)$$, then for every increasing $$x$$ integer increment, $$f(x) = f(x-1) - (c * f(x-1))$$.

So in other words each time you go up by one $$x$$ integer you take the previous $$x$$ value's $$y$$ output and subtract from it its value multiplied by a constant $$c$$.

It should output a stepwise graph with changes in $$y$$ value for every $$x$$ integer.

How do I do this in Desmos? Can you perhaps post a link to illustrate?

How would it also work differently if you wanted it to do the multiplication/subtraction every $$5x$$ integers to create a stepwise change for every $$5x$$ integers?

I don't need it to graph to $$x=infinity$$. Even if it can graph to $$x=20$$ or so this will help me solve my problem.

• @TheSimpliFire - that should be $$f(x) = (1-c)^{\lfloor x\rfloor}$$ (since mike says it is a step function changing only at integers, $f(x) = f(\lfloor x\rfloor)$), Mike - the answer to your other question is simply to change $f(x - 1)$ to $f(x -5)$. The solution then is $$f(x) = (1-c)^{\lfloor x / 5\rfloor}$$ Nov 30, 2019 at 17:32
• @TheSimpliFire - my apologies - I should have checked that. Nov 30, 2019 at 19:10

• Transform $$f(x)$$ into the list of $$f$$. Since desmos list index start in 1, not 0 and known initial value is $$f(0)=1$$ so we assume $$f[1]=f(0)$$, therefore in general $$f(x)=f[x+1]$$. Lists
• Transform $$f(x) = f(x-1) - (c * f(x-1))$$ into lists operation $$f \rightarrow join(f,f[l]-c*f[l])$$. Since we are using list format and computational problem, define operator ($$=$$) is not good choice, instead we use assign operator ($$\rightarrow$$) A.K.A. action. This action will appending current list $$f$$ with your function depends on last index of $$f$$ with using $$join()$$ function to append it. Actions.
• Using ticker to perform computation until $$x=20$$. Click metronome icon to perform computation and you will get the result of possible points. Actually you can iterate it manually with click arrow button. But clicking it manually is wasting time, so limit it until $$x=20$$ is enough with conditional syntax or piecewise function format with curly bracket. Do action $$I$$ while $$f_{length}$$ <= 20. We don't need itteration delay, so we set it to the 0ms.