Least-squares polynomial fit (exact) — a TI-89 Titanium program
PFIT89 is a TI-89 BASIC program for the TI-89 Titanium. Fit a line, parabola or cubic to X and Y lists by least squares — the coefficients come out as exact fractions when the data are exact — with R² and a prediction.
What it asks for and what it shows
It asks for 4 values at its prompts. In the example below it shows C0, C1, C2, R², YHAT.
Example run
One of its oracle test cases: “exact parabola y = 2x²+1”. The inputs are typed in order, and the results are the values the case expects on the screen.
| Step | Value |
|---|---|
| You enter | |
| Input 1 | {0,1,2,3} |
| Input 2 | {1,3,9,19} |
| Input 3 | 2 |
| Input 4 | 4 |
| The screen shows | |
C0= | 1 |
C1= | 0 |
C2= | 2 |
R²= | 1 |
YHAT= | 33 |
How it's checked
4 test cases, each checked against an independent method. Replayed key by key on a virtual TI-89 Titanium, they make 29 checks.
How E-Code checks every program
Run it or put it on your calculator
- Open the library in the TI-89 Titanium calculator and pick “Least-squares polynomial fit (exact)” (PFIT89).
- Put it on your own calculator with a computer and a USB cable, or type it in by hand.
Related programs
- Least squares with matrices (Vandermonde)
- Linear regression with exact slope
- t test and interval from data lists
- Chi-square goodness of fit
- Markov chain: n steps and the steady state
All TI-89 Titanium statistics programs · All TI-89 Titanium programs