finite difference caluculation