
![]() |
This lecture completes the introduction of classes by showing a way to implement user-defined iterators. It then discusses simulation models, and illustrates some of the ideas underlying simulations modeling by simulating a random walk. Image courtesy of donovanbeeson on Flickr. |
Lecture 12: Introduction to Simulation and Random Walks
About this Video
Topics covered: Subclasses, inheritance, generator, analytic methods, simulation methods, simulations, models, random walk.
Resources
What is a generator?
› View/hide answer
A function that remembers the point in the function body where it last returned a value and the values of all local variables.
What is the difference between yield and return?
› View/hide answer
When yield is used, the state of the function is not lost.
What is a model?
› View/hide answer
A model is a theoretical construct that will provide useful information about the possible behaviors of the system being modeled.
In problem set 5, you will build a program to monitor news feeds over the Internet. Your program will filter the news, alerting the user when it notices a news story that matches that user's interests (for example, the user may be interested in a notification whenever a story related to the Red Sox is posted).
Problem set 6 is assigned in this session. The instructions and solutions can be found on the session page where it is due, Lecture 14 Sampling and Monte Carlo Simulation.