Jump to content

Polynomial regression: Difference between revisions

(J: note about precision)
Line 423:
 
Note that this implementation does not use floating point numbers, so we do not introduce floating point errors. Using exact arithmetic has a speed penalty, but for small problems like this it is inconsequential.
 
=={{header|Mathematica}}==
Using the built-in "Fit" function.
 
<lang Mathematica>data = Transpose@{Range[0, 10], {1, 6, 17, 34, 57, 86, 121, 162, 209,
262, 321}};
Fit[data, {1, x, x^2}, x]</lang>
Result:
<pre>1 + 2x + 3x^2</pre>
 
 
=={{header|MATLAB}}==
Line 434 ⟶ 444:
 
2.999999999999998 2.000000000000019 0.999999999999956</lang>
 
 
=={{header|Octave}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.