ABSTRACT

This chapter discusses how to fit functions to data, and to test how well that fit agrees with the data. The model will be described by some mathematical function which has some freedom in its detailed description. Mathematica provides the ability to include the uncertainties in the fit procedure, and to plot the data with "error bars" that display the uncertainties on each point. All fitting algorithms work to adjust the fit parameters to minimize the difference between the fit function and the data values. Mathematica has different functions for these two cases, as well as a more extensive package for dealing with data that has uncertainties. Since the fitting algorithm aims to minimize the sum of the squares of the differences between the data and the fit, it makes sense to compare this number for the two fits. One data point will carry more or less weight than another because of random statistical fluctuations, systematic uncertainties, or both.