root finding for error analysis