David Little  
Mathematics Department Penn State University Eberly College of Science University Park, PA 16802 
Office: 403 McAllister Phone: (814) 8653329 Fax: (814) 8653735 email:dlittle@psu.edu 



Least Squares
The following applet can be used to find the least squares line corresponding to a collection of data. Simply enter the data and the slope, m, and yintercept, b, of the proposed line that minimizes the sum of the square of the vertical distances between the data and the line. The applet automatically draws this line and calculates the distance between the line and the data. The user may also have the applet display the actual least squares line. The values of m and b can be changed by simply typing a new value, such as "1.2345", "pi/2", "sqrt(5)+cos(3)", etc. You may also change these values by using the up/down arrow keys or dragging the corresponding point on the graph. To move the center of the graph, simply drag any point to a new location. To label the xaxis in radians (i.e. multiples of pi), click on the graph and press "controlr". To switch back, simply press "controlr" again. To manually enter data, first select n, the number of data points. The ycoordinate of each point can be changed by dragging the corresponding point up or down. To change the xcoordinate, hold down the shift key while dragging the corresponding point left or right. Alternatively, the user may click on the data point and then type the coordinates in the appropriate text fields.
© 2010 David P. Little Download this applet for offline viewing (includes source code). The above applet uses the Java Math Expression Parser (JEP) developed by Singular Systems 