E-Code

Least-squares polynomial fit (exact) — a TI-89 Titanium program

By E-Code · updated

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.

StepValue
You enter
Input 1{0,1,2,3}
Input 2{1,3,9,19}
Input 32
Input 44
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

Related programs

All TI-89 Titanium statistics programs · All TI-89 Titanium programs