TI-30Xa and HP 12C: Linear Interpolation
Introduction
Given
two points (x0, y0) and (x1, y1), and a point, x, we can easily
estimate the y coordinate:
y =
y0 + (x – x0) * (y1 – y0) / (x1 – x0)
Note
that the slope of the line is:
m =
(y1 – y0) / (x1 – x0)
This
works the best when x is relatively real close to x0 and x1.
Fun
fact, the y-intercept, where x = 0 can be calculated as:
b =
y0 – x0 * m
TI-30Xa
Algorithm: Linear Interpolation
This
algorithm will require to enter information only once.
Store
the following points:
x0 [
STO ] 1
y0 [
STO ] 2
Predict
y:
[ (
] x [ – ] [ RCL ] 1 [ ) ] [ × ] [ ( ] y1 [ – ] [ RCL ] 2 [ ) ] [ ÷
] [ ( ] x1 [ – ] [ RCL ] 1 [ ) ] [ + ] y0 [ = ]
HP
12C Algorithm: Linear Interpolation
It
turns out that we can use the linear regression functions for linear
interpolation. Entering two points for linear regression will create
a perfect line (with the correlation of 1 or -1). The algorithm
presented is for the HP 12C, and a algorithm for other calculators
can easily be made.
Keystrokes:
Enter
(x0, y0) and (x1, y1):
[ f
] [ Clx ] (CLEAR FIN)
y0 [
ENTER ] x0 [ Σ+ ]
y1 [
ENTER ] x1 [ Σ+ ]
To
calculate y:
x [
g ] [ 2 ] (y-hat, r)
Examples
|
X0 |
Y0 |
X1 |
Y1 |
X (Input) |
Y (Output) |
|
|
|
|
|
11 |
5.0050 |
|
|
|
|
|
22 |
50,111 |
|
|
|
|
|
1500 |
95.95 |
Source
“Linear
interpolation” Wikipedia. Was Edited August 27, 2024. Retrieved
September 4, 2024.
https://en.wikipedia.org/wiki/Linear_interpolation
Until
next time, as we head into the final month of 2024,
Eddie
All
original content copyright, © 2011-2024. Edward Shore.
Unauthorized use and/or unauthorized distribution for commercial
purposes without express and written permission from the author is
strictly prohibited. This blog entry may be distributed for
noncommercial purposes, provided that full credit is given to the
author.