The objective of this work is twofold. One, we develop a theory of iteration for complex rational functions so that the problems of overflow and indeterminacy caused by null, or almost null, denominators can be avoided when developing implementations. Second, we present easily implementable methods that allow the calculation of attracting cycles as well as the graphical representation of their basins of attraction.In order to deal with our first goal we work with homogeneous complex coordinates and we take the complex projective line as a model, which is expressed as a quotient of the 3-sphere through the Hopf fibration. An irreducible representation of a rational function can now be presented as a Hopf fibration endomorphism. As well as our second goal is concerned, we use Lyapunov functions and exponents to calculate the cycles associated with endomorphisms and to graphically represent the corresponding basins of attraction. We point out that our algorithms are based on the calculation of a finite set of non-negative real constants and their calculation does not depend on the previous determination of the fixed points or attracting cycles.