1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Miscellaneous Functions (GNU Octave (version 10.3.0))</title>
<meta name="description" content="Miscellaneous Functions (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Miscellaneous Functions (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Polynomial-Manipulations.html" rel="up" title="Polynomial Manipulations">
<link href="Polynomial-Interpolation.html" rel="prev" title="Polynomial Interpolation">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<div class="section-level-extent" id="Miscellaneous-Functions">
<div class="nav-panel">
<p>
Previous: <a href="Polynomial-Interpolation.html" accesskey="p" rel="prev">Polynomial Interpolation</a>, Up: <a href="Polynomial-Manipulations.html" accesskey="u" rel="up">Polynomial Manipulations</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h3 class="section" id="Miscellaneous-Functions-1"><span>28.6 Miscellaneous Functions<a class="copiable-link" href="#Miscellaneous-Functions-1"> ¶</a></span></h3>
<a class="anchor" id="XREFpoly"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-poly"><span><code class="def-type"><var class="var">y</var> =</code> <strong class="def-name">poly</strong> <code class="def-code-arguments">(<var class="var">A</var>)</code><a class="copiable-link" href="#index-poly"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-poly-1"><span><code class="def-type"><var class="var">y</var> =</code> <strong class="def-name">poly</strong> <code class="def-code-arguments">(<var class="var">x</var>)</code><a class="copiable-link" href="#index-poly-1"> ¶</a></span></dt>
<dd><p>If <var class="var">A</var> is a square <em class="math">N</em>-by-<em class="math">N</em> matrix, <code class="code">poly (<var class="var">A</var>)</code>
is the row vector of the coefficients of <code class="code">det (z * eye (N) - A)</code>,
the characteristic polynomial of <var class="var">A</var>.
</p>
<p>For example, the following code finds the eigenvalues of <var class="var">A</var> which are
the roots of <code class="code">poly (<var class="var">A</var>)</code>.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">roots (poly (eye (3)))
⇒ 1.00001 + 0.00001i
1.00001 - 0.00001i
0.99999 + 0.00000i
</pre></div></div>
<p>In fact, all three eigenvalues are exactly 1 which emphasizes that for
numerical performance the <code class="code">eig</code> function should be used to compute
eigenvalues.
</p>
<p>If <var class="var">x</var> is a vector, <code class="code">poly (<var class="var">x</var>)</code> is a vector of the
coefficients of the polynomial whose roots are the elements of <var class="var">x</var>.
That is, if <var class="var">c</var> is a polynomial, then the elements of
<code class="code"><var class="var">d</var> = roots (poly (<var class="var">c</var>))</code> are contained in <var class="var">c</var>. The
vectors <var class="var">c</var> and <var class="var">d</var> are not identical, however, due to sorting and
numerical errors.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="Finding-Roots.html#XREFroots">roots</a>, <a class="ref" href="Basic-Matrix-Functions.html#XREFeig">eig</a>.
</p></dd></dl>
<a class="anchor" id="XREFpolyout"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-polyout"><span><strong class="def-name">polyout</strong> <code class="def-code-arguments">(<var class="var">c</var>)</code><a class="copiable-link" href="#index-polyout"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-polyout-1"><span><strong class="def-name">polyout</strong> <code class="def-code-arguments">(<var class="var">c</var>, <var class="var">x</var>)</code><a class="copiable-link" href="#index-polyout-1"> ¶</a></span></dt>
<dt class="deftypefnx def-cmd-deftypefn" id="index-polyout-2"><span><code class="def-type"><var class="var">str</var> =</code> <strong class="def-name">polyout</strong> <code class="def-code-arguments">(…)</code><a class="copiable-link" href="#index-polyout-2"> ¶</a></span></dt>
<dd><p>Display a formatted version of the polynomial <var class="var">c</var>.
</p>
<p>The formatted polynomial
</p>
<div class="example">
<pre class="example-preformatted">c(x) = c(1) * x^n + ... + c(n) x + c(n+1)
</pre></div>
<p>is returned as a string or written to the screen if <code class="code">nargout</code> is zero.
</p>
<p>The second argument <var class="var">x</var> specifies the variable name to use for each term
and defaults to the string <code class="code">"s"</code>.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFpolyreduce">polyreduce</a>.
</p></dd></dl>
<a class="anchor" id="XREFpolyreduce"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-polyreduce"><span><code class="def-type"><var class="var">p</var> =</code> <strong class="def-name">polyreduce</strong> <code class="def-code-arguments">(<var class="var">c</var>)</code><a class="copiable-link" href="#index-polyreduce"> ¶</a></span></dt>
<dd><p>Reduce a polynomial coefficient vector to a minimum number of terms by
stripping off any leading zeros.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFpolyout">polyout</a>.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Previous: <a href="Polynomial-Interpolation.html">Polynomial Interpolation</a>, Up: <a href="Polynomial-Manipulations.html">Polynomial Manipulations</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|