Let's say I want to find a recursive equation for an exponentially weighted moving average
EV[t_]:=(a-1)/(a^t-1)*Sum[a^(t-i)*x[i],{i,1,t}]
I can do that manually to come up with an equation
EVR[t_]:=(a-1)/(a^t-1)*x[t]+(a^t-a)/(a^t-1)*EVR[t-1]
EVR[1]=x[1]
We can check whether the manually derived equation is correct via
Table[(EV[i]==EVR[i])//FullSimplify,{i,2,10}]
which gives
{True,True,True,True,True,True,True,True,True}
In Mathematica, how would I find the recursive equation for EVR[t]
assuming that the equation for EV[t]
is given?
Also, the exponentially weighted moving average is just a minimal example. The actual sums are more complicated.
EVR
so that the check in the next line is shorter. Otherwise, I would have had to writeTable[(EV[t]==(a-1)/(a^t-1)*x[t]+(a^t-a)/(a^t-1)*EV[t-1])//FullSimplify,{t,2,10}]
. But I will change this to make it clearer. $\endgroup$RSolve
. Not sure if it is possible to go the other way. $\endgroup$