Essential Computational Skills

Adapted from John Plough's materials for HS Physics

The following is an introduction to using GlowScript. Once logged in, the Help button in the upper right hand corner of the screen contains a useful introduction along with tutorials and extensive object descriptions for assistance well beyond material presented here.

While working these activities in pairs, make sure to comment each line of code you write to remind yourself and your partner what it does and why you wrote it. You can comment code by using the pound (#) symbol,

# This is a commented line in Glowscript

It is important that you and your partner agree and understand each line of code you are writing. The comments are meant to externalize that understanding you both share.

Drawing Physics

One of the central features of Glowscript is making objects that represent different things in the world. Making objects with Glowscript is much simpler than other languages and is one of Glowscript's strengths. In this activity, you are tasked with using Glowscript's shape objects to write the word PHYSICS, Physics, or physics.

Shape objects are often the first part of the program that gets written because you are “setting the scene.” The point of this activity is to understand better the different attributes of Glowscript's shape objects, how they work, and how you can refer to the different attributes.

Modeling a sliding crate

Making objects move across the screen involves a loop. This is typically a while loop that runs a block of code repeatedly until some condition is met (called “the loop control condition”). In this activity, you and your partner should create a crate and a surface, which represents a frictionless floor. The crate should rest on the floor.

In your program, give the crate an initial velocity and model its motion for a few seconds. You can choose the parameters to model this motion. Make sure to comment each line of code you write.

Adding a MotionMap

Once you and your partner have a model of a sliding crate, look at the instructions for how to include a MotionMap for your crate. Make sure to comment each line of additional code you write.

You will need to add this line to the top of your program to include the module that makes MotionMap active,

get_library('https://rawgit.com/perlatmsu/physutil/master/js/physutil.js')

Graphing the Kinetic Energy

Once you and your partner have a working MotionMap, calculate the kinetic energy of the crate in every time step. Look at how to make a graph using Glowscript and graph the kinetic energy of the crate as a function of time. Make sure to comment each line of additional code you write.

What do you expect the kinetic energy graph to look like?

Can you change this to a graph of speed vs time? What about the position vs time?

Modeling a crate that comes to a stop

Now that you have a working program that models the motion of a crate over a frictionless surface, let's see what happens when the crate then hits a rough patch. Add a piece of flooring to the end of the frictionless floor that is rough (make it a different color). When the crate hits that patch, it should now experience a frictional force. Model the motion of the crate as it moves across the frictionless floor and into the rough patch. You are free to choose relevant parameters. Make sure to comment each line of additional code you write.

How does the MotionMap change?

How do the graphs of kinetic energy, speed, and position vs time change?

  • summer_2018/essential_skills.txt
  • Last modified: 2019/07/08 18:31
  • by wellerd