偏微分方程的求解是很多科学技术问题的关键难点。随着计算机性能的不断提高,数值解法能够解复杂的偏微分方程并将计算结果图形化。相对于昂贵的科学计算软件,Python是一种免费的面向对象、动态的程序设计语言。有限差分法以其概念清晰,方法简单、直观等特点在偏微分方程的求解中得到了广泛的应用。文章对矩形区域的拉普拉斯方程进行数值求解,采用Numpy对有限差分法进行计算,运用Matplotlib绘制等值线,输出迭代次数以及误差。%To solve the partial differential equations (PDE) is a key difficult point in many scientific and technical problems. With the development of computer performance, numeric solution can solve many sophisticated PDE and visualize the numeric results. Rather than the expensive science computing software, Python is a free object-oriented language, dynamic programming language. Finite difference method (FDM) is widely used for its clear, simple and intuitive. Laplace problem in a rectangular area is solved numerically in the article, computed through FDM with the Numpy library, visualized through plotting the contour by the Matplotlib library, and the number of iteration and the error are given.
展开▼