# How to add function to a recursive equation?

If I have the equations $$f(x)=30c^x$$ and $$g(x)=g(x-1)+f(x)$$, $$g(0)=30$$ why is $$g(x)=30xc^x+30$$ not the answer when something like $$h(x)=h(x-1)+c$$, $$h(t)=d$$ would make $$h(x)=c(x-t)+d$$? What I try to do goes as follows $$30c^x(x-0)+30$$ or $$30xc^x+30$$ but it does not have the same line or even shape. Here is my graphs desmos.com red=expected, purple=$$f(x)$$, green=unexpected. What am I doing wrong or is this something that is mathematically incorrect to try and do?

Simply because $$h(x) = d$$ is a constant function, you have predetermined the entire future and history of $$h(x)$$ in $$x$$. Whereas, $$g(0)=30$$ only says that at $$x=0$$, $$g(0)=30$$, but it's past and future are decided by $$g(x) = g(x-1)+f(x)$$. A simpler example could be $$h_1(x) = 4$$ which is a constant function, whereas h_2(0)=4 and h_2(x+1)=h_2(x)+4, $$h_2(x)$$ is a linearly growing function.