| 1 | |
| 2 | <refentry id="polynomial"> |
| 3 | <indexterm id="IndexPolynomial"><primary>polynomial</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Opcode Equivalents of Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>polynomial</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>polynomial</refname> |
| 11 | <refpurpose> |
| 12 | Efficiently evaluates a polynomial of arbitrary order. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | The <emphasis>polynomial</emphasis> opcode calculates a polynomial with a single a-rate input variable. The polynomial is a sum of any number of terms in the form <emphasis>kn*x^n</emphasis> where <emphasis>kn</emphasis> is the nth coefficient of the expression. These coefficients are k-rate values. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>aout <command>polynomial</command> ain, k0 [, k1 [, k2 [...]]]</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Performance</title> |
| 30 | <para> |
| 31 | <emphasis>ain</emphasis> -- the input signal used as the independent variable of the polynomial ("x"). |
| 32 | </para> |
| 33 | |
| 34 | <para> |
| 35 | <emphasis>aout</emphasis> -- the output signal ("y"). |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>k0, k1, k2, ...</emphasis> -- the coefficients for each term of the polynomial. |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | If we consider the input parameter <emphasis>ain</emphasis> to be "x" and the output <emphasis>aout</emphasis> to be "y", then the <emphasis>polynomial</emphasis> opcode calculates the following equation: |
| 44 | <literallayout> |
| 45 | y = k0 + k1*x + k2*x^2 + k3*x^3 + ... |
| 46 | </literallayout> |
| 47 | </para> |
| 48 | </refsect1> |
| 49 | |
| 50 | <refsect1> |
| 51 | <title>Examples</title> |
| 52 | <para> |
| 53 | Here is an example of the polynomial opcode. It uses the file <ulink url="examples/polynomial.csd"><citetitle>polynomial.csd</citetitle></ulink>. |
| 54 | <example> |
| 55 | <title>Example of the polynomial opcode.</title> |
| 56 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 57 | <xi:include href="examples-xml/polynomial.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 58 | </example> |
| 59 | </para> |
| 60 | </refsect1> |
| 61 | |
| 62 | <refsect1> |
| 63 | <title>See also</title> |
| 64 | <para><link linkend="SigmodWavshape"><citetitle>Waveshaping</citetitle></link></para> |
| 65 | <para><link linkend="MathOpeqfunc"><citetitle>Opcode Equivalents of Functions</citetitle></link></para> |
| 66 | </refsect1> |
| 67 | |
| 68 | <refsect1> |
| 69 | <title>Credits</title> |
| 70 | <para> |
| 71 | <simplelist> |
| 72 | <member>Author: &nameanthony;</member> |
| 73 | <member>January 2008</member> |
| 74 | </simplelist> |
| 75 | </para> |
| 76 | <para>New in Csound version 5.08</para> |
| 77 | </refsect1> |
| 78 | </refentry> |