An culture particle swarm optimization algorithm (CPSO) for solving the large and serious ill-conditioned matrix equation in semiconductor simulation exactly and quickly is presented. This algorithm is constructed by the population space based on particle swarm and the knowledge space. By the example of solving the potential in linearly graded p-n junctions, the method is compared against Newton algorithm and traditional PSO and can achieve high accuracy, velocity of convergence and saving memory. In simulation of diodes, the simulation results are accord with that of theoretical analysis, which shows the CPSO algorithm is applicable and veracious.