This page is for a past course. Find your current course here.
Check back often for homework assignments, tutorials, and key topics covered each day.
This schedule is approximate and subject to change!
Monday, August 27
In class:
- Welcome!
- Introduction & Syllabus Discussion '
- What is Mathematical Modeling?
- Steps of the Modeling Process
- Meet the model(er)s
- Getting started with a Jupyter Notebook.
- Sections 1.1 and 1.2 of Modeling and Simulation in Python.
- Visiting the course webpage and First Day Survey.
Wednesday, August 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 ~100 page notebook to serve as your "Homework Notebook".
- Thoroughly read all of the course webpage.
- Log on to the Queens College Google Apps for Education and complete the following:
- 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.
- Next, complete this First Day Survey.
- Finally, take this 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. I will try to choose times that work for most people.
- Read Chapter 0, Chapter 1, and Sections 2.1–2.5 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.
- Watch the short Mythbusters video about the penny myth.
- Homework Questions: Complete the following homework questions and be prepared to discuss them in class. Work in your homework notebook if you have it.
- 1-1. 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-2. What is a State object?
- 1-3. What is the name of the package that allows us to work with units in python? What is the line of code that imports this package into our notebooks?
- 1-4. Complete the last exercise in the Falling Pennies section of the Chapter 1 Jupyter Notebook. It starts "In reality, air resistance..."
- 1-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.
Comprehension/Vocabulary (Requires some research in the text)
In class:
- Introduction to Bike Share Model.
- Sections 2.1 through 2.4 of Modeling and Simulation in Python.
- Link to in-class modified notebook: Chapter 1
- Link to in-class modified notebook: Chapter 2
No class on Monday, September 3
Wednesday, September 5
Before class:
- Read Chapter 2 of Modeling and Simulation in Python.
- Meet for one hour outside of class with at least one other classmate. Your goal is to get together to talk about the class so far and compare answers to the homework questions below. You should also make sure you are able to use Python and Jupyter notebooks outside of class.
- Prepare a piece of paper to bring to class on 9/5 and turn in. At the top of the page, write your name and write down the name(s) of the classmate(s) you met with and when you met. Below that, write one paragraph reflecting about something that you learned or experienced that you would not have if you had worked alone. Bring your paragraph to class; I will collect them, check them off, and they will count toward your class participation grade.
- Homework Questions: Complete the following homework questions in your homework notebook.
- 2-1. In a function definition, the first line ends with a _______ and the _______ of the function has to be indented.
- 2-2. When you call a function, the values you provide are called _______; inside the function, those values get assigned to the function's _______.
- 2-3. In Python, True and False are _______, not to be confused with 'True' and 'False', which are _______.
- 2-4. What is a TimeSeries object? How does it compare to a State object, if at all?
- 2-5(a). Create a new Jupyter notebook that imports modsim (and also pint).
- 2-5(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. (There was a typo in a previous version of this code; I have replaced System by State.)
- 2-5(c). Once you have evaulated that line of code, write an additional line of code that verifies that penny is defined correctly.
- 2-6. 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-7. Write down the syntax for the range command.
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Homework Discussion
- Sections 2.4–2.8 of Modeling and Simulation in Python.
- flip(): Adding in Randomness
- Arguments vs. parameters
- For loops
- Link to in-class modified notebook: Chapter 2
No class on Monday, September 10
Wednesday, September 12
Before class:
- Read Chapter 3 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your homework notebook. It is highly suggested that you work with one or more classmates on this assignment!!!
- 3-1. Starting with a simple model and making gradual improvements is called _______.
- 3-2. A value that gets passed into a function is called a(n) _______; a value that gets returned from a function is called a(n) _______.
- 3-3. In the Jupyter notebook from Question 2-5 above, 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.
- 3-4. Copy the code from the previous question into a new cell. Modify the code by adding in print statements 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.
- 3-5. In a paragraph or two, compare and contrast arguments and parameters. In what ways are they similar? In what ways are they different?
- 3-6. In a paragraph or two, Compare and contrast docstrings and comments. In what ways are they similar? In what ways are they different?
- 3-7. Check out the documentation from pyplot's plot function. Look to see how you can modify the style of plots in an interesting way. Try it out and write down the most interesting modification you were able to make!
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Homework Discussion
- TimeSeries
- Plotting
- Introducing Parameters
- Sections 2.8 and 3.1–3.6 of Modeling and Simulation in Python.
- Link to in-class modified notebook: Coin Flip Notebook
- Link to in-class modified notebook: Chapter 3
- Link to video about sweeping parameters
Monday, September 17
Before class:
- Reread Section 3.6 and Read Chapter 4 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your homework 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 _______, and should not be confused with =, which is a(n) _______.
- 4-3. What is a SweepSeries object? How does it compare to a TimeSeries object, if at all?
- 4-4. Write down the fundamental steps of incremental development.
- 4-5. Build upon our coin flipping Jupyter notebook from earlier homework assignments. Create a new function called flip_count that takes n and p as parameters, where n is the number of times to flip and p is the probability of coin flip falling heads. It should output the number of heads and tails that are seen. Run the function a couple of times with different parameters to make sure it works how you would expect.
- 4-6.
(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?
(e) How would you use linspace to generate the array with numbers 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, and 0.7? - 4-7. In a paragraph or two, explain what it means to sweep a variable. Why would this be a useful thing to do?
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Negative bikes
- Metrics
- Functions that return values
- Sweeping variables
- Sections 3.6 and Chapter 4 of Modeling and Simulation in Python.
- Link to in-class modified notebook: Chapter 3
- Link to in-class modified notebook: Chapter 4
No class on Wednesday, September 19
Monday, September 24
Before class:
- Read Chapter 4 of Modeling and Simulation in Python.
- Log on to Queens College Google Apps for Education, then sign up for and post on our Google Groups Discussion Board, as follows. This will count toward your participation grade.
- 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.
- Visit the Google Groups Page and click on "Join Group"
- Go to the "Introductions" thread, introduce yourself, and share something interesting (photo, link, site, article, meme, etc.) that you have been thinking about recently or that you came across on the internet.
- Go to the "Bikeshare Simulation Questions" thread and post one or more questions about what we have seen in class so far about programming the bikeshare simulation.
- Homework Questions: Complete the following homework questions in your homework notebook. It is highly suggested that you work with one or more classmates on this assignment! Coding
- 5-1. 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. Write down a few of the answers you receive for "olin_empty", "wellesley_empty", and "t_first_empty".
- 5-2. Write a function called flip_until_tails that takes as parameters a System object like penny and a probability p. The function should call flip up to 1000 times with probability p and return the number of heads before the first tails.
Hint: Use a return statement when the first tails occurs to return immediately without completing the loop. - Prepare your homework notebook to be turned in today.
In class:
- I will collect homework notebooks.
- Discussion inspired by comments on the Discussion Board
- Completion of the discussion of the bikeshare model.
- Link to in-class modified notebook: Coin Flip Notebook
- Link to in-class modified notebook: Chapter 4
Wednesday, September 26
Before class:
- If you have any further questions about the bikeshare model, ask them on our Discussion Board.
- Read Chapters 5 and 6 and Section 10.2 of Modeling and Simulation in Python.
- Read through the description of the first project. Determine who you will want to work with on your project and start to think about which of the options you are most interested in. If you are having trouble figuring out who you want to work with, come see me before class.
- Homework Questions: Complete the following homework questions.
- 6-1. What is a DataFrame object? How does it compare to a TimeSeries object, if at all?
- 6-2. What is the syntax of linrange? How does it compare to linspace, if at all?
- 6-3. Build upon our coin flipping Jupyter notebook from earlier homework assignments: Run a parameter sweep of the probability p with at least 8 different values of p to calculate the number of heads that appear after 1000 flips for a coin with probability p of landing heads. Plot the graph of this metric as a function of p.
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Chapters 5 and 6 of Modeling and Simulation in Python.
- Link to in-class modified notebook: Coin Flip Notebook
- Link to in-class modified notebook: Chapter 5
- Discussion of growth models.
If you are having issues with the coding of the simulations or sweeping variables, stop by during office hours or make an appointment!
Monday, October 1
Before class:
- Read Chapters 6 and 7 of Modeling and Simulation in Python.
- By today you must determine who you want to work with on your project and which of the topic options you want to work on.
- Homework Questions: Complete the following homework questions in your homework notebook.
- 7-1. What is a System object? How does it compare to a State object, if at all?
- 7-2. Find any webpage that has a table of data that changes over time and use the tools from Chapter 5 to import this data into python with the time column as the index column. Also change the column headings to have short, simple names. Choose one column to single out as a Series object, and plot the dataset.
- 7-3. Check out various format strings in pyplot and change the format of some of the plots from the Chapter 5 notebook and of your plot from Question 7-2. Keep track of the most interesting modification you were able to make!
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Chapters 6 and 7 of Modeling and Simulation in Python.
- Project 1 brainstorming worksheet
- Link to in-class modified notebook: Chapter 6
- Link to in-class modified notebook: Chapter 7
Wednesday, October 3
Before class:
- Spend time working on your project with your groupmates by answering the questions in the Brainstorming worksheet.
In class:
- Link to in-class modified notebook: Chapter 7
- Model Assumptions
- Expectations versus Assumptions
- Explanatory Model vs. Prediction Model
- Discussion of the Project Deliverables
- Prof. Chris will walk around and talk with you about your project.
Wednesday, October 10
Before class:
- Read this article about limitations of mathematical models.
- Homework Questions: Complete the following homework questions in your homework notebook. Comprehension
- 8-1. In your own words, write a paragraph explaining the difference between a model expectation and a model assumption.
- 8-2. In class we discussed multiple growth assumptions for a population (constant growth, linear growth, quadratic growth). Determine various scenarios where each of those assumptions would be a valid assumption to make when modeling the change of a population.
- 8-3. In the article above there is an in-depth discussion about the limitations of a model. Create a bullet-point list of the types of limitations that exist. Write two or more paragraphs about the main limitations you see for the bikeshare model we created. Coding
- 8-4. In the code folder where all the python notebooks are is a file named "rabbits.ipynb" which may be useful when you create your population model. Work through this notebook and make sure you understand the parameter sweep that is done.
- 8-5. Read the Section of Chapter 7 of Modeling and Simulation in Python titled "Dysfunctions". The examples from the text are coded in the Chapter 7 python notebook. Make sure you work to understand the issues surrounding each of the examples. Please share on the Discussion Board if you have any questions or comments or sources of confusion.
- Required: Post a question about the population model on our Discussion Board. If you also share a similar concern to a classmate, let them know, and if you are able to answer any questions, please share your knowledge.
- For your project: Figure out how to import into a python notebook the dataset of population over time that you want to use for your project. Make sure you are able to display the dataset once it is imported. If you run into trouble, come see me in office hours.
- Link to learn how to import Excel Data into Python
- Link to learn how to import PDF Data into Python
In class:
- Homework Discussion
- Addressing points from our Discussion Board
- Predictions
- Link to in-class plot options notebook: Chapter 7
- Link to in-class notebook: Chapter 8
- After that we will have an in-class project work day. We will make sure everyone has their data in Python and has a plan for their underlying growth model and update function.
- Work on First Cut Model worksheet
Monday, October 15
Before class:
- Read Chapter 8 of Modeling and Simulation in Python.
- Complete the Chapter 8 notebook/tutorial Feel free to work with others to complete the tutorial.
- Complete the First Cut Model worksheet from class and have it ready to share with Prof. Chris.
- Bring in your strategy for modeling the growth of your population(s). You should be getting the code working to run simulations for your population, and you should be starting to code how to sweep a variable.
In class:
- Prof. Chris will walk around and talk with you about your project and your First Cut Model Worksheet.
Wednesday, October 17
Before class:
- Continue your project work. Your python project results (population simulation and variable sweep) should be complete by today, leaving time for your group to work on the analysis and quad chart by Monday.
In class:
- In-class work day. Prof. Chris will walk around and talk with you about your project.
Monday, October 22
Before class:
- Read Sections 11.1–11.3 of Modeling and Simulation in Python.
- Continue work on your project.
In class:
- Discussion of Sections 11.1–11.3 of Modeling and Simulation in Python.
- Differential Equations
- The SIR model
Wednesday, October 24
Before class:
- Read Sections 11.4–11.6 of Modeling and Simulation in Python.
- Continue work on your project.
In class:
- Discussion of Sections 11.4–11.6 of Modeling and Simulation in Python.
- Programming the SIR model
Monday, October 29
Before class:
- Bring the final version of your Quad Chart to class. We will be doing a peer review.
In class:
- Peer Review of Project 1
- Determination of the Presentation Order.
Wednesday, October 31
Before class:
- Revise your project and prepare to present your work in class.
- Turn in your final project here:
- Upload your project slides here. Make sure its file name is of the form p1-Names.pdf or p1-Names.pptx. (Replace "Names" by the first names of your group members, so it looks like p1-AliceChrisQiang.pdf)
- Upload your code file here. Make sure its file name is p1-Names.ipynb and that it runs WITH NO ERRORS when all the cells are evaluated in order from top to bottom.
- Upload your group dynamics paragraph here. Make sure its file name is p1-FirstName.txt or p1-FirstName.pdf or p1-FirstName.docx. Reminder: There should be one of these from each person, written independently.
In class:
- Project Presentations
Monday, November 5
Before class:
- Read Chapter 11 and Sections 12.1–12.2 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your homework notebook.
- 9-1. An SIR model is an example of a _______ model.
- 9-2. What is a TimeFrame object? How does it compare to a TimeSeries object, if at all?
- 9-3. In our model, we will model vaccination as moving people directly from the Susceptible state to the Recovered state. Why is this a reasonable thing to do?
- 9-4. Why might we like to know the largest value of (one or more of) S, I, or R? (This is discussed in Section 12.1.)
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Discussion of Sections 11.7–12.2 of Modeling and Simulation in Python.
- Implementation of SIR model in Python
- Link to in-class plot options notebook: Chapter 11
- Link to in-class notebook: Chapter 12
Wednesday, November 7
Before class:
- Read Chapter 12 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your homework notebook.
- 10-1. If S is a TimeSeries object, What is the difference between S.max and S.idxmax?
- 10-2. Getting vaccinated is not just good for you; it is also good for the people you might otherwise infect. What is this phenomenon called?
- 10-3. What does the book say that "hand washing" does to the model? And why should that be the case?
- 10-4.
- If you change the time between contacts, how should that impact how many people will be infected? Similarly, if you change the recovery time, how should that impact how many people will be infected?
- Go in to the Chapter 11 Python Notebook and modify the tc and tr numbers, run the simulation, and determine how many people are infected as those numbers change. See if the final result matches what you thought would happen.
- 10-5. Implement the metrics in the "Metrics" Section of the Chapter 12 python notebook.
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Discussion of the remainder of Chapter 12 of Modeling and Simulation in Python.
- Link to in-class notebook: Chapter 12
- Introduction to errors in the modeling process
Monday, November 12
In class:
- Professor Chris is out of town this week. Professor Kapelner give a guest lecture on errors in the modeling process and introduce the two classes he is teaching next semester. (Math 341 and 390)
- He will take attendance and it will count toward your participation grade for the second half of the semester.
- You will also be expected to integrate discussion about modeling errors into your second project.
There is no class on Wednesday, November 14.
Instead, take the time to:
- Read over the information about Project 2.
- Skim Chapter 15 of Modeling and Simulation in Python.
- Remember to email Professor Hanusa your partner preferences worksheet. (Take a photo or scan it.)
There was no class on Monday, November 19 since Prof. Chris was sick.
Instead, take the time to:
- Meet with your partner from Project 2.
Wednesday, November 21
Before class:
- Skim Chapter 16 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your homework notebook.
- 11-1. What is the unpack function, how do you use it, and why would you use it? (See Section 13.1)
- 11-2. When + is used with strings, what happens and what is it called? (See Section 13.2)
- 11-3. What does fsolve do?
- 11-4. What does an assert statement do?
- I will be collecting homework notebooks on Monday November 26.
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Discussion of Chapters 15 and 16 of Modeling and Simulation in Python.
- Meet with your partner and plan for a time to meet outside class before Monday 11/26.
- Brainstorming worksheet
Monday, November 26
Before class:
- Read Chapter 16 of Modeling and Simulation in Python.
- Homework Questions: Complete the following homework questions in your homework notebook.
- 12-1. At the end of Section 16.2, there is a discussion about an assumption related to the mix command. Why does it say that we might want to revisit this assumption?
- Work to come up with a project topic / proposal with your groupmate. Determine the precise question you want to answer for your project. One member of each group should email this question to Prof. Chris before 2pm on Monday 11/26. It may be helpful to use the brainstorming worksheet as a guide.
Comprehension/Vocabulary (Fill in the blanks)
In class:
- Turn in your homework notebook for grading.
- Discussion of Chapters 15 and 16 of Modeling and Simulation in Python.
- Prof. Chris will come around to give feedback about your proposed project question.
- In-class work to determine how your group will implement a simulation.
Wednesday, November 28
Before class:
- Start working on your project's simulation.
In class:
- In-class work on your simulation.
Monday, December 3
Before class:
- Complete your work on your project's simulation.
- Do a parameter sweep for a parameter of your choosing.
In class:
- In-class work on your project.
Wednesday, December 5
Before class:
- Interpret your results as real-world solutions.
In class:
- In-class work on your project.
- Focus on model assumptions, methodology, and errors.
Monday, December 10
Before class:
- Continue work on your project and writeup.
- If you would like Prof. Chris to give you feedback on your writeup so far, send the draft by the night of Saturday 12/8.
In class:
- In-class work on your project.
- How to write an abstract
- Prof. Chris will give in-class feedback on drafts sent no later than Saturday 12/8.
Wednesday, December 12
Before class:
- Complete and analyze your project.
- Prepare a draft presentation.
- Each group should bring in THREE paper copies of their writeup.
In class:
- Peer Review Day.
Monday, December 17
Before class:
- Revise your project and prepare to present your work in class.
- Turn in your final project here:
- Upload your presentation slides here. Make sure its file name is of the form p2-Names.pdf or p2-Names.pptx. (Replace "Names" by the first names of your group members, so it looks like p1-AliceChrisQiang.pdf)
- Upload your writeup here. Make sure its file name is p2-Names.docx or p2-Names.pdf.
- Upload your python notebook here. Make sure its file name is p2-Names.ipynb and that it runs WITH NO ERRORS when all the cells are evaluated in order from top to bottom.
- Upload your group dynamics paragraph here. Make sure its file name is p2-FirstName.txt or p2-FirstName.pdf or p2-FirstName.docx. Reminder: There should be one of these from each person, written independently.
In class:
- Project Presentations.
- Your writeup and python code is due before class on December 17.
- Your group dynamics paragraph is due by the evening of December 17.