Polynomial regression: Difference between revisions
Content added Content deleted
(Go solution) |
(→{{header|J}}: fit order 3 polynomial) |
||
Line 469:
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.
The above solution fits a polynomial of order 11. If the order of the polynomial is known to be 3 (as is implied in the task description) then following solution is probably preferable.
<lang j> Y (%. (i.3) ^/~ ]) X
1 2 3</lang>
=={{header|Mathematica}}==
|