Handbook
Glossary
polyval ( x p -- p[x] )
Polynomials
Prev:
pgcd ( p q -- a d )
Next:
pdiff ( p -- p' )
Vocabulary
math
.
polynomials
Inputs
x
a
number
p
a polynomial
Outputs
p[x]
a
number
Word description
Evaluate
p
with the input
x
.
Examples
USING: math.polynomials prettyprint ; 2 { 1 0 1 } polyval .
5
See also
polyval*
Definition
USING:
kernel
math
sequences
;
IN:
math.polynomials
:
polyval
( x p -- p[x] )
[
nip
<reversed>
unclip-slice
swap
]
[
drop
]
2bi
[
*
]
curry
[
dip
+
]
curry
each
;