Intersection numbers and characters of algebraic curves and surfaces: theory and computation