Check back often for homework assignments, tutorials, and key topics covered each day.
This schedule is approximate and subject to change!
Go to your class page: 8:35–9:50am or 10:45am–noon
Monday, January 27
In class:
- Welcome!
- Introduction & Syllabus Discussion '
- Sections 1.0 and 2.1 of Modeling and Simulation in Python.
- What is Mathematical Modeling?
- Steps of the Modeling Process
- Course Philosophy
- Meet the model(er)s
- Visit the course webpage. ⬅ You are here!
- Get started with Jupyter Notebooks:
- Go to http://notebooks.azure.com and log in with your Queens College Office 365 account.
- After you are logged in, navigate my notebook repository.
If you're in the 8:35 section, go to
https://notebooks.azure.com/qzzq/projects/modsimpy-sp20-02/tree/notebooks.
If you're in the 10:45 section, go to
https://notebooks.azure.com/qzzq/projects/modsimpy-sp20-01/tree/notebooks. - On the upper-right hand corner click on the "Clone" button
- In the pop-up window click "Clone" again. In a minute or two you will have a copy of all the files in your account.
- Access Google Groups:
- Here is how to log on: Visit Google Drive (on Google Apps for Education). Enter your QC Email Address. This will take you to a QC login page. Log in with your CAMS information. (Your username will be something like alastname102 if your name is Alicia Lastname.)
- Next, visit and join our Discussion Board on Google Groups.
If you're in the 8:35 section, go to https://groups.google.com/a/qc.cuny.edu/forum/#!forum/245sp20-02-list
If you're in the 10:45 section, go to https://groups.google.com/a/qc.cuny.edu/forum/#!forum/245sp20-01-list. - When you are there, respond to Daily Question: January 27 on the Discussion Board. Look at your classmates' responses and make a comment on them when you can relate.
- Google Groups is our discussion board and were you will contribute to the Daily Questions.
- Randomness and flipping coins in Python
- flip(): Adding in Randomness
- Link to in-class modified Coin Flip Notebook 8:35am - OR - 10:45am
Wednesday, January 29
Before class:
- Make sure you have access to a copy of Python and the course content outside of class, by either installing it on your own machine or using Azure Notebooks on a campus machine. (Detailed instructions here)
- Acquire a ≈80 page notebook to serve as your "Class Notebook".
- Put your name and contact information on or near the cover of the notebook so you'll be able to get it back.
- Thoroughly read all of the course webpage.
- Complete the following two tasks:
- Complete the First Day Survey, so I can learn about everyone's background and experience.
- Take the Syllabus Quiz. Feel free to refer back to the course webpage to search for more in form. Retake the quiz as many times as necessary to earn a score of 100%. This will count toward your participation grade.
- Fill out this Doodle to let me know when you are available for office hours this semester. (Pretend like it is a normal week with no holidays --- select the times when you would be able to come to office hours regularly.) I will try to choose times that work for most people.
- Read Chapter 0, Section 1.0 (pages 1–3), and Sections 2.1–2.5 (pages 7–14) of Modeling and Simulation in Python. We will be starting with Chapter 2 in class Wednesday. It is OK if you do not understand everything. You are priming your brain for our in-class discussion. You may wish to write yourself some notes about questions that come up or concepts that you'd like to discuss in class.
- Homework Questions: Complete the following homework questions in your class notebook and be prepared to discuss them in class. Work in your class notebook. Label the top of the page by the date and Homework #1. Objects
- 1-1. Write a sentence that explains what a State object is.
- 1-2. In the introduction to Chapter 1, the author explains a quality of a model that might be desirable. Copy down the paragraph that starts "But often ".
- 1-3. How do we read the variables inside a State object?
- 1-4. What is the process called that makes the functions defined in modsim.py available to Python? What is the line of code that accomplishes this?
- 1-5. What is the name of the package that allows us to work with units in python? (See page xii.) What is the line of code that imports this package into our notebooks? (See the course software page.)
- 1-6. Every time you create a new file that runs python code you need to put the file into a particular directory in your file structure. What directory is it? (See the course software page.)
In class:
- Introduction to Bike Share Model
- Sections 2.1 through 2.5 of Modeling and Simulation in Python.
- Link to in-class modified Coin Flip Notebook 8:35am - OR - 10:45am
- Link to in-class modified Chapter 2 notebook: 8:35am - OR - 10:45am
Monday, February 3
Before class:
- Go to our Discussion Board: 8:35 -OR- 10:45. and contribute to the Daily Question for February 3.
- Read all of Chapter 2 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your class notebook. Remember to label the homework assignment as Homework #2 at the top of the page. Objects
- 2-1. Write a sentence that explains what a TimeSeries object is. How does it compare to a State object, if at all?
- 2-2. Write down the syntax for the flip command. (That it, determine the input(s) that flip expects, determine the output(s) that flip returns, and explain in a sentence or two how the output(s) are related to the input(s).)
- 2-3. Write down the syntax for the range command.
- 2-4. In a function definition, the first line ends with a(n) _______ and the _______ of the function has to be indented.
- 2-5. Write a short paragraph that explains in your own words what the step(p1,p2) function is doing and why.
- 2-6. In your personal version of the Chapter 2 notebook, define the function bike_to_olin, and make sure that it works like you expect it to by running it multiple times. (In your class notebook copy the final, working version of your code.)
In class:
- Homework Discussion
- Sections 2.4–2.8 of Modeling and Simulation in Python.
- For loops
- TimeSeries
- Plotting
- Link to in-class modified Chapter 2 notebook: 8:35am - OR - 10:45am
Wednesday, February 5
Before class:
- Read through the description of Project 1. Determine who you will want to work with on your project, and think about how you are interested in generalizing the simple bikeshare model. If you are unable to find a group, let me know in class. Your project proposal will be due on Monday by email.
- Read Sections 2.7–2.8 and 3.1–3.5 of Modeling and Simulation in Python.
- Go to our Discussion Board: 8:35 -OR- 10:45 and contribute to the Daily Question for February 5.
- Homework Questions: Complete the following homework questions in your notebook. It is highly suggested that you work with one or more classmates on this assignment!!! Syntax
- 3-1. Write down the syntax for a for loop.
- 3-2. Starting with a simple model and making gradual improvements is called _______.
- 3-3. When you call a function, the values you provide are called _______; inside the function, those values get assigned to the function's _______.
- 3-4. In Python, True and False are _______, not to be confused with 'True' and 'False', which are _______.
- 3-5. What does the author consider to be one of the most useful tools for debugging? Write a sentence explaining why it would be a helpful tool.
- 3-6. In a paragraph or two, compare and contrast arguments and parameters. In what ways are they similar? In what ways are they different?
- 3-7(a). Create a new Jupyter notebook that imports modsim (and also pint).
- 3-7(b). In this new notebook, write code that creates a State object that contains two state variables, named heads and tails, assigns the value 0 to both, and assigns the State object to a variable named penny.
- 3-7(c). Once you have evaulated that line of code, write an additional line of code that verifies that penny is defined correctly.
- 3-8. In the Jupyter notebook from Question 3-7, write a for loop that calls flip() 10 times with 50% chance of both heads and tails. Use your State object penny to keep track of the number of heads and tails that have been flipped.
- When you have completed Questions 3-7 and 3-8, upload your .ipynb file here. (If you are working in Azure Notebooks you will need to download your file first before uploading it here.) [If you work together in a group, each group member must submit their own file.]
In class:
- Homework Discussion
- Arguments vs. parameters
- Metrics
- Discussion of Project 1
- Link to in-class modified Chapter 2 notebook: 8:35am - OR - 10:45am
- Link to in-class coin flipping notebook: 8:35am - OR - 10:45am
Monday, February 10
Before class:
- Read Sections 3.4–3.6 and Section 4.5 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your class notebook. It is highly suggested that you work with one or more classmates on this assignment!
- 4-1. A _______ causes a function to end immediately without running any additional statements.
- 4-2. == is a(n) _______, and should not be confused with =, which is a(n) _______.
- 4-3. Write down the fundamental steps of incremental development.
- 4-4. What is the difference between the the two functions bike_to_wellesley() and bike_to_wellesley(state)? Write a paragraph that gives one or more reasons why the first would be better than the second and one or more reasons why the second would be better than the first.
- 4-5. Write down the definition of a metric. Write a sentence that explains what a metric is in your own words. Give an example of a metric that you interact with in daily life.
- Build upon our coin flipping Jupyter notebook from Questions 3-7 and 3-8.
- 4-6. Copy the code from Question 3-8 into a new cell. Modify the code by adding in print commands that do the following. Each time flip() is called, it should print out whether the flip was a heads or a tail. When all the flips are done, it should print out the number of heads and tails that were seen. Check that your code also works when you increase the number of flips from 10 to something larger. In your class notebook, copy down this information for a couple of trials.
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Homework Discussion
Constructing a Problem Statement - Introducing Parameters
- Negative bikes
- Functions that return values
- Link to in-class modified Chapter 3 notebook: 8:35am - OR - 10:45am
There is no class on Wednesday, February 12 or Monday, February 17.
- Work with your group to create a precise problem statement that you will investigate for Project 1. Each group should send Prof. Chris one email (per group) before noon on Wednesday, February 12 with (a) your group members, (b) the precise problem statement you will be investigating, and (c) some vague thoughts about what will need to be modified from the basic simulation to implement your changes. He will give feedback so you can revise if necessary.
Wednesday, February 19
Before class:
- Read Chapter 4 of Modeling and Simulation in Python.
- Go to our Discussion Board: 8:35 -OR- 10:45 and contribute to the daily question.
- Homework Questions: Complete the following homework questions in your class notebook. Objects
- 5-1. Write a sentence that explains what a SweepSeries object is. How does it compare to a TimeSeries object, if at all?
- 5-2.
(a) Write down the syntax for the linspace command.
(b) What array is generated by linspace(0,1,5)?
(c) What array is generated by linspace(2,10,4)?
(d) How would you use linspace to generate the array with numbers 0.0, 0.3, 0.6, 0.9, and 1.2? - 5-3. Complete the exercises at the end of the Chapter 3 Jupyter notebook having to do with keeping track of the time until the first customer arrives and doesn't find a bike.
- 5-4. Run the code from Question 5-3 multiple times, and at the bottom of the same Jupyter notebook create a text cell where you type out the values for "olin_empty", "wellesley_empty", and "t_first_empty" for five runs to get a feel for the type of data that appears. (To create a text cell (instead of a cell for python code), convert the cell to a Markdown cell using the menu.)
- When you have completed Questions 5-3 and 5-4, upload your .ipynb file here.
- 5-5. In a paragraph or two, Compare and contrast docstrings and comments. In what ways are they similar? In what ways are they different?
- 5-6. In a paragraph or two, explain what it means to sweep a variable. Why would this be a useful thing to do?
In class:
- Homework Discussion
- Sweeping variables
- Completion of the discussion of the bikeshare model.
- Prof. Chris will walk around and talk with you about your project.
- Link to in-class modified Chapter 3 notebook: 8:35am - OR - 10:45am
IMPORTANT: Start working on your simulation early. If you and your group are confused or have issues with the coding of the simulation, stop by during office hours Wednesday afternoon 2/19 (3:30-4:30+), Thursday morning 2/20 (10-11+), or schedule an appointment to talk with me.
Monday, February 24
Before class:
- Work in your group to modify the bikeshare simulation to address your problem statement.
- Go to our Discussion Board: 8:35 -OR- 10:45 and contribute to the daily question.
- Prepare to turn in your notebook for collection today.
In class:
- I will collect class notebooks.
- Determining explicit assumptions
- Assumptions vs. Expectations
- Results
- Prof. Chris will walk around and talk with you about your project.
Wednesday, February 26
Before class:
- Complete your project.
- Each group should bring in THREE paper copies of their writeup.
- Each group should also have access to their python notebook for feedback.
In class:
- Peer Review Day.
Monday, March 2
Before class:
- Use Monday's peer feedback to revise your project for submission.
- Please bring in a paper version of your writeup.
- Turn in your final project here:
- Upload your writeup here. Make sure its file name is of the form Names.docx or Names.pdf. (Replace "Names" by the first names of your group members, so it looks like p1-AliceChrisQiang.pdf) Only one submission per group is necessary.
- Upload your code file here. (You may have to download it from Azure Notebooks first.) Make sure its file name is Names.ipynb and that it runs WITH NO ERRORS when all the cells are evaluated in order from top to bottom. Only one submission per group is necessary.
- Upload your group dynamics paragraph here. Make sure its file name is p1-FirstName.txt or p1-FirstName.pdf or p1-FirstName.docx. Reminder: Everyone must submit a group dynamics paragraph, written independently.
- Read through Chapter 5, Section 6.1, and Section 10.2 of Modeling and Simulation in Python.
- Homework Questions: Objects
- 6-1. Write a sentence that explains what a System object is. How does it compare to a State object, if at all?
- 6-2. Write a sentence that explains what a DataFrame object is. How does it compare to a TimeSeries object, if at all?
- 6-3. What is the syntax of linrange? How does it compare to linspace, if at all?
- We are going to be thinking about population growth. Spend a few minutes brainstorming a few examples of populations that change over time—we'll discuss in class.
In class:
- Chapters 5 and 6 of Modeling and Simulation in Python.
- Link to in-class modified Chapter 5 notebook: 8:35am - OR - 10:45am
- Discussion of growth models.
Wednesday, March 4
Before class:
- You will be receiving an email with information about logging into Gradesly. Practice logging in. If you are having trouble, let me know.
- Read Chapters 6 and 7 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your notebook. Feel free to work with others to complete these exercises! Comprehension
- 7-1. Write down the definition of proportional. It is not defined in the book; you'll need to do some outside research if you don't know this definition.
- 7-2. Write a paragraph that explains what the author means when they talk about "factoring out the update function", the title of Section 6.3.
- 7-3. What is happening in Figure 7.2 on page 54?
- 7-4. (a) Find any webpage that has a table of data that changes over time (b) use the tools we discussed from Chapter 5 to import this data into python with the time column as the index column. (c) Change the column headings to have short, simple names. (d) Choose one column to single out as a Series object, and plot the dataset.
- Upload your Python notebook for Problem 7-4 here. At the top of your notebook in a text cell write a small paragraph about where the data comes from. If you ran into trouble, use this space to describe your troubles.
In class:
- Constant growth model
- Proportional growth model
- Quadratic growth model
- Link to notebook that runs all three population growth models: 8:35am - OR - 10:45am
Monday, March 9
Before class:
- Read through the description of Project 2. Start to think about which of the options you are most interested in simulating.
- In the "notebooks" folder where all your python notebooks are is a file named "rabbits.ipynb". Read through the notebook through the cell containing the code
We will be discussing this in class.system = make_system() run_simulation(system) final_population(system)
- Re-read Section 4.4 of our book to refresh ourselves about sweeping variables.
- Homework Questions: Complete the following homework questions in your notebook. Feel free to work with others to complete these exercises! Coding
- 8-1. (parts a, b, c, and d) Read Section 7.3 of Modeling and Simulation in Python entitled "Dysfunctions". The examples from the text are coded in the Chapter 7 python notebook. Work through these examples in your python notebook and try to understand the issues surrounding each of the examples. In your class notebook, write a paragraph in your own words that explains what is happening in each example.
- Link to notebook that runs all three population growth models: 8:35am - OR - 10:45am
- Go to our Discussion Board: 8:35 -OR- 10:45 and contribute to the daily question.
In class:
- Discussion of Daily Question
- Programming the population model in python
- The Rabbit Model
- Sweeping variables.
- Link to in-class modified rabbit notebook: 8:35am - OR - 10:45am
Wednesday, March 11
Before class:
- Read Chapter 8 of Modeling and Simulation in Python.
- Go to our Discussion Board: 8:35 -OR- 10:45 and contribute to the daily question. Coding
- 9-1. The plots we have been creating in class are using pyplot's plot function.
- Skim through the documentation about pyplot using the following links and keep track of the most interesting ways that you can style your plot.
- Modify to your liking the style of any plot we have created in class.
- Practice exporting your plot to a file using the savefig command.
- Upload your exported figure here.
In class:
- Completing our discussion about the population model.
- Explanatory vs. Predictive models
- Prediction
- Get into your group for Project 2 and determine a plan to meet virtually or in-person over the next week.
The two sections have diverged slightly. Please follow your course: