| 1 | |
| 2 | <refentry id="sqrt"> |
| 3 | <indexterm id="IndexSqrt"><primary>sqrt</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>sqrt</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>sqrt</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Returns a square root value. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Returns the square root of <emphasis>x</emphasis> (<emphasis>x</emphasis> non-negative). |
| 23 | </para> |
| 24 | |
| 25 | <para> |
| 26 | The argument value is restricted for <link linkend="log"><citetitle>log</citetitle></link>, |
| 27 | <link linkend="log10"><citetitle>log10</citetitle></link>, and <emphasis>sqrt</emphasis>. |
| 28 | </para> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Syntax</title> |
| 33 | <synopsis><command>sqrt</command>(x) (no rate restriction)</synopsis> |
| 34 | <synopsis><command>sqrt</command>(k/i[]) (k- or i-arrays )</synopsis> |
| 35 | <para> |
| 36 | where the argument within the parentheses may be an expression. Value converters perform arithmetic translation from units of one kind to units of another. The result can then be a term in a further expression. |
| 37 | </para> |
| 38 | </refsect1> |
| 39 | |
| 40 | <refsect1> |
| 41 | <title>Examples</title> |
| 42 | <para> |
| 43 | Here is an example of the sqrt opcode. It uses the file <ulink url="examples/sqrt.csd"><citetitle>sqrt.csd</citetitle></ulink>. |
| 44 | <example> |
| 45 | <title>Example of the sqrt opcode.</title> |
| 46 | <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> |
| 47 | <xi:include href="examples-xml/sqrt.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 48 | </example> |
| 49 | Its output should include lines like these: |
| 50 | <screen> |
| 51 | square root of left channel = 1.000000 |
| 52 | square root of left channel = 0.948688 |
| 53 | square root of left channel = 0.894437 |
| 54 | square root of left channel = 0.836676 |
| 55 | square root of left channel = 0.774620 |
| 56 | square root of left channel = 0.707139 |
| 57 | square root of left channel = 0.632499 |
| 58 | square root of left channel = 0.547781 |
| 59 | square root of left channel = 0.447295 |
| 60 | square root of left channel = 0.316242 |
| 61 | </screen> |
| 62 | </para> |
| 63 | </refsect1> |
| 64 | |
| 65 | <refsect1> |
| 66 | <title>See also</title> |
| 67 | <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para> |
| 68 | </refsect1> |
| 69 | |
| 70 | </refentry> |