Roots of a function: Difference between revisions

→‎{{header|J}}: exact or approximate
(added J)
(→‎{{header|J}}: exact or approximate)
Line 282:
J has builtin a root-finding operator, '''<tt>p.</tt>''', whose input is the (reversed) coeffiecients of the polynomial. Hence:
 
>1{::p. 0 2 _3 1
2 1 0
 
We can determine whether the roots are exact or approximate by evaluating the polynomial at the candidate roots, and testing for zero:
 
(0=]p.1{::p.) 0 2 _3 1
1 1 1
 
As you can see, <tt>p.</tt> is also the operator which evaluates polynomials. This is not a coincidence.
 
=={{header|Java}}==
Anonymous user