/* From: "COMPUTATIONAL PHYSICS, 2nd Ed" by RH Landau, MJ Paez, and CC Bordeianu Copyright Wiley-VCH, 2007. Electronic Materials copyright: R Landau, Oregon State Univ, 2007; MJ Paez, Univ Antioquia, 2007; & CC Bordeianu, Univ Bucharest, 2007 Support by National Science Foundation */ // laplace.c: Solution of Laplace equation with finite differences // Output data is saved in 3D grid format used by gnuplot #include #define max 40 // number of grid points main() { double x, p[max][max]; int i, j, iter, y; FILE *output; // save data in laplace.dat output= fopen("laplace.dat","w"); for (i = 0; i