We calculate linear and nonlinear optical effective refractive indices of finite period one-dimensional photonic crystals, Bragg reflectors and photonic crystal microcavities, by using numerical dispersion relation. We discuss optical dispersive properties of both the Bragg reflectors and the photonic crystal microcavities. For Bragg reflectors, optical Kerr nonlinearity is enhanced at bandgap edges, and the singularity problem at bandgap edges, occurred in Bloch index for infinite structure, is removed by the numerical dispersion relation. Also, the numerical dispersion relation is adopted to describe optical property of photonic crystal microcavities, for which Bloch index is not available. Optical Kerr nonlinearity in photonic crystal microcavities is found to be more enhanced at optical defect modes than at bandgap edges. Z-scan profiles of a Bragg reflector and a photonic crystal microcavity are numerically simulated based on the calculated nonlinear effective refractive indices, which show peaks at bandgap edges and defect mode incurred by dispersion anomaly.