SAGE : Data Fitting

Sage makes fitting data to a specified model fairly easily.

1. Find the line of best fit to the data: $((1,1),(2,4),(3,4),(4,5),(6,8))$.


Create a function substituting in the parameters, and plot the data and model.



2. Generate some data from a sine function with some random puterbations, using similar code as above. The second line creates data using the model $y=1.2 \sin(0.5x-0.2)$ and then adds a small random value from a standard normal distribution. We shuold expect to find a curve in the form $y=a\sin(bx+c)$ with coefficients close to $(a=1.2, b=0.5, c=-0.2)$