A recursive Newton type algorithm for digital frequency relaying