Taylor-Newton-Gauss

A
program to find the unknown parameters of a nonlinear or linear

function
from a series of observations {X,Y}.

The method used is a truncated Taylor series, Gauss least
squares and Newton differentiation.

We assume that reasonable initial approximations, {Guess
values}, of the desired unknowns, _{}, are known.

Enter as many guesses as unknowns, _{}. Each guess must be
"within range" of the final value.

Start with guess = 1.

If the calculation diverges, try guess = -1 or 0.1 or -0.1
or 10 or -10.

If the calculation still diverges, plot the equation (Fit) using various values
for _{}for better Guesses.

**RMS_error **is the Root Mean Square.

**SSQ **is the average of the sum of the
squares.

The **RMS_percent_avg_response **is a normalized
RMS in percent. This relative quantity should be a few percent and is a good
measure to use (along with correlation, RMS_error and SSQ).

Change the iterations as necessary. Some Fits will converge
with as few as 3 iterations; others take more iterations.

The number of X and Y values must be the same. As a check,
the nops of X and Y will show this.

**How to:**

Start with a truncated Taylors series about the point _{}. We can use a
truncation because, if the Guess values are reasonable approximations to the
required solution, the quantities _{}and _{}will be small; hence
their squares, products and higher powers will be negligible in comparison with
the quantities themselves.

_{}

This truncated Taylor series is now linear and can be solved
using the Gauss method.

**The procedure is best
explained by an example:**

_{}

_{}

_{}

_{}

_{}

_{}

_{}

_{}

_{}

_{}

_{}

_{}

_{}

Find least squares of:

_{}

_{}

Now iterate, using the new Guess = Guess [1.41,.676].

_{}

** **

**Some caveats:**

Check the inputs.

Is the Fit equation properly entered?

Are the X values sorted low to high?

Do the Y values match the X values?

Do the number of X values equal the number of Y values?
(N = Ny)

Are the Guess values within range? Start with all ones [1,1,1].

Try various values: [0.1,0.1,0.1]

[-0.1,-0.1,-0.1]

If the program wont converge to
valid coefficients, plot the Fit equation

using various values for a[1],
a[2]. etc.

Is the iteration value too large? Usually, 3 to 5 iterations should be
sufficient.

**Example of Guess and
iteration anomalies:**

_{}

X :=
[.12,.2,.51,.84,1.25,1.98,3.4,4.8]

Y :=
[13.8,21,39.5,50.6,58.6,66.3,72.7,75.5]

Actual coefficients [85.50589158,
.5913770708]

If one starts with Guess = [1,1]
and iterations = 10, the program wont converge.

If one changes Guess = [10,1] and
keeps iterations = 10, the program will converge, but the coefficients are too
far off.

If one keeps Guess = [10,1] and
changes iterations = 5, the program will converge, but the coefficients remain
too far off.

If one changes Guess = [10, 0.5]
and keeps iterations = 10 (or 5), then the program will converge to the actual
coefficients.

Comments? Wayne
Allen

Wayne94@iname.com