The optimal magnetic circuit for an undulator has been developed using a strong Nd-Fe-B permaent magnet. The field distributions in the undulator have been simulated using an integral equation method in order to investigate the effects of the deviation of an individual magnet from ideal conditions, and some decreasing methods have been also discussed by shuffling the individual magnet.