< Course F (2024)

Lesson 12: Simulating Experiments

45 minutes

Overview

In this context-setting lesson, students will run and collect data from a simple simulation in Sprite Lab. After running the simulation multiple times, students will have an opportunity to predict how changing a variable in the simulation might impact the outcome and test that hypothesis.

Purpose

Sciences in many disciplines use Computer Science to run models and simulations to run experiments, collect data, and analyze that data for insights. Though the simulation introduced in this lesson is quite simplistic, it can be used as a jumping off point for students to consider how more sophisticated computational models could be used to test hypotheses.

CSTA K-12 Computer Science Standards (2017)
    • 1B-DA-06 - Organize and present collected data visually to highlight relationships and support a claim.
    • 1B-DA-07 - Use data to highlight or propose cause-and-effect relationships, predict outcomes, or communicate an idea.

Agenda

Objectives

Students will be able to:
  • Create double line graph to compare data about two different sources
  • Make and test a prediction by modifying simulation variables
  • Use a computer simulation to collect data about a model

Preparation

  • Determine whether students will run simulations on their own computer, or if you will be running them as a whole class
  • If necessary, prepare to project the two simulations in this lesson.

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the teachers
For the students

Vocabulary

  • Models and Simulations - a program which replicates or mimics key features of a real world event in order to investigate its behavior without the cost, time, or danger of running an experiment in real life.

Teaching Guide

Warm Up (5 minutes)

Introduction

Display: Show “Reflect” slide

Reflect: If you were a scientist, when might you want to simulate an experiment on a computer instead of in real life?

Encourage students to consider experiments that might be dangerous or difficult to reproduce in real life.

Say: Today we're going to run a simulation to gather data about an experiment, just like scientists do.

Vocabulary

Display: Show “Vocabulary” slide

  • Models and Simulations - a program which replicates or mimics key features of a real world event in order to investigate its behavior without the cost, time, or danger of running an experiment in real life.

Activity (35 minutes)

Simulation Experiments

Distribute: Pass out the lesson *worksheet along with pencils and coloring instruments of some kind. Direct students to Code Studio or project the level on the board.

Running Simulations

Display: Show “Step 1 - Collecting Data” slide

Step 1 Gather Data: The first bubble is a simple simulation of an elephant and a hippo collecting apples. Students will run the simulation at least 5 times, recording the number of apples collected by each animal and the total time it took to run the simulation.

Display: Show “Step 2 - Line Graph” slide

Step 2 Line Graph: Using the data collected in the previous step, students will plot a double line graph. Encourage students to share their graphs with neighbors and discuss the following questions:

  • Are the graphs the same or different? Why do you think that is?
  • What do you think you'd see if you ran this simulation 5 more times?

Display: Show “Step 3 - Modify and Predict” slide

Step 3 Modify and Predict: In the second bubble students will be able to modify some of the variables that control this simulation. Each student will choose a variable to modify, predict how that change will impact the simulation. Potential variables to modify include:

  • Number of elephants
  • Number of hippos
  • Number of apples
  • Speed of elephants
  • Speed of hippos

Note that students can change the sprites in their simulation to other animals and food if they wish.

Display: Show “Step 4 - Collecting More Data” slide

Step 4 Collecting More Data: With the modifications students decided on in the last step, they'll run the simulation five more times and collect the data.

Display: Show “Step 5 - Visualize Your Data” slide

Step 5 Visualize Your Data: This step is purposefully left open to allow students to explore any visual representation of their data that they'd like. The goal of this visual should be to prove or disprove their prediction.

Share: After finishing, students can share their results with a neighbor. When the whole class is ready, bring everyone together.

Wrap Up (5 minutes)

Reflection

Display: Show “Discuss” slide

Discuss:

  • How did your modification and prediction turn out?
  • What modifications did you make and why did you choose those?
  • How did this change connect to your predictions?

Discussion Goal: The simulation used in this lesson is purposefully broad and kind of silly. Through this discussion, students should start to connect the predictions and variable changes with actual scientific hypotheses. From there you can encourage students to think about computational modeling or more authentic scenarios or experiments.

Display: Show “Reflect” slide

Reflect:

  • What is one interesting thing that you might simulate using a computer?
  • What kinds of variables would you want to control in that experiment?

Extended Learning

Customize the simulation

Display: Show “Extension - Customize” slide

Throughout the main activity of this lesson, students are running and modifying a simulation that they did not program from scratch themselves. Students can actually program the simulation with blocks of code that they have seen in previous lessons.

In the last level of the lesson, students can explore this code and begin thinking about how to program a simulation themselves.

Creative Commons License (CC BY-NC-SA 4.0).

This work is available under a Creative Commons License (CC BY-NC-SA 4.0).

If you are interested in licensing Code.org materials for commercial purposes contact us.