Aissgin54 - double Test2 = new double[10[10 Test2 =...

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

View Full Document Right Arrow Icon
// The "Aissgin54" class. public class Aissgin54 { public static double [] [] calcTemp (double Test [] [], int i, int j) { Test [i] [j] = (1. / 4) * (Test [i - 1] [j] + Test [i + 1] [j] + Test [i] [j - 1] + Test [i] [j + 1]); return Test; } public static double [] [] calcTemp2 (double Test2 [] [], int i, int j) { Test2 [i] [j] = (1. / 4) * (Test2 [i - 1] [j] + Test2 [i + 1] [j] + Test2 [i] [j - 1] + Test2 [i] [j + 1]); return Test2; } public static double [] [] initialize () { double Test [] [] = new double [10] [10]; for (int a = 1 ; a < 10 ; a++) { for (int b = 1 ; b < 10 ; b++) { Test [a] [b] = 50; } } for (int b = 0 ; b < 10 ; b++) { Test [0] [b] = 20; Test [b] [0] = 20; Test [9] [b] = 20; Test [b] [9] = 20; } Test [2] [7] = 100; return Test; } public static void main (String [] args) { double Test [] [] = new double [10] [10]; Test = initialize ();
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: double Test2 = new double [10] [10]; Test2 = initialize (); double mon = 0; double work; for (int y = 0 ; y < 100 ; y++) { for (int i = 1 ; i < 9 ; i++) { for (int j = 1 ; j < 9 ; j++) { Test = calcTemp (Test, i, j); if ((i == 2) && (j == 7)) { Test [i] [j] = 100; } } } if (y >= 1) { for (int i = 1 ; i < 9 ; i++) { for (int j = 1 ; j < 9 ; j++) { Test2 = calcTemp2 (Test2, i, j); if ((i == 2) && (j == 7)) { Test2 [i] [j] = 100; } } } } for (int i = 1 ; i < 9 ; i++) { for (int j = 1 ; j < 9 ; j++) { work = (Test2 [i] [j]) - (Test [i] [j]); if (mon < work) { mon = work; m } } } if (mon < 0.01) { break; } mon = 0; } System.out.print ("Steady State Temperature at (4,4) is " + Test [4] [4]); [ //System.out.println (mon + " g\n" + gre); } // main method } // Aissgin54 class }...
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

Aissgin54 - double Test2 = new double[10[10 Test2 =...

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