% -*- texinfo -*- % @deftypefn {Function File} {} roots (@var{v}) % % For a vector @var{v} with @math{N} components, return % the roots of the polynomial % @tex % $$ % v_1 z^{N-1} + \cdots + v_{N-1} z + v_N. % $$ % @end tex % @ifnottex % % @example % v(1) * z^(N-1) + @dots{} + v(N-1) * z + v(N) % @end example % @end ifnottex % % As an example, the following code finds the roots of the quadratic % polynomial % @tex % $$ p(x) = x^2 - 5. $$ % @end tex % @ifnottex % @example % p(x) = x^2 - 5. % @end example % @end ifnottex % @example % @group % c = [1, 0, -5]; % roots(c) % @result{} 2.2361 % @result{} -2.2361 % @end group % @end example % Note that the true result is % @tex % $\pm \sqrt{5}$ % @end tex % @ifnottex % @math{+/- sqrt(5)} % @end ifnottex % which is roughly % @tex % $\pm 2.2361$. % @end tex % @ifnottex % @math{+/- 2.2361}. % @end ifnottex % @seealso{compan} % @end deftypefn