In this exam, you will demonstrate your mastery of CSCI 285 concepts in two parts. Part #1 focuses on solving a system dynamics problem. Part #2 involves a Monte Carlo simulation.
One piece of computational neuroscience involves the simulation of individual neurons. Mathematical models with differential equations can be written to capture the flow of chemicals across neurons and emulate the spiking and bursting behavior over time.
One of the more straight-forward biological neuron models is the Hindmarsh-Rose. Three variables, x, y, and z capture pieces of the membrane and ion channels, with x showing the spiking of the neuron activation over time.
x
y
z
Using odeint, you will solve and visualize the Hindmarsh-Rose model for x(t), y(t), and z(t).
odeint
To earn a Partially Complete on the exam, you must
Write a function to calculate the derivative of x, y, and z at a given point in time. Use the equations as shown on the Wikipedia page. They use the [] to denote another level of paraenthesis, so don’t be fooled, it is not an index lookup.
Use odeint and your function above to solve the model given the following:
Display the trajectory of the x variable over time, using a line graph in plotnine. Make sure that you set a title for this chart.
To earn a Complete on the exam, you must also
Use odeint and your function above to solve the model, but let I alternate between 1 and 2 every 400 timesteps.
I
Plot the trajectory of the x variable over time, and discuss what you observe.
Snakes and Ladders is a classic board game with ancient and mystical origin from India. You will attempt to estimate how long it takes a player on average to finish the game.
For our purposes, we will use the following setup and rules. The board consists of 100 sequentially numbered squares in a 10x10 grid. Players start the game by placing a pawn off the board (in space 0). On their turn, a player rolls a six-sided die (known as a d6) and moves that many spaces along the track. So if you roll a 3, you move 3 spaces ahead. When you reach or exceed 100 on the track, you have finished the game.
The twist is that some spaces are linked through one-way connections to others, either moving you far behind (Snakes) or far ahead (Ladders). These connections must be followed. When you land on a square with the head of a snake, you must travel backward on the board to the tail square. When you land on a square with the base of a ladder, you must travel foward to the top of the ladder.
Here is a dictionary of connections based on the board above, you might find it useful. The key is the starting point, and the value is the ending point.
connect = {1:38, 4:14, 8:30, 21:42, 28:76, 32:10, 34:6, 48:26, 50:67, 62:18, 71:92, 80:99, 88:24, 95:56, 97:78}
Write code to simulate one player’s pathway through Snakes and Ladders and determine the number of turns taken to finish the game.
Run the above simulation 1000 times, collecting the number of turns from each simulated game, and calculate the mean value.
Draw a histogram of the data collected from the 1000 simulations, with the number of turns on the x axis. Also draw a vertical line indicating the mean.
Compare the results above with a version of the game where players move by rolling two three-sided die (2d3) and summing the values rolled.
Discuss the following: If you were given a choice of using a single six-sided die or summing two three-sided die, which would you choose and why?
A Jupyter notebook that begins with the following statement,
All of the below work is my own. I adhered to the test-taking procedure by not receiving any help from my peers or generative AI. I have cited all resources I found online or from notebooks shared from class that helped me complete this exam.