Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: fitter.solution - Function Up: fitter - Tool Previous: fitter.fitpoly - Function


fitter.fitspoly - Function



Package utility
Module fitting
Tool fitter


Solve polynomial equationswith large x-range


Synopsis
fitspoly(n, x, y, sd, wt, id)


Arguments

n in the order of the polynomial to solve for
    Allowed: integer
x in the parameter for the polynomial calculations
    Allowed: one or more real or complex values
y in observed values of the condition equations
    Allowed: N x m values
sd in standard deviation of equations
    Allowed: one or more values used cyclically
    Default: unset
wt in an optional alternate for sd
    Allowed: one or more values used cyclically
    Default: 1
id in the id of a sub-tool
    Allowed: fitter id
    Default: 0


Returns
bool


Description
fitspoly will create normal equations from the specified condition equations, and solve the resulting normal equations. In essence a combination of makepoly and fit.

The method expects that the properties of the fitter to be used have been initialized or set (like the number of simultaneous solutions m; the type; factors). The main reason is to limit the number of parameters on the one hand, and on the other hand not to depend on the actual array structure in Glish to get the variables and type. Before fitting the x-range is normalized to values less than 1 to cater for large difference in x raised to large powers. Later a shift to make x around zero will be added as well.



Example
- include 'fitting.g'
- fit := fitter();		# a fitter for real unknowns
- x:=[1:10]			# we have values at 10 'x' values
- y:=2+0.5*x-0.1*x^2		# which are 2 +0.5x -0.1x^2
- fit.fitspoly(3,x,y) 		# fit a 3-degree polynomial
T 
- print fit.solution(), fit.error() #  show solution and their errors
[2 0.5 -0.1 1.05116e-15]  [0 0 0 0]





next up previous contents index
Next: fitter.solution - Function Up: fitter - Tool Previous: fitter.fitpoly - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15