* Bug #7782 fixed - Trick for lcm and gcd
[scilab.git] / scilab / modules / elementary_functions / help / en_US / discrete / lcm.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2006-2008 - INRIA
5  *
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at
10  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
11  *
12  -->
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="lcm">
14     <refnamediv>
15         <refname>lcm</refname>
16         <refpurpose>least common multiple</refpurpose>
17     </refnamediv>
18     <refsynopsisdiv>
19         <title>Calling Sequence</title>
20         <synopsis>[pp, fact] = lcm(p)</synopsis>
21     </refsynopsisdiv>
22     <refsection>
23         <title>Arguments</title>
24         <variablelist>
25             <varlistentry>
26                 <term>p</term>
27                 <listitem>
28                     <para>
29                         a polynomial row vector <literal>p = [p1, ..., pn]</literal> (type equal to 2) or
30                         an integer row vector (type equal to 8).
31                     </para>
32                 </listitem>
33             </varlistentry>
34             <varlistentry>
35                 <term>fact</term>
36                 <listitem>
37                     <para>a polynomial vector or an integer vector.</para>
38                 </listitem>
39             </varlistentry>
40             <varlistentry>
41                 <term>pp</term>
42                 <listitem>
43                     <para>a polynomial or an integer.</para>
44                 </listitem>
45             </varlistentry>
46         </variablelist>
47     </refsection>
48     <refsection>
49         <title>Description</title>
50         <para>
51             <code>pp = lcm(p)</code> computes the lcm <varname>pp</varname> of polynomial vector <varname>p</varname>.
52         </para>
53         <para>
54             <code>[pp, fact] = lcm(p)</code> computes in addition the vector <varname>fact</varname> such that:
55         </para>
56         <para>
57             <code>p.*fact = pp*ones(p)</code>.
58         </para>
59         <para>
60             The least common multiple of an array <literal>p</literal> of real numbers can be obtained by
61             converting it to a polynomial before calling <literal>lcm</literal>, through <code>p = inv_coeff(p, 0)</code>.
62         </para>
63     </refsection>
64     <refsection>
65         <title>Examples</title>
66         <programlisting role="example"><![CDATA[
67 //polynomial case
68 s=poly(0,'s');
69 p=[s,s*(s+1)^2,s^2*(s+2)];
70 [pp,fact]=lcm(p);
71 p.*fact, pp
72
73 //integer case
74 V=int32([2^2*3^5, 2^3*3^2,2^2*3^4*5]);
75 lcm(V)
76  ]]></programlisting>
77     </refsection>
78     <refsection role="see also">
79         <title>See Also</title>
80         <simplelist type="inline">
81             <member>
82                 <link linkend="gcd">gcd</link>
83             </member>
84             <member>
85                 <link linkend="bezout">bezout</link>
86             </member>
87         </simplelist>
88     </refsection>
89 </refentry>