If I have derived a finite-difference formula for a 2D problem, for example something like:
$af_{i,j}+bf_{i-1,j}+cf_{i,j-1}+df_{i-1,j-1}=g_{i,j}$
where f is the unknown function on a grid and everything else is known, how do I fill the entries in the finite difference matrix $A_{i,j}^{i',j'}$ in the general case?
Can I construct some rules based on the above of the form "if $i>j-1$ then..."?
In every book on the subject they simply show the matrix and demonstrate it works. But I'm interested in the general case because I would like to derive some complicated finite difference formulae (much more complicated than, say, 2D diffusion). It might be better to use different notation to the one I used above.