  The paper discusses the affection of the scalar potential on the speed of
light in the electromagnetic field, by means of the characteristics of
octonion. In the octonion space, the radius vector is combined with the
integral of field potentials to become one new radius vector. When the field
potentials can not be neglected, the new radius vector will cause the
prediction to departure slightly from the theoretical value of the speed of
light. The results explain why the speed of light varies in diversiform optical
waveguide. And there exist negative refractive indexes due to different scalar
potentials in the gravitational field and electromagnetic field.
