Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1556 |
|
Package | utility | |
Module | fitting | |
Tool | fitter |
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 |
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.
- 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]