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
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Chapter 9. Polynomials in GEL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="Genius Manual"><link rel="up" href="index.html" title="Genius Manual"><link rel="prev" href="ch08s03.html" title="Linear Algebra"><link rel="next" href="ch10.html" title="Chapter 10. Set Theory in GEL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 9. Polynomials in GEL</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch08s03.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="genius-gel-polynomials"></a>Chapter 9. Polynomials in GEL</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="sect1"><a href="ch09.html#genius-gel-polynomials-using">Using Polynomials</a></span></dt></dl></div><p>
Currently Genius can handle polynomials of one variable written out
as vectors, and do some basic operations with these. It is planned to
expand this support further.
</p><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="genius-gel-polynomials-using"></a>Using Polynomials</h2></div></div></div><p>
Currently
polynomials in one variable are just horizontal vectors with value only nodes.
The power of the term is the position in the vector, with the first position
being 0. So,
</p><pre class="programlisting">[1,2,3]
</pre><p>
translates to a polynomial of
</p><pre class="programlisting">1 + 2*x + 3*x^2
</pre><p>
</p><p>
You can add, subtract and multiply polynomials using the
<a class="link" href="ch11s15.html#gel-function-AddPoly"><code class="function">AddPoly</code></a>,
<a class="link" href="ch11s15.html#gel-function-SubtractPoly"><code class="function">SubtractPoly</code></a>, and
<a class="link" href="ch11s15.html#gel-function-MultiplyPoly"><code class="function">MultiplyPoly</code></a> functions respectively.
You can print a polynomial using the
<a class="link" href="ch11s15.html#gel-function-PolyToString"><code class="function">PolyToString</code></a>
function.
For example,
</p><pre class="programlisting">PolyToString([1,2,3],"y")
</pre><p>
gives
</p><pre class="programlisting">3*y^2 + 2*y + 1
</pre><p>
You can also get a function representation of the polynomial so that you can
evaluate it. This is done by using
<a class="link" href="ch11s15.html#gel-function-PolyToFunction"><code class="function">PolyToFunction</code></a>,
which
returns an anonymous function.
</p><pre class="programlisting">f = PolyToFunction([0,1,1])
f(2)
</pre><p>
</p><p>
It is also possible to find roots of polynomials of degrees 1 through 4 by using the
function
<a class="link" href="ch11s13.html#gel-function-PolynomialRoots"><code class="function">PolynomialRoots</code></a>,
which calls the appropriate formula function. Higher degree polynomials must be converted to
functions and solved
numerically using a function such as
<a class="link" href="ch11s13.html#gel-function-FindRootBisection"><code class="function">FindRootBisection</code></a>,
<a class="link" href="ch11s13.html#gel-function-FindRootFalsePosition"><code class="function">FindRootFalsePosition</code></a>,
<a class="link" href="ch11s13.html#gel-function-FindRootMullersMethod"><code class="function">FindRootMullersMethod</code></a>, or
<a class="link" href="ch11s13.html#gel-function-FindRootSecant"><code class="function">FindRootSecant</code></a>.
</p><p>
See <a class="xref" href="ch11s15.html" title="Polynomials">the section called “Polynomials”</a> in the function list
for the rest of functions acting on polynomials.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch08s03.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="ch10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Linear Algebra </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 10. Set Theory in GEL</td></tr></table></div></body></html>
|