next up previous index
Next: Fitting in Maxima Up: The Playsome Threesome: Maxima, Previous: Differentiating a Function

   
$\chi ^2$ Fitting

We now know enough symbol manipulation systems vocabulary to attempt some real computation. There are still a few small bits and pieces that we have to learn, but we'll learn about them on the go.

Assume that you have a set of N data points yi and xi, $i = 1\ldots N$. Furthermore assume that the dependence between y and x is to be modelled by a linear relationship:

y(x) = a + b x

If points yi have been measured with accuracy $\sigma _i$, then the $\chi ^2$ merit function, whose minimum with respect to a and byields the best fit is

\begin{displaymath}\chi^2(a, b) = \sum_{i=1}^N \left(\frac{y_i - a - b x_i}{\sigma_i}\right)^2
\end{displaymath}

In the following, we will evaluate expressions for a and b that minimise $\chi ^2$, and the corresponding uncertainties, $\sigma_a$and $\sigma_b$. We begin by doing it in Maxima. It is also in the Maxima section that we discuss the relevant mathematics and problems that, as you will see, affect Maple and Mathematica as well (there are some subtle bugs in all three). Since the general methodology, as well as the general mechanics are going to be very similar in all three systems, you should study all three sections that follow, in order to gain a better understanding of how these things work in practice, and what possible pitfalls you may encounter.

It is also in the following Maxima section that we write down in an orderly fashion all $\chi ^2$ related results and formulas. We will use these in the next chapter, which will discuss the expanding Universe.



 
next up previous index
Next: Fitting in Maxima Up: The Playsome Threesome: Maxima, Previous: Differentiating a Function
Zdzislaw Meglicki
2001-02-26