Hey algorithm.

Your series expansion for a two dimension function will look like f(x+a,y+a) = f(a,b) + df/dx|x=a*(x-a) + df/dy|y=b(y-b) + d^2f/dx^2*(x-a)^2 + d^2f/dxdy|x=a,y=b * (x-a)*(y-b) + ... +

You can get an idea from here:

Taylor series - Wikipedia, the free encyclopedia