Root-finding method