solution - abs(x,y = |x y| counter return matT[i[j public...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // put this in the class data int totlRows = 10 int totlCols = 10 // Precondition: matT is already initialized public static double calcTemp(double matT[][], int i, int j){ double acceptable = 0.01 double newValue int counter = 0 while(counter < totlRows*totlCols){ for(int row = 0 for(int col = 0 if(row == 0 || row == totlRows - 1 || cols == 0 || cols == totlCols - 1 || counter++ else{ newValue = (matT[row+1][col] + matT[row-1][col] + matT[row][col+1] + T[row][col-1])/4 if(abs(matT[row][col],newValue) <= acceptable )
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // abs(x,y) = |x - y| counter++ } } } } return matT[i][j] } public static void initialize (double matT){ double matT = new double [totlRows][totlCols] for(int row = 0 for(int col = 0 if(row == 0 || row == totlRows - 1 || col == 0 || col == totlCols - 1) matT[row][col] = 20.0 else if(row == 2 && col == 7) matT[row][col] = 100.0 else mat[row][col] = 50.0 } } } Sheet1 Page 2 row < totlRows row++){ col < totlCols col++){ row < totlRows row++){ col < totlCols col++){...
View Full Document

This note was uploaded on 12/01/2010 for the course APPLIED SC 142 taught by Professor Professorstansimmons during the Winter '10 term at Queens University.

Page1 / 2

solution - abs(x,y = |x y| counter return matT[i[j public...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online