Fitting the Model Visually 𝑓(𝑥) = 𝑎𝑏𝑥 + 𝑘

For this section, you’ll need to have Modeling Covid Spread (Desmos) open on your computer.

1 Try changing the value of 𝑘, then 𝑎, then 𝑏 to find three promising exponential models, graphing each one and labeling your values on the grids below.

𝑎=
𝑏=
𝑘=

𝑎=
𝑏=
𝑘=

𝑎=
𝑏=
𝑘=

Fitting the Model Programmatically 𝑓(𝑥) = 𝑎𝑏𝑥 + 𝑘

For this section, open your copy of the Covid Spread Starter File.

2 In the space below, define exponential1 for one of the models you fit in Desmos.

fun exponential1(x): ( a * num-expt( b , (~1 * x))) + k end

Two Notes on this function definition:

  • num-expt is the function that we use for exponents. It takes in 2 numbers: the base and the power, in this case 𝑏 and 𝑥.

  • At first it may appear that 𝑥 is being multiplied by negative 1 (-1), when it is actually being multiplied by ~1 (literally the value "roughly 1"). This tells Pyret to round off the calculation, prioritizing speed over precision to get a result that is "roughly accurate". We’ve added this to the function definition so that you won’t have to wait for several minutes for Pyret to run fit-model to get an answer for question 4.

3 Type your definition into the Definitions Area.

4 Use fit-model to determine how closely exponential1 fits the MA-table. 𝑅2 =

5 Are exponential models a good fit for this data? Why or why not?

Rewrite the model so it doesn’t multiply by ~1 to make Pyret do these calculations with extreme precision. WARNING: be sure to save your work first, as there’s a good chance this will lock up your browser and require force-quitting! Data scientists perform calculations to do things like send satellites to far-away planets, or analyze large populations of a billion or more. You know the pros of using ~1 involve speed. What are the potential downsides of using ~1 to speed up a calculation?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.