Materials College
For educators and students interested in Materials Science and Engineering

Computer Science Lesson Plans

 

Simulation Using Repeat and Randomize

Author: Pedro Villavicencio

Summary:

This lesson, planned for second quarter immediately after the chapter for programming iterations, allow students to use their knowledge of Java control statements and the Math class to familiarize themselves with a Monte Carlo based simulation algorithm.

A Monte Carlo Simulation is a way of approximating the value of a function where calculating the actual value is difficult or impossible. It uses random sampling to define constraints on the value and then makes a sort of "best guess."

Students will write a simulation program that uses a simple loop and Java random's function to approximate the value of PI graphically instead of geometrically.


 

Complete Lesson Plan

 

 

 

 

 

Pedro1