17.11.2012 Views

Numerical recipes

Numerical recipes

Numerical recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

19.6 Multigrid Methods for Boundary Value Problems 881<br />

u[2][2] = -h*h*rhs[2][2]/4.0;<br />

void relax(double **u, double **rhs, int n)<br />

Red-black Gauss-Seidel relaxation for model problem. Updates the current value of the solution<br />

u[1..n][1..n], using the right-hand side function rhs[1..n][1..n].<br />

{<br />

int i,ipass,isw,j,jsw=1;<br />

double h,h2;<br />

}<br />

h=1.0/(n-1);<br />

h2=h*h;<br />

for (ipass=1;ipass

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!