how to calculate residues - Search