Difference between revisions of "Fit Command"

From GeoGebra Manual
Jump to: navigation, search
Line 3: Line 3:
 
;Fit[ <List of Points>, <List of Functions> ]
 
;Fit[ <List of Points>, <List of Functions> ]
 
:Calculates a linear combination of the ''functions'' that best fit the ''points'' in the list.
 
:Calculates a linear combination of the ''functions'' that best fit the ''points'' in the list.
 
 
:{{example|1=<div>
 
:{{example|1=<div>
 
:* <code>Fit[{(-2, 3), (0, 1), (2, 1), (2, 3)}, {x^2, x}]</code> yields ''0.625 x^2 - 0.25x''.
 
:* <code>Fit[{(-2, 3), (0, 1), (2, 1), (2, 3)}, {x^2, x}]</code> yields ''0.625 x^2 - 0.25x''.
:* Let  ''L = {A, B, C,...}'', ''f(x) = 1'', ''g(x) = x'', ''h(x) = e^x'', ''F = {f, g, h}''.<br> <code>Fit[L, F]</code> calculates a function of the form ''a + b x + c e^x'' that fits the points in the list. </div>}}
+
:* Let  ''L = {A, B, C, ...}'', ''f(x) = 1'', ''g(x) = x'', ''h(x) = e^x'', ''F = {f, g, h}''.<br> <code>Fit[L, F]</code> calculates a function of the form ''a + b x + c e^x'' that fits the points in the list. </div>}}
 
 
;Fit[ <List of points>, <Function> ]
 
;Fit[ <List of points>, <Function> ]
 
:Calculates a minimum squared error function  to the points in the list. The ''function'' must depend on one or more sliders, that are taken as start values of parameters to be optimized. The non-linear iteration might not converge, but adjusting the sliders to a better starting point might help.
 
:Calculates a minimum squared error function  to the points in the list. The ''function'' must depend on one or more sliders, that are taken as start values of parameters to be optimized. The non-linear iteration might not converge, but adjusting the sliders to a better starting point might help.
 
:{{example|1=<div>Let ''a'' be slider with interval from ''-5'' to ''5'' and increment 1. <br> <code><nowiki>Fit[{(-2, 3), (0, 1), (2, 1), (2, 3)}, a + x^2]</nowiki></code> yields ''-1 + x^2''.</div>}}
 
:{{example|1=<div>Let ''a'' be slider with interval from ''-5'' to ''5'' and increment 1. <br> <code><nowiki>Fit[{(-2, 3), (0, 1), (2, 1), (2, 3)}, a + x^2]</nowiki></code> yields ''-1 + x^2''.</div>}}
 
 
{{note|1=Other point fitting commands are [[FitExp Command|FitExp]], [[FitGrowth Command|FitGrowth]], [[FitLine Command|FitLine]], [[FitLineX Command|FitLineX]], [[FitLog Command|FitLog]], [[FitLogistic Command|FitLogistic]], [[FitPoly Command|FitPoly]], [[FitPow Command|FitPow]] and [[FitSin Command|FitSin]].}}
 
{{note|1=Other point fitting commands are [[FitExp Command|FitExp]], [[FitGrowth Command|FitGrowth]], [[FitLine Command|FitLine]], [[FitLineX Command|FitLineX]], [[FitLog Command|FitLog]], [[FitLogistic Command|FitLogistic]], [[FitPoly Command|FitPoly]], [[FitPow Command|FitPow]] and [[FitSin Command|FitSin]].}}

Revision as of 15:01, 26 August 2013



Fit[ <List of Points>, <List of Functions> ]
Calculates a linear combination of the functions that best fit the points in the list.
Example:
  • Fit[{(-2, 3), (0, 1), (2, 1), (2, 3)}, {x^2, x}] yields 0.625 x^2 - 0.25x.
  • Let L = {A, B, C, ...}, f(x) = 1, g(x) = x, h(x) = e^x, F = {f, g, h}.
    Fit[L, F] calculates a function of the form a + b x + c e^x that fits the points in the list.
Fit[ <List of points>, <Function> ]
Calculates a minimum squared error function to the points in the list. The function must depend on one or more sliders, that are taken as start values of parameters to be optimized. The non-linear iteration might not converge, but adjusting the sliders to a better starting point might help.
Example:
Let a be slider with interval from -5 to 5 and increment 1.
Fit[{(-2, 3), (0, 1), (2, 1), (2, 3)}, a + x^2] yields -1 + x^2.
Note: Other point fitting commands are FitExp, FitGrowth, FitLine, FitLineX, FitLog, FitLogistic, FitPoly, FitPow and FitSin.
© 2024 International GeoGebra Institute