Complete the provided partially developed program that calculates the steady state temperature distribution for the printed circuit board (PCB) with up to ten heat sources. The calculations are performed based on the following assumptions and simplifications:
NEW[r][c] = (OLD[r-1][c] + OLD[r+1][c] + OLD[r][c-1] + OLD[r][c+1] ) /4.0
Please note, that ordinarily you cannot apply that formula to the border rows
and columns. For border rows, columns and corners please modify the formula
accordingly and substitute the nonexistent array elements with ambient
temperature.
Run your program for a grid of 20x20, 2 heat sources: (5,5,10) and (10,15,5), ambient temperature of 70F, and MSE error of 1E-6. After the program completes (approximately 350 iterations) import file tempplate.csv into Excel spreadsheet and print the result table using surface plot. Change the z-axis from autorange to the range of values observed in the output numbers. Attach that to the program source code and output printout. The surface plot should look like this.
The idea of the program is loosely based on the problem 10 from Chapter 3, page 140 and on past course assignments. However, solving the original textbook problem instead of this one will not receive any credit. Please refer to the instructor's comments that were (will be) made during lectures if the rough description included on this page combined with comments provided in the source code and the textbook problem description are not detailed enough.
Complete the provided outline of the Game of Life simulation program. The program has been written except that contents of most functions has been removed and left for you to do as an exercise. The functionality of functions is briefly described in the form of comments. The functionality of the whole program is also somewhat commented.
Your job is to analyze the provided program in order to find out how it implements the algorithm described above. Complete the missing implementation for functions. Also note the commented swapping of array pointer that is actually a preferred alternative to copying contents of the arrays.
Run your program a few times and capture a few most recent screens prior to program termination for a run that produced some interesting results such as persistent constant or oscillating patterns. This program will stop automatically when it detects a constant or two phase oscilating pattern but will fail to notice three or more phase patterns. Use the world of 10 by 20 for your experiments.
This homework is based on the textbook problem Chapter 3, Problem 11, Page 140. You may also want to look at Conway's Game of Life and its GUI implementation.
Improve the game of life program so that it can detect also three- and four-phase patters as stop condition, and also make it more efficient by utilizing pointer swapping instead of array copying that is now commented for one- and two-phase patter detection. You may turn in the improved version instead of the original assignment but to expedite grading please write "includes extra credit" at the top of the program. Please note that it may be too difficult to fully test if your improvement works as there is very little chance that you would encounter higher phase patterns from random initial condition.
Redo the array-based city zone population assignment from Homework 2 using pointer-based dynamic arrays created according to the user specified number of zones at the time of executing the program. Also create and use a function that prints the populations for current year instead of printing directly from the main program. You may also develop and use more functions if you have time to exercise. (Pass all necessary data to the function, no global variables allowed.) Remember to prevent memory leaks. Mostly only the modified portions of code will be graded but the program must be functional to qualify for the extra credit.