This page contains interactive Sage widgets - edit and re-evaluate them!

A common situation in science and engineering: you've collected a bunch of data and you'd like to fit a function to it. Sage trivializes this procedure.

First, we'll generate some data that has some built-in variance using list comprehension and the 'normalvariate()' function and store it in the array 'data'; then we'll propose a model with some adjustable parameters, and find the value of those parameters that gives the best fit. Finally, we'll plug those parameter values back into the model and graph it alongside the data.