To alleviate the drawback of easily getting into the local minimum appearing in the BP neural network, this paper applies the particle swarm algorithm to the optimization of BP neural network. Primarily, we utilize the particle swarm algorithm to get the optimal weight values as well as the optimal threshold values. Then, by assigning the optimal values to the corresponding parameters, we can optimize the BP neural network. Moreover, the performance of the optimized BP neural network is measured by means of the numerical method. The results demonstrate that, compared with the original BP neural network, the optimized BP neural network through the particle swarm algorithm can quickly converge to the preset target and hold the advantages of high calculation accuracy and quick convergence speed.