We’re going to compute a quadratic function from 3 representative points in the mpg-table
we’ve been working with.
1 Identify three whole-number coordinate pairs we can use to summarize a curve that would model the point cloud:
2 Fill in the x and y-values in the standard form models below using the three points you found: y (mpg) = a(x (speed))2 + b(x (speed)) + c y (mpg) = a(x (speed))2 + b(x (speed)) + c y (mpg) = a(x (speed))2 + b(x (speed)) + c |
3 In the space below - or on another sheet of paper - solve this series of equations for a, b, and c.
4 Write your finished model in function and Pyret notation below, then define the function f
in Pyret and try it out using fit-model
!
Function Notation |
Pyret Notation |
quad2(x) = a x2 + b x + c |
fun quad2(x): (( * sqr(x)) + ( * x)) + end |
5 Open the Fuel Efficiency Starter File. If you haven’t already, select Save a Copy from the "File" menu to make a copy of the file that’s just for you. Add your function definition for quad2
on line 30 and test it out using fit-model
.
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927).
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.