Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 486

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Sums and Products - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Arithmetic.html#Arithmetic" title="Arithmetic">
<link rel="prev" href="Trigonometry.html#Trigonometry" title="Trigonometry">
<link rel="next" href="Utility-Functions.html#Utility-Functions" title="Utility Functions">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Sums-and-Products"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Utility-Functions.html#Utility-Functions">Utility Functions</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Trigonometry.html#Trigonometry">Trigonometry</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Arithmetic.html#Arithmetic">Arithmetic</a>
<hr>
</div>

<h3 class="section">17.4 Sums and Products</h3>

<!-- sum src/data.cc -->
<p><a name="doc_002dsum"></a>

<div class="defun">
&mdash; Built-in Function:  <b>sum</b> (<var>x</var>)<var><a name="index-sum-1837"></a></var><br>
&mdash; Built-in Function:  <b>sum</b> (<var>x, dim</var>)<var><a name="index-sum-1838"></a></var><br>
&mdash; Built-in Function:  <b>sum</b> (<var><small class="dots">...</small>, 'native'</var>)<var><a name="index-sum-1839"></a></var><br>
&mdash; Built-in Function:  <b>sum</b> (<var><small class="dots">...</small>, 'double'</var>)<var><a name="index-sum-1840"></a></var><br>
&mdash; Built-in Function:  <b>sum</b> (<var><small class="dots">...</small>, 'extra'</var>)<var><a name="index-sum-1841"></a></var><br>
<blockquote><p>Sum of elements along dimension <var>dim</var>.  If <var>dim</var> is
omitted, it defaults to the first non-singleton dimension.

        <p>If the optional argument 'native' is given, then the sum is performed
in the same type as the original argument, rather than in the default
double type.  For example:

     <pre class="example">          sum ([true, true])
            &rArr; 2
          sum ([true, true], 'native')
            &rArr; true
</pre>
        <p>On the contrary, if 'double' is given, the sum is performed in double
precision even for single precision inputs.

        <p>For double precision inputs, 'extra' indicates that a more accurate algorithm
than straightforward summation is to be used.  For single precision inputs,
'extra' is the same as 'double'.  Otherwise, 'extra' has no effect. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcumsum.html#doc_002dcumsum">cumsum</a>, <a href="doc_002dsumsq.html#doc_002dsumsq">sumsq</a>, <a href="doc_002dprod.html#doc_002dprod">prod</a>. 
</p></blockquote></div>

<!-- prod src/data.cc -->
   <p><a name="doc_002dprod"></a>

<div class="defun">
&mdash; Built-in Function:  <b>prod</b> (<var>x</var>)<var><a name="index-prod-1842"></a></var><br>
&mdash; Built-in Function:  <b>prod</b> (<var>x, dim</var>)<var><a name="index-prod-1843"></a></var><br>
<blockquote><p>Product of elements along dimension <var>dim</var>.  If <var>dim</var> is
omitted, it defaults to the first non-singleton dimension. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dcumprod.html#doc_002dcumprod">cumprod</a>, <a href="doc_002dsum.html#doc_002dsum">sum</a>. 
</p></blockquote></div>

<!-- cumsum src/data.cc -->
   <p><a name="doc_002dcumsum"></a>

<div class="defun">
&mdash; Built-in Function:  <b>cumsum</b> (<var>x</var>)<var><a name="index-cumsum-1844"></a></var><br>
&mdash; Built-in Function:  <b>cumsum</b> (<var>x, dim</var>)<var><a name="index-cumsum-1845"></a></var><br>
&mdash; Built-in Function:  <b>cumsum</b> (<var><small class="dots">...</small>, 'native'</var>)<var><a name="index-cumsum-1846"></a></var><br>
&mdash; Built-in Function:  <b>cumsum</b> (<var><small class="dots">...</small>, 'double'</var>)<var><a name="index-cumsum-1847"></a></var><br>
&mdash; Built-in Function:  <b>cumsum</b> (<var><small class="dots">...</small>, 'extra'</var>)<var><a name="index-cumsum-1848"></a></var><br>
<blockquote><p>Cumulative sum of elements along dimension <var>dim</var>.  If <var>dim</var>
is omitted, it defaults to the first non-singleton dimension.

        <p>See <code>sum</code> for an explanation of the optional parameters 'native',
'double', and 'extra'. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsum.html#doc_002dsum">sum</a>, <a href="doc_002dcumprod.html#doc_002dcumprod">cumprod</a>. 
</p></blockquote></div>

<!-- cumprod src/data.cc -->
   <p><a name="doc_002dcumprod"></a>

<div class="defun">
&mdash; Built-in Function:  <b>cumprod</b> (<var>x</var>)<var><a name="index-cumprod-1849"></a></var><br>
&mdash; Built-in Function:  <b>cumprod</b> (<var>x, dim</var>)<var><a name="index-cumprod-1850"></a></var><br>
<blockquote><p>Cumulative product of elements along dimension <var>dim</var>.  If
<var>dim</var> is omitted, it defaults to the first non-singleton dimension.

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dprod.html#doc_002dprod">prod</a>, <a href="doc_002dcumsum.html#doc_002dcumsum">cumsum</a>. 
</p></blockquote></div>

<!-- sumsq src/data.cc -->
   <p><a name="doc_002dsumsq"></a>

<div class="defun">
&mdash; Built-in Function:  <b>sumsq</b> (<var>x</var>)<var><a name="index-sumsq-1851"></a></var><br>
&mdash; Built-in Function:  <b>sumsq</b> (<var>x, dim</var>)<var><a name="index-sumsq-1852"></a></var><br>
<blockquote><p>Sum of squares of elements along dimension <var>dim</var>.  If <var>dim</var>
is omitted, it defaults to the first non-singleton dimension.

        <p>This function is conceptually equivalent to computing

     <pre class="example">          sum (x .* conj (x), dim)
</pre>
        <p class="noindent">but it uses less memory and avoids calling <code>conj</code> if <var>x</var> is real. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dsum.html#doc_002dsum">sum</a>. 
</p></blockquote></div>

   </body></html>