Table lookup or curve fitting?

  • Follow


I would like to write a small program for my HP50 that can compute the
inflated value of an sum of money from yesteryear. Two methods come to
mind:

1. Table lookup. Look up the year and the product from a table.
2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
straight forward calculation at input time.

What method should you use?

If table drivven, what object type? List or matrix?

I have the data in an excel sheet (two columns year and "multiplier"),
ready to import into the HP50, as soon as I have decided on the
correct form.

How do I go forward with this revolutionary program? :-)

Per.

0
Reply stromgren.per (3) 11/2/2007 12:16:52 PM

Polynomial fitting if not handled carefully can come up with very
strange results. I would go with the table and may interpolate locally
to find the values between the cells with low order polynomials. There
should be some spline programs on hpcalc.org

Arnaud


0
Reply Arnaud 11/2/2007 6:45:51 PM


perstromgren <stromgren.per@gmail.com> wrote:
>
> 1. Table lookup. Look up the year and the product from a table.
> 2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
> straight forward calculation at input time.

Every real world problem I have worked on that uses emperical data
has always used table lookups (with interpolation).

- Kurt
0
Reply kurt 11/3/2007 6:42:04 AM

On 3 Nov, 07:42, ~kurt <actinouran...@earthlink.net> wrote:
> perstromgren <stromgren....@gmail.com> wrote:
>
> > 1. Table lookup. Look up the year and the product from a table.
> > 2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
> > straight forward calculation at input time.
>
> Every real world problem I have worked on that uses emperical data
> has always used table lookups (with interpolation).

What would be your choice of object type for "table" here: list or
matrix? And what may be a good approach to find a value in the list or
matrix, knowing that the data are sorted, but not every value is
present?

I can of course use brute force, but I would rather use something
Knuth wold agree with!

Per.

>
> - Kurt


0
Reply perstromgren 11/3/2007 8:08:52 AM

On Nov 3, 11:08 am, perstromgren <stromgren....@gmail.com> wrote:

> What would be your choice of object type for "table" here: list or
> matrix? And what may be a good approach to find a value in the list or
> matrix, knowing that the data are sorted, but not every value is
> present?
>
> I can of course use brute force, but I would rather use something
> Knuth wold agree with!

I made my own interpolation program using matrices.  I'd be happy to
post it, but you may be wanting to write your own and I wouldn't want
to take away the fun.  It does a binary search to find the correct
pair of values to interpolate between.  I cannot guarantee Knuth would
approve however. :)

I posted a two-way interpolation program here about a year ago.
Search for 'TWINT' if you're interested.  I've tweaked it a little
since.

-wes

0
Reply Wes 11/3/2007 2:43:54 PM

On Fri, 02 Nov 2007 05:16:52 -0700, perstromgren <stromgren.per@gmail.com>
wrote:

>I would like to write a small program for my HP50 that can compute the
>inflated value of an sum of money from yesteryear. Two methods come to
>mind:
>
>1. Table lookup. Look up the year and the product from a table.
>2. Polynomial fitting. Fit a polynom to my data beforehand, and do a
>straight forward calculation at input time.
>
>What method should you use?

  What's wrong with using the built-in Financial solver?

>
>If table drivven, what object type? List or matrix?
>
>I have the data in an excel sheet (two columns year and "multiplier"),
>ready to import into the HP50, as soon as I have decided on the
>correct form.
>
>How do I go forward with this revolutionary program? :-)
>
>Per.

0
Reply The 11/3/2007 3:09:55 PM

perstromgren <stromgren.per@gmail.com> wrote:
>
> What would be your choice of object type for "table" here: list or
> matrix? And what may be a good approach to find a value in the list or

I would use a matrix (array).

> matrix, knowing that the data are sorted, but not every value is
> present?

Some sort of interpolation scheme - the best is dependent on the data.
You need to plot it and choose a method.  You can always get by with
linear interpolation.

- Kurt
0
Reply kurt 11/4/2007 7:58:39 AM

6 Replies
347 Views

(page loaded in 0.133 seconds)

Similiar Articles:













7/24/2012 12:48:38 AM


Reply: