Anonymous user
Horner's rule for polynomial evaluation: Difference between revisions
Horner's rule for polynomial evaluation (view source)
Revision as of 14:10, 24 September 2010
, 13 years ago→{{header|Ruby}}
No edit summary |
|||
Line 531:
cat(horner(c(-19, 7, -4, 6), 3), "\n")</lang>
=={{header|RLaB}}==
RLaB implements horner's scheme for polynomial evaluation in its built-in function ''polyval''.
What is important is that RLaB stores the polynomials as row vectors starting from the highest
power.
This said, solution to the problem is
<lang RLaB>
>> x = [-19, 7, -4, 6]
</lang>
=={{header|Ruby}}==
<lang ruby>def horner(coeffs, x)
|