4dfe17254ced56750de1e3c29218bd33d83cbf38
[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  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <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">
17     <refnamediv>
18         <refname>lcm</refname>
19         <refpurpose>least common multiple</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Syntax</title>
23         <synopsis>[pp, fact] = lcm(p)</synopsis>
24     </refsynopsisdiv>
25     <refsection>
26         <title>Arguments</title>
27         <variablelist>
28             <varlistentry>
29                 <term>p</term>
30                 <listitem>
31                     <para>
32                         a polynomial row vector <literal>p = [p1, ..., pn]</literal> (type equal to 2) or
33                         an integer row vector (type equal to 1 or 8).
34                     </para>
35                 </listitem>
36             </varlistentry>
37             <varlistentry>
38                 <term>fact</term>
39                 <listitem>
40                     <para>a polynomial vector or an integer vector.</para>
41                 </listitem>
42             </varlistentry>
43             <varlistentry>
44                 <term>pp</term>
45                 <listitem>
46                     <para>a polynomial or an integer.</para>
47                 </listitem>
48             </varlistentry>
49         </variablelist>
50     </refsection>
51     <refsection>
52         <title>Description</title>
53         <para>
54             <code>pp = lcm(p)</code> computes the lcm <varname>pp</varname> of polynomial vector <varname>p</varname>.
55         </para>
56         <para>
57             <code>[pp, fact] = lcm(p)</code> computes in addition the vector <varname>fact</varname> such that:
58         </para>
59         <para>
60             <code>p.*fact = pp*ones(p)</code>.
61         </para>
62         <para>
63             The least common multiple of an array <literal>p</literal> of real numbers can be obtained by
64             converting it to a polynomial before calling <literal>lcm</literal>, through <code>p = inv_coeff(p, 0)</code>.
65         </para>
66         <para>
67             If <literal>p</literal> is given as an integer double (type 1), then it is treated as an <literal>int32</literal>.
68         </para>
69     </refsection>
70     <refsection>
71         <title>Examples</title>
72         <programlisting role="example"><![CDATA[
73 // Polynomial case
74 s = %s;
75 p = [s s*(s+1)^2 s^2*(s+2)];
76 [pp,fact] = lcm(p);
77 p.*fact, pp
78
79 // Integer case
80 V = int32([2^2*3^5, 2^3*3^2,2^2*3^4*5]);
81 lcm(V)
82
83 // Double case
84 V = [2^2*3^5, 2^3*3^2,2^2*3^4*5];
85 lcm(V)
86  ]]></programlisting>
87     </refsection>
88     <refsection role="see also">
89         <title>See also</title>
90         <simplelist type="inline">
91             <member>
92                 <link linkend="gcd">gcd</link>
93             </member>
94             <member>
95                 <link linkend="bezout">bezout</link>
96             </member>
97         </simplelist>
98     </refsection>
99 </refentry>