I am interested in deriving finite difference equations, which means I have to play around with indexed quantities. For example, for a 2D function f(x,y), I could discretize it on a grid with grid points (i,j) and a typical finite difference model might give:
f(i,j)-g(i,j) = a(i,j)f(i+1,j)-b(i,j)f(i,j)+c(i,j)f(i+1,j+1)
where I know g,a,b and c. I might want to do things like rearrange the above for f(i+1,j+1), or find an expression for f(i+n,j) for arbitrary n, or find coefficients of f(i,j) etc. I might also want to use simultaneous equations like this.
What's the best way of representing this kind of maths so that I can perform these manipulations?
Edit: Here's a simple example. If I have two difference equations:
f[i,j]=fold[i,j]+a*( g[i+1,j]-g[i-1,j] )
g[i,j]=gold[i,j]+b*( f[i,j+1]-f[i,j-1] )
in the functions f and g, where fold,gold,a and b are known. Then I would like to be able to solve these for g[i,j] in terms of the knowns and g at other indices eg. g[i+1,j]. To do this on paper, I use the first equation to give me expressions for f[i,j+1] and f[i,j-1] and then insert these into the RHS of the bottom equation. Then I would like to extract coefficients of things like g[i+1,j+1] from the final expression for g[i,j].
How can I do that in Mathematica?