In physics and mathematics, the heat equation is a partial differential equation that describes how the distribution of some quantity (such as heat) evolves over time in a solid medium.
Write a function that simulates the temperature distribution over time using Finite difference method with Explicit scheme.
The input for the function is a dictionary with problem specification. The function should initialize the interior of the array to "u_0", set the boundary values on the perimeter. The boundary values stay constant.
# Initialize e.g. rows, cols = 5, 7
[
[100. 5. 5. 5. 5. 5. 100.]
[100. 10. 10. 10. 10. 10. 100.]
[100. 10. 10. 10. 10. 10. 100.]
[100. 10. 10. 10. 10. 10. 100.]
[100. 100. 100. 100. 100. 100. 100.]
]
Execute the time simulation up to the largest value in 'n_steps': [0, 100, 200]. Only the interior of the array changes on each time step. Save the value of temperature at observation point "observe": [10, 10] at specified time steps [0, 100, 200]. Return the list of temperatures, (of length 3 in this example.) Rounding is not needed, it will be done in the Tests.
The following three problems will be simulated. First has 3 hot boundaries, second has 2, third has hot bottom. These three set ups lead to different temperature distributions as can be seen in Figure.

x and y).u^(n+1) is computed directly using 5 points of u^n.r is less than 1/4, thus the scheme is numerically stable.