Question
Please write in Python. This is my code from the previous step: import numpy as np import matplotlib.pyplot as plt pentadecathlon = np.zeros( ( 24,24
Please write in Python.
This is my code from the previous step:
import numpy as np import matplotlib.pyplot as plt
pentadecathlon = np.zeros( ( 24,24 ) ) pentadecathlon[ 10:20,10 ] = 1 pentadecathlon[ 12, 9 ] = 1 pentadecathlon[ 12,10 ] = 0 pentadecathlon[ 12,11 ] = 1 pentadecathlon[ 17, 9 ] = 1 pentadecathlon[ 17,10 ] = 0 pentadecathlon[ 17,11 ] = 1
pd_list = [pentadecathlon] nt = 30 for t in range(nt): pentdecathlon = evolve(pentadecathlon) pd_list.append(pentadecathlon) # evolve the simulation and append it to `pd_list` plt.imshow( pd_list[ -1 ] ) plt.show()
Conway's Game of Life 5 points Finally, we will model how the game evolves over time in a single plot. Modify your code from the previous step. Instead of storing the time steps as separate elements in a list , each time step should be added to an accumulator array pd_time. This will give us a "heat map" of how the system has evolved over time. Use pentadecathlon again. pentadecathlon - np. zeros((24,24 ) ) pentadecathlon[ 10:20, 10 ] = 1 pentadecathlon[ 12, 9] = 1 pentadecathlon[ 12,18 ] = e pentadecathlon[ 12,11 ] = 1 pentadecathlon [ 17, 9 ] = 1 pentadecathlon[ 17,10 ] = 0 pentadecathlon [ 17,11 ] = 1 Your submission for this part should include the ndarray named pd_time. After you have completed this step, try simulating other shapes and see what you can find out about the behavior of this complex system arising from simple rules. Starter code (click to view) import numpy as np import matplotlib.pyplot as plt pentadecathlon = np.zeros(( 24,24 ) ) pentadecathlon[ 18:28,10 ] = 1 pentadecathlon[ 12, 9] = 1 pentadecathlon[ 12,18 ] = @ pentadecathlon[ 12,11 ] = 1 pentadecathlon[ 17, 9] = 1 pentadecathlon[ 17,18 ] = 0 pentadecathlon[ 17,11 ] = 1 pd_time = ??? evoln = pentadecathlon[:] nt = 30 for t in ???: ??? # evolve the system forward in 'evoln pd_time += evoln plt.imshow( pd_time) plt.show() Conway's Game of Life 5 points Finally, we will model how the game evolves over time in a single plot. Modify your code from the previous step. Instead of storing the time steps as separate elements in a list , each time step should be added to an accumulator array pd_time. This will give us a "heat map" of how the system has evolved over time. Use pentadecathlon again. pentadecathlon - np. zeros((24,24 ) ) pentadecathlon[ 10:20, 10 ] = 1 pentadecathlon[ 12, 9] = 1 pentadecathlon[ 12,18 ] = e pentadecathlon[ 12,11 ] = 1 pentadecathlon [ 17, 9 ] = 1 pentadecathlon[ 17,10 ] = 0 pentadecathlon [ 17,11 ] = 1 Your submission for this part should include the ndarray named pd_time. After you have completed this step, try simulating other shapes and see what you can find out about the behavior of this complex system arising from simple rules. Starter code (click to view) import numpy as np import matplotlib.pyplot as plt pentadecathlon = np.zeros(( 24,24 ) ) pentadecathlon[ 18:28,10 ] = 1 pentadecathlon[ 12, 9] = 1 pentadecathlon[ 12,18 ] = @ pentadecathlon[ 12,11 ] = 1 pentadecathlon[ 17, 9] = 1 pentadecathlon[ 17,18 ] = 0 pentadecathlon[ 17,11 ] = 1 pd_time = ??? evoln = pentadecathlon[:] nt = 30 for t in ???: ??? # evolve the system forward in 'evoln pd_time += evoln plt.imshow( pd_time) plt.show()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started