* Bug #14118 fixed - real(), imag(), conj(), isreal() did not accept rationals 84/17884/15
Nicolas [Thu, 10 Mar 2016 11:44:55 +0000 (12:44 +0100)]
* Bug #13893 was actually unfixed when calling simp(n,d)  with 2 argins
* Code simplification for +/- between rationals and doubles

Change-Id: Ifc929d48d2ac411f076db4c07a093b7947bb47fb

37 files changed:
scilab/CHANGES
scilab/modules/elementary_functions/help/en_US/complex/conj.xml
scilab/modules/elementary_functions/help/en_US/complex/imag.xml
scilab/modules/elementary_functions/help/en_US/complex/isreal.xml
scilab/modules/elementary_functions/help/en_US/complex/real.xml
scilab/modules/elementary_functions/help/fr_FR/complex/conj.xml
scilab/modules/elementary_functions/help/fr_FR/complex/imag.xml
scilab/modules/elementary_functions/help/fr_FR/complex/isreal.xml
scilab/modules/elementary_functions/help/fr_FR/complex/real.xml
scilab/modules/elementary_functions/help/ja_JP/complex/conj.xml
scilab/modules/elementary_functions/help/ja_JP/complex/imag.xml
scilab/modules/elementary_functions/help/ja_JP/complex/isreal.xml
scilab/modules/elementary_functions/help/ja_JP/complex/real.xml
scilab/modules/elementary_functions/help/pt_BR/complex/conj.xml
scilab/modules/elementary_functions/help/pt_BR/complex/imag.xml
scilab/modules/elementary_functions/help/pt_BR/complex/isreal.xml
scilab/modules/elementary_functions/help/pt_BR/complex/real.xml
scilab/modules/elementary_functions/help/ru_RU/complex/conj.xml
scilab/modules/elementary_functions/help/ru_RU/complex/imag.xml
scilab/modules/elementary_functions/help/ru_RU/complex/isreal.xml
scilab/modules/elementary_functions/help/ru_RU/complex/real.xml
scilab/modules/elementary_functions/tests/unit_tests/conj.dia.ref
scilab/modules/elementary_functions/tests/unit_tests/conj.tst
scilab/modules/elementary_functions/tests/unit_tests/imag.dia.ref [new file with mode: 0644]
scilab/modules/elementary_functions/tests/unit_tests/imag.tst [new file with mode: 0644]
scilab/modules/elementary_functions/tests/unit_tests/real.dia.ref [new file with mode: 0644]
scilab/modules/elementary_functions/tests/unit_tests/real.tst [new file with mode: 0644]
scilab/modules/overloading/macros/%r_a_s.sci
scilab/modules/overloading/macros/%r_conj.sci [new file with mode: 0644]
scilab/modules/overloading/macros/%r_d_s.sci
scilab/modules/overloading/macros/%r_imag.sci [new file with mode: 0644]
scilab/modules/overloading/macros/%r_real.sci [new file with mode: 0644]
scilab/modules/overloading/macros/%r_s_s.sci
scilab/modules/overloading/macros/%r_simp.sci
scilab/modules/overloading/macros/%s_a_r.sci
scilab/modules/overloading/macros/%s_d_r.sci
scilab/modules/overloading/macros/%s_s_r.sci

index 30c01fd..e530a93 100644 (file)
@@ -131,6 +131,8 @@ Other feature additions
   - rewriten: consolebox, double, isoview, householder
   - resorted: else, elseif, end, try, sciargs, global, halt, empty, power
 
+* real(), imag(), conj() and isreal() now accept rational fractions
+
 
 Installation
 ============
@@ -376,6 +378,8 @@ In 6.0.0:
 
 * Bug #14116 fixed - Invalid exponent in case of complex exponents especially 0*%i.
 
+* Bug #14118 fixed - real(), imag(), conj(), isreal() did not accept rationals
+
 * Bug #14271 fixed - conjgrad() displayed an incorrect error message about number of arguments.
 
 * Bug #14347 fixed - plot2d crashed with multiple entries (non regression test).
index cb9aa64..d48c091 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>[y]=conj(x)</synopsis>
+        <synopsis>[y] = conj(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>x,y</term>
                 <listitem>
-                    <para>real or complex matrix (full or sparse storage)</para>
+                    <para>Matrices of real or complex numbers (full or sparse storage). Matrices of polynomials or rationals, with real or complex coefficients.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
-            <literal>conj(x)</literal> is the complex conjugate of
-            <literal>x</literal>.
+            <literal>conj(x)</literal> components are the complex conjugate of <literal>x</literal>
+            components.
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
-x=[1+%i,-%i;%i,2*%i];
+        <programlisting role="example"><![CDATA[
+x = [1+%i, -%i; %i, 2*%i];
 conj(x)
 x'-conj(x)  //x'  is conjugate transpose
+
+// With polynomials:
+x = [%z-%i 2*%i %i*%z^2-1]
+conj(x)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2]
+B = A(1,[2 1])
+C = A + %i*B
+conj(C)
+B,imag(conj(C))
  ]]></programlisting>
     </refsection>
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="quote">quote</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 3cc580c..0bb6c45 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="imag" xml:lang="en">
     <refnamediv>
         <refname>imag</refname>
-        <refpurpose>imaginary part</refpurpose>
+        <refpurpose>imaginary part of complex numbers, polynomials, or rationals</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>[y]=imag(x)</synopsis>
+        <synopsis>y = imag(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>a real or complex vector or matrix.</para>
+                    <para>matrix of real or complex numbers (full or sparse storage),
+                    or of polynomials or rationals with real or complex coefficients.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>a real vector or matrix.</para>
+                    <para>matrix of real numbers, polynomials or rationals, with same sizes than <varname>x</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
             <code>imag(x)</code> is the imaginary part of
             numbers).
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
-imag([1 %i 2])
-imag(1+0*%i)
-imag(2+3*%i)
-imag(1+%s)
-imag(sprand(3,3,0.1))
+        <programlisting role="example"><![CDATA[
+c = [ 2 %i, 1+0*%i, 2-3*%i  log(-1) (-1)^(1/3) ]
+imag(c)
+
+s = sprand(3,3,0.3) + sprand(3,3,0.3)*%i
+imag(s)
+
+// Polynomials with complex coeficients:
+A = [1-%i*%z (%z-%i)^2]
+imag(A)
+
+// Rationals with complex coeficients:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1]);
+C = A + %i*B
+B, imag(C)
  ]]></programlisting>
     </refsection>
-    
+
     <refsection role="see also">
         <title>See Also</title>
         <simplelist type="inline">
@@ -66,4 +78,15 @@ imag(sprand(3,3,0.1))
             </member>
         </simplelist>
     </refsection>
-</refentry>
+
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
\ No newline at end of file
index 8ca87e1..56e174f 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isreal" xml:lang="en">
     <refnamediv>
         <refname>isreal</refname>
-        <refpurpose>check if a variable has real or complex entries</refpurpose>
+        <refpurpose>check if a variable is stored as a complex matrix</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>t=isreal(x)
-            t=isreal(x,eps)
+        <synopsis>t = isreal(x)
+            t = isreal(x, eps)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>vector or matrix with floating point entries or
-                        coefficients
+                    <para>Matrices of real or complex numbers (full or sparse storage).
+                    Matrices of polynomials or rationals, with real or complex coefficients.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
+                <term>eps</term>
+                <listitem>
+                    <para>a positive or null real (default value = 0)</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
                 <term>t</term>
                 <listitem>
                     <para>a boolean</para>
     <refsection>
         <title>Description</title>
         <para>
-            <literal>isreal(x)</literal> returns true if <literal>x</literal> is
-            stored as a real variable and false if <literal>x</literal> is stored with
+            <literal>isreal(x)</literal> returns %T (true) if <literal>x</literal> is
+            stored as a real variable, and %F (false) <literal>x</literal> is stored with
             an (eventually zero) imaginary part.
         </para>
         <para>
-            <literal>isreal(x,eps)</literal> returns true if
-            <literal>x</literal> is stored as a real variable or if maximum absolute
-            value of imaginary floating points is less or equal than
-            <literal>eps</literal>.
+            <literal>isreal(x, eps)</literal> returns %T (true) if
+            <literal>x</literal> is stored as a real variable, or if the maximal absolute
+            value of imaginary parts of its components is less or equal than <literal>eps</literal>.
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
+isreal([])        // => %T
 isreal([1 2])
 isreal(1+0*%i)
 isreal(1+0*%i,0)
-isreal(1+%s)
-isreal(sprand(3,3,0.1))
+
+// Sparse matrix:
+isreal(sparse([1-%i -3+4*%i]))
+
+// Polynomial:
+p = (1-2*%s)^2
+isreal(p)
+
+// Rational fraction:
+r = [ (%i-%s)/%s^2 %s/(2-%s)]
+isreal(r)
  ]]></programlisting>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index d0e62d4..4610b39 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
 <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="real">
     <refnamediv>
         <refname>real</refname>
-        <refpurpose>real part</refpurpose>
+        <refpurpose>real part of complex numbers, polynomials, or rationals</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>[y]=real(x)</synopsis>
+        <synopsis>y = real(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>a real or complex vector or matrix</para>
+                    <para>matrix of real or complex numbers (full or sparse storage),
+                    or of polynomials or rationals with real or complex coefficients.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>a real matrix</para>
+                    <para>matrix of real numbers, polynomials or rationals, with same sizes than <varname>x</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
-            <code>real(x)</code> is the real part of <varname>x</varname> (See <constant>%i</constant> to enter complex numbers).
+            <code>real(x)</code> components are the real part of related <varname>x</varname>
+            components (See <constant>%i</constant> to enter complex numbers).
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Examples</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 real([1 %i 2])
 real(1+0*%i)
 real(2+3*%i)
 real(1+%s)
 real(sprand(3,3,0.1))
+
+// With polynomials:
+A = [1-%i*%z (%z-%i)^2]
+real(A)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1])
+C = A + %i*B
+A, real(C)
  ]]></programlisting>
     </refsection>
-    
+
     <refsection role="see also">
         <title>See Also</title>
         <simplelist type="inline">
@@ -64,4 +77,15 @@ real(sprand(3,3,0.1))
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
+
index ea29d4b..974a92e 100644 (file)
@@ -1,37 +1,81 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2015 - Samuel GOUGEON
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="conj" xml:lang="fr">
     <refnamediv>
         <refname>conj</refname>
-        <refpurpose>conjugaison complexe</refpurpose>
+        <refpurpose>complexe conjugué</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Séquence d'appel</title>
-        <synopsis>[y]=conj(x)</synopsis>
+        <title>Syntaxe</title>
+        <synopsis>[y] = conj(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
                 <term>x,y</term>
                 <listitem>
-                    <para>vecteur ou matrice (réelle ou complexe, stockage plein ou creux)</para>
+                    <para>Matrices de nombres décimaux ou complexes (encodage plein ou creux).
+                    Matrices de polynômes ou de fractions rationnelles à coefficients décimaux ou complexes.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
-            Les éléments de <literal>conj(x)</literal> sont les complexes
-            conjugués des éléments de <literal>x</literal>.
+            Les éléments de <literal>conj(x)</literal> sont les complexes conjugués des éléments de <literal>x</literal>.
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Exemples</title>
-        <programlisting role="example"><![CDATA[ 
-x=[1+%i,-%i;%i,2*%i];
+        <programlisting role="example"><![CDATA[
+x = [1+%i, -%i; %i, 2*%i];
 conj(x)
 x'-conj(x)  // x' est la transposée conjuguée de x
+
+// Polynômes à coefficients complexes :
+x = [%z-%i 2*%i %i*%z^2-1]
+conj(x)
+
+// Fractions rationnelles à coefficients complexes :
+A = [ %z/(1-%z)  (1-%z)/%z^2]
+B = A(1,[2 1])
+C = A + %i*B
+conj(C)
+B, imag(conj(C))
  ]]></programlisting>
     </refsection>
+    <refsection role="see also">
+        <title>Voir aussi</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="quote">quote</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection role="history">
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension aux fractions rationnelles. Exemples ajoutés.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 74551f0..8249701 100644 (file)
@@ -1,38 +1,78 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2015 - Samuel GOUGEON
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
 <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="fr" xml:id="imag">
     <refnamediv>
         <refname>imag</refname>
-        <refpurpose>partie imaginaire  </refpurpose>
+        <refpurpose>partie imaginaire de nombres, polynômes ou fractions complexes</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Séquence d'appel</title>
-        <synopsis>[y]=imag(x)</synopsis>
+        <title>Syntaxe</title>
+        <synopsis>y = imag(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
                 <term>x  </term>
                 <listitem>
-                    <para>matrice réelle ou complexe.
+                    <para>Matrice réelle ou complexe (dense ou creuse). Matrice
+                    de polynômes ou de fractions rationnelles à coefficients réels ou complexes.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y  </term>
                 <listitem>
-                    <para>matrice réelle.
+                    <para>matrice de nombres réels, ou de polynômes ou fractions
+                    rationnelles à coefficients réels. <varname>x</varname> et
+                    <varname>y</varname> ont la même taille.
                     </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
-            <literal>imag(x)</literal> renvoie la partie imaginaire de <literal>x</literal> (voir <literal> %i</literal> pour entrer des nombres complexes).
+            <literal>imag(x)</literal> renvoie la partie imaginaire de
+            <literal>x</literal> (voir <literal> %i</literal> pour entrer des nombres complexes).
         </para>
     </refsection>
+
+    <refsection role="examples">
+        <title>Exemples</title>
+        <programlisting role="example"><![CDATA[
+c = [ 2 %i, 1+0*%i, 2-3*%i  log(-1) (-1)^(1/3) ]
+imag(c)
+
+s = sprand(3,3,0.3) + sprand(3,3,0.3)*%i
+imag(s)
+
+// Polynômes complexes :
+A = [1-%i*%z (%z-%i)^2]
+imag(A)
+
+// Fractions rationnelles complexes :
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1]);
+C = A + %i*B
+B, imag(C)
+ ]]></programlisting>
+    </refsection>
+
     <refsection role="see also">
         <title>Voir aussi</title>
         <simplelist type="inline">
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension aux fractions rationnelles
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index a8b470b..68c650e 100644 (file)
@@ -1,28 +1,43 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2015 - Samuel GOUGEON
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isreal" xml:lang="fr">
     <refnamediv>
         <refname>isreal</refname>
-        <refpurpose>vérifie si une matrice a des éléments complexes</refpurpose>
+        <refpurpose>Retourne %F si la matrice est encodée en numération complexe</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Séquence d'appel</title>
-        <synopsis>t=isreal(x)
-            t=isreal(x,eps)
+        <title>Syntaxe</title>
+        <synopsis>t = isreal(x)
+            t = isreal(x, eps)
         </synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>vecteur ou matrice réelle ou complexe.</para>
+                    <para>matrice de nombres réels ou complexes, ou de polynômes
+                    ou fractions rationnelles à coefficients réels ou complexes.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>eps</term>
                 <listitem>
-                    <para>nombre réel positif.</para>
+                    <para>nombre réel positif (par défaut nul)</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
@@ -33,7 +48,7 @@
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
             <literal>isreal(x)</literal> renvoie <literal>%T</literal> (vrai) si
             partie imaginaire (même nulle).
         </para>
         <para>
-            <literal>isreal(x,eps)</literal> renvoie <literal>%T</literal>
-            (vrai) si <literal>x</literal> est stockée comme une matrice réelle ou si
-            les valeurs absolues des parties imaginaires des éléments de
-            <literal>x</literal> sont plus petites que <literal>eps</literal>.
+            <literal>isreal(x, eps)</literal> renvoie <literal>%T</literal>
+            (vrai) si <literal>x</literal> est stockée comme une matrice réelle, ou si
+            les valeurs absolues des parties imaginaires de ses éléments (ou des coefficients de
+            ses éléments) sont inférieures à <literal>eps</literal>.
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Exemples</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
+isreal([])        // => %T
 isreal([1 2])
 isreal(1+0*%i)
 isreal(1+0*%i,0)
-isreal(1+%s)
-isreal(sprand(3,3,0.1))
- ]]></programlisting>
+
+// Matrice creuse complexe :
+isreal(sparse([1-%i -3+4*%i]))
+
+// Polynôme à coefficients complexes :
+p = (1-2*%s)^2
+isreal(p)
+
+// Fraction rationnelle à coefficients complexes :
+r = [ (%i-%s)/%s^2 %s/(2-%s)]
+isreal(r) 
+]]></programlisting>
+    </refsection>
+    <refsection role="history">
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension aux fractions rationnelles
+                </revdescription>
+            </revision>
+        </revhistory>
     </refsection>
 </refentry>
index 5fbbadc..d07d616 100644 (file)
@@ -1,38 +1,78 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2015 - Samuel GOUGEON
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
 <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="fr" xml:id="real">
     <refnamediv>
         <refname>real</refname>
-        <refpurpose>partie réelle  </refpurpose>
+        <refpurpose>partie réelle de nombres, polynômes ou fractions complexes</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Séquence d'appel</title>
-        <synopsis>[y]=real(x)</synopsis>
+        <title>Syntaxe</title>
+        <synopsis>y = real(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
                 <term>x  </term>
                 <listitem>
-                    <para>matrice réelle ou complexe.
+                    <para>Matrice réelle ou complexe (dense ou creuse). Matrice
+                    de polynômes ou de fractions rationnelles à coefficients réels
+                    ou complexes.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y  </term>
                 <listitem>
-                    <para>matrice réelle.
+                    <para>matrice de nombres réels, ou de polynômes ou fractions
+                    rationnelles à coefficients réels. <varname>x</varname> et
+                    <varname>y</varname> ont la même taille.
                     </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Description</title>
         <para>
-            <literal>real(x)</literal> renvoie la partie réelle de <literal>x</literal> (voir <literal> %i</literal> pour entrer des nombres complexes).
+            Les éléments de <literal>real(x)</literal> renvoient la partie réelle
+            des éléments correspondant de <literal>x</literal> (voir
+            <link linkend="percenti">%i</link> pour entrer des nombres complexes).
         </para>
     </refsection>
+    <refsection role="examples">
+        <title>Exemples</title>
+        <programlisting role="example"><![CDATA[
+real([1 %i 2])
+real(1+0*%i)
+real(2+3*%i)
+real(1+%s)
+real(sprand(3,3,0.1))
+
+// Polynômes :
+A = [1-%i*%z (%z-%i)^2]
+real(A)
+
+// Fractions rationnelles :
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1])
+C = A + %i*B
+A, real(C)
+ ]]></programlisting>
+    </refsection>
     <refsection role="see also">
         <title>Voir aussi</title>
         <simplelist type="inline">
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension aux fractions rationnelles
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index c74e7b2..7e859ff 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="conj" xml:lang="ja">
-    
     <refnamediv>
-        
         <refname>conj</refname>
-        
         <refpurpose>共役</refpurpose>
-        
     </refnamediv>
-    
     <refsynopsisdiv>
-        
         <title>呼び出し手順</title>
-        
-        <synopsis>[y]=conj(x)</synopsis>
-        
+        <synopsis>y = conj(x)</synopsis>
     </refsynopsisdiv>
-    
-    <refsection>
-        
+    <refsection role="parameters">
         <title>引数</title>
-        
         <variablelist>
-            
             <varlistentry>
-                
-                <term>x,y</term>
-                
+                <term>x, y</term>
                 <listitem>
-                    
-                    <para>実数または複素行列(通常または疎記憶).</para>
-                    
+                    <para>実数または複素行列(通常または疎記憶).
+                    Matrices of polynomials or rationals, with real or complex
+                    coefficients.
+                    </para>
                 </listitem>
-                
             </varlistentry>
-            
         </variablelist>
-        
     </refsection>
-    
-    <refsection>
-        
+    <refsection role="description">
         <title>説明</title>
-        
         <para>
-            
             <literal>conj(x)</literal> は <literal>x</literal>の
-            
             複素共役である.
-            
         </para>
-        
     </refsection>
-    
-    <refsection>
-        
+    <refsection role="examples">
         <title>例</title>
-        
-        <programlisting role="example"><![CDATA[ 
-x=[1+%i,-%i;%i,2*%i];
+        <programlisting role="example"><![CDATA[
+x = [1+%i, -%i; %i, 2*%i];
 conj(x)
 x'-conj(x)  //x' は共役転置
+
+// With polynomials:
+x = [%z-%i 2*%i %i*%z^2-1]
+conj(x)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2]
+B = A(1,[2 1])
+C = A + %i*B
+conj(C)
+B,imag(conj(C))
  ]]></programlisting>
-        
     </refsection>
-    
+    <refsection role="see also">
+        <title>See Also</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="quote">quote</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
-
index 6cada58..ca6694a 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="imag" xml:lang="ja">
-    
     <refnamediv>
-        
         <refname>imag</refname>
-        
         <refpurpose>虚部</refpurpose>
-        
     </refnamediv>
-    
     <refsynopsisdiv>
-        
         <title>呼び出し手順</title>
-        
-        <synopsis>[y]=imag(x)</synopsis>
-        
+        <synopsis>y = imag(x)</synopsis>
     </refsynopsisdiv>
-    
-    <refsection>
-        
+    <refsection role="parameters">
         <title>引数</title>
-        
         <variablelist>
-            
             <varlistentry>
-                
                 <term>x</term>
-                
                 <listitem>
-                    
                     <para>実数または複素数のベクトルまたは行列.</para>
-                    
                 </listitem>
-                
             </varlistentry>
-            
             <varlistentry>
-                
                 <term>y</term>
-                
                 <listitem>
-                    
-                    <para>実数のベクトルまたは行列</para>
-                    
+                    <para>matrix of real numbers, polynomials or rationals,
+                    with same sizes than <varname>x</varname>.
+                    </para>
                 </listitem>
-                
             </varlistentry>
-            
         </variablelist>
-        
     </refsection>
-    
-    <refsection>
-        
+    <refsection role="description">
         <title>説明</title>
-        
         <para>
-            
             <code>imag(x)</code>は,
-            
             <varname>x</varname>の虚部です. ( 複素数を入力するには<constant>%i</constant>を参照ください).
-            
         </para>
-        
     </refsection>
-    
-    <refsection>
-        
+    <refsection role="examples">
         <title>例</title>
-        
-        <programlisting role="example"><![CDATA[ 
-imag([1 %i 2])
-imag(1+0*%i)
-imag(2+3*%i)
-imag(1+%s)
-imag(sprand(3,3,0.1))
+        <programlisting role="example"><![CDATA[
+c = [ 2 %i, 1+0*%i, 2-3*%i  log(-1) (-1)^(1/3) ]
+imag(c)
+s = sprand(3,3,0.3) + sprand(3,3,0.3)*%i
+imag(s)
+
+// Polynomials with complex coeficients:
+A = [1-%i*%z (%z-%i)^2]
+imag(A)
+
+// Rationals with complex coeficients:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1]);
+C = A + %i*B
+B, imag(C)
  ]]></programlisting>
-        
     </refsection>
-    
     <refsection role="see also">
-        
         <title>参照</title>
-        
         <simplelist type="inline">
-            
             <member>
-                
                 <link linkend="real">real</link>
-                
             </member>
-            
         </simplelist>
-        
     </refsection>
-    
-</refentry>
-
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
\ No newline at end of file
index 875b2f0..0012d06 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isreal" xml:lang="ja">
-    
     <refnamediv>
-        
         <refname>isreal</refname>
-        
         <refpurpose>変数が実数または複素数のエントリかどうかを調べるc</refpurpose>
-        
     </refnamediv>
-    
     <refsynopsisdiv>
-        
         <title>呼び出し手順</title>
-        
-        <synopsis>t=isreal(x)
-            
-            t=isreal(x,eps)
-            
+        <synopsis>t = isreal(x)
+            t = isreal(x,eps)
         </synopsis>
-        
     </refsynopsisdiv>
-    
     <refsection>
-        
         <title>引数</title>
-        
         <variablelist>
-            
             <varlistentry>
-                
                 <term>x</term>
-                
                 <listitem>
-                    
                     <para>
-                        
                         浮動小数点数のエントリまたは係数を有するベクトルまたは行列
-                        
                     </para>
-                    
                 </listitem>
-                
             </varlistentry>
-            
             <varlistentry>
-                
+                <term>eps</term>
+                <listitem>
+                    <para>a positive or null real number (default value = 0)</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
                 <term>t</term>
-                
                 <listitem>
-                    
                     <para>論理値</para>
-                    
                 </listitem>
-                
             </varlistentry>
-            
         </variablelist>
-        
     </refsection>
-    
     <refsection>
-        
         <title>説明</title>
-        
         <para>
-            
             <literal>isreal(x)</literal> は,
-            
             <literal>x</literal>が実数変数として保持されている場合に真,
-            
             <literal>x</literal>に虚部(0の場合もある)を保持する変数の場合に偽
-            
             を返します.
-            
         </para>
-        
         <para>
-            
             <literal>isreal(x,eps)</literal> は
-            
             <literal>x</literal>が実数変数として保持されているか,
-            
             虚部の浮動小数点数の絶対値の最大値が <literal>eps</literal>以下の場合に
-            
             真を返します.
-            
         </para>
-        
     </refsection>
-    
     <refsection>
-        
         <title>例</title>
-        
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 isreal([1 2])
 isreal(1+0*%i)
 isreal(1+0*%i,0)
-isreal(1+%s)
-isreal(sprand(3,3,0.1))
- ]]></programlisting>
-        
-    </refsection>
-    
-</refentry>
 
+// Sparse complex matrix:
+isreal(sparse([1-%i -3+4*%i]))
+
+// Complex polynomial:
+p = (1-2*%s)^2
+isreal(p)
+
+// Complex rational fraction:
+r = [ (%i-%s)/%s^2 %s/(2-%s)]
+isreal(r)
+]]></programlisting>
+    </refsection>
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
\ No newline at end of file
index 9bc4d56..ba019df 100644 (file)
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-
 <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="ja" xml:id="real">
-    
     <refnamediv>
-        
         <refname>real</refname>
-        
         <refpurpose>実部</refpurpose>
-        
     </refnamediv>
-    
     <refsynopsisdiv>
-        
         <title>呼び出し手順</title>
-        
-        <synopsis>[y]=real(x)</synopsis>
-        
+        <synopsis>[y] = real(x)</synopsis>
     </refsynopsisdiv>
-    
     <refsection>
-        
         <title>引数</title>
-        
         <variablelist>
-            
             <varlistentry>
-                
                 <term>x</term>
-                
                 <listitem>
-                    
                     <para>実数または複素数のベクトルまたは行列</para>
-                    
                 </listitem>
-                
             </varlistentry>
-            
             <varlistentry>
-                
                 <term>y</term>
-                
                 <listitem>
-                    
                     <para>実数の行列</para>
-                    
                 </listitem>
-                
             </varlistentry>
-            
         </variablelist>
-        
     </refsection>
-    
     <refsection>
-        
         <title>説明</title>
-        
         <para>
-            
             <code>real(x)</code> は
-            
             <varname>x</varname>の実部です. ( 複素数を入力するには<constant>%i</constant>を参照ください).
-            
         </para>
-        
     </refsection>
-    
     <refsection>
-        
         <title>例</title>
-        
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 real([1 %i 2])
 real(1+0*%i)
 real(2+3*%i)
 real(1+%s)
 real(sprand(3,3,0.1))
+
+// With polynomials:
+A = [1-%i*%z (%z-%i)^2]
+real(A)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1])
+C = A + %i*B
+A, real(C)
  ]]></programlisting>
-        
     </refsection>
-    
     <refsection role="see also">
-        
         <title>参照</title>
-        
         <simplelist type="inline">
-            
             <member>
-                
                 <link linkend="imag">imag</link>
-                
             </member>
-            
         </simplelist>
-        
     </refsection>
-    
-</refentry>
-
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
\ No newline at end of file
index fb238ce..6f23fcb 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="conj" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="conj" xml:lang="pt">
     <refnamediv>
         <refname>conj</refname>
-        <refpurpose>matriz conjugada</refpurpose>
+        <refpurpose>matriz complexa conjugada</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
-        <synopsis>[y]=conj(x)</synopsis>
+        <title>Seqüência de Chamamento</title>
+        <synopsis>y = conj(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
-        <title>Parâmetros</title>
+    <refsection role="parameters">
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
-                <term>x,y</term>
+                <term>x, y</term>
                 <listitem>
-                    <para>matrizes de reais ou complexos</para>
+                    <para>matrizes de reais ou complexos (full or sparse storage).
+                    Matrizes de polinômios ou razões de polinmios, com coeficientes reais ou complexos.</para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
-        <title>Descrição</title>
+    <refsection role="description">
+        <title>Descrição</title>
         <para>
-            <literal>conj(x)</literal> é a matriz conjugada complexa de
-            <literal>x</literal>.
+            <literal>conj(x)</literal> é a matriz conjugada complexa de <literal>x</literal>.
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Exemplos</title>
-        <programlisting role="example"><![CDATA[ 
-x=[1+%i,-%i;%i,2*%i];
+        <programlisting role="example"><![CDATA[
+x = [1+%i, -%i; %i, 2*%i];
 conj(x)
-x'-conj(x)  //x'  é a matriz transposta conjugada
- ]]></programlisting>
+x'-conj(x)  //x'  é a matriz transposta conjugada
+
+// Com polinômios:
+x = [%z-%i 2*%i %i*%z^2-1]
+conj(x)
+
+// Com razões de polinômios :
+A = [ %z/(1-%z)  (1-%z)/%z^2]
+B = A(1,[2 1])
+C = A + %i*B
+conj(C)
+B,imag(conj(C))
+    ]]></programlisting>
+    </refsection>
+    <refsection role="see also">
+        <title>Ver também</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="quote">quote</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
     </refsection>
 </refentry>
index 48600d1..fe50bd8 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="imag" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="imag" xml:lang="pt">
     <refnamediv>
         <refname>imag</refname>
-        <refpurpose>parte imaginária</refpurpose>
+        <refpurpose>parte imaginária dos números complexos</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
-        <synopsis>[y]=imag(x)</synopsis>
+        <title>Seqüência de Chamamento</title>
+        <synopsis>y = imag(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
-        <title>Parâmetros</title>
+    <refsection role="parameters">
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>matriz ou vetor de reais ou complexos</para>
+                    <para>matriz de números reais ou complexos, ou de polinômios
+                    ou de razões de
+                    polinômios com coeficientes reais ou complexos.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>matriz ou vetor de reais</para>
+                    <para>matriz de reais ou de polinômios ou de razões de polinômios com
+                    coeficientes reais. <varname>y</varname> tem o seu tamanho de
+                    <varname>y</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
-        <title>Descrição</title>
+    <refsection role="description">
+        <title>Descrição</title>
         <para>
-            <literal>imag(x)</literal> é a parte imaginária de
-            <literal>x</literal>. (ver <literal> %i</literal> para entrar com números
-            complexos).
+            <literal>imag(x)</literal> é a parte imaginária de <literal>x</literal>
+            (ver <literal> %i</literal> para entrar com números complexos).
         </para>
     </refsection>
+    <refsection role="examples">
+        <title>Exemplos</title>
+        <programlisting role="example"><![CDATA[
+c = [ 2 %i, 1+0*%i, 2-3*%i  log(-1) (-1)^(1/3) ]
+imag(c)
+
+s = sprand(3,3,0.3) + sprand(3,3,0.3)*%i
+imag(s)
+
+// Polinômios com coeficientes complexos
+A = [1-%i*%z (%z-%i)^2]
+imag(A)
+
+// Razões de polinômios com coeficientes complexos
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1]);
+C = A + %i*B
+B, imag(C)
+ ]]></programlisting>
+    </refsection>
     <refsection role="see also">
-        <title>Ver Também</title>
+        <title>Ver Também</title>
         <simplelist type="inline">
             <member>
                 <link linkend="real">real</link>
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index f5407e0..39b0ea9 100644 (file)
@@ -1,73 +1,95 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2015 - Samuel GOUGEON
  *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at
+ * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isreal" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isreal" xml:lang="pt">
     <refnamediv>
         <refname>isreal</refname>
-        <refpurpose>verifica se uma variável é armazenada como real ou
-            complexa.
+        <refpurpose>verifica se uma variável é armazenada como real ou complexa.
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
-        <synopsis>t=isreal(x)
-            t=isreal(x,eps)
+        <title>Seqüência de Chamamento</title>
+        <synopsis>t = isreal(x)
+            t = isreal(x, eps)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
-        <title>Parâmetros</title>
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>vetor ou matriz com entradas ou coeficientes de ponto
-                        flutuante 
+                    <para>matriz de números reais ou complexos, ou de polinômios ou de razões de
+                    polinômios com coeficientes reais ou complexos.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
+                <term>eps</term>
+                <listitem>
+                    <para>um número real positivo ou nulo (default = 0)</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
                 <term>t</term>
                 <listitem>
-                    <para>um booleano </para>
+                    <para>um booleano</para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
-        <title>Descrição</title>
+        <title>Descrição</title>
         <para>
             <literal>isreal(x)</literal> retorna 'true' (verdadeiro) se
-            <literal>x</literal> é armazenado como uma variável real e falso se
-            <literal>x</literal> é armazenado com uma parte imaginária (que pode ser
+            <literal>x</literal> é armazenado como uma variável real e falso se
+            <literal>x</literal> é armazenado com uma parte imaginária (que pode ser
             zero 0).
         </para>
         <para>
             <literal>isreal(x,eps)</literal> retorna 'true' se
-            <literal>x</literal> é armazenado como uma variável real ou se o valor
-            absoluto máximo dos pontos flutuantes imaginários é menor que ou igual a
+            <literal>x</literal> é armazenado como uma variável real ou se o valor
+            absoluto máximo dos pontos flutuantes imaginários é menor que ou igual a
             <literal>eps</literal>.
         </para>
     </refsection>
     <refsection>
         <title>Exemplos</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 isreal([1 2])
 isreal(1+0*%i)
 isreal(1+0*%i,0)
-isreal(1+%s)
-isreal(sprand(3,3,0.1))
+
+// Sparse complex matrix:
+isreal(sparse([1-%i -3+4*%i]))
+
+// Complex polynomial:
+p = (1-2*%s)^2
+isreal(p)
+
+// Complex rational fraction:
+r = [ (%i-%s)/%s^2 %s/(2-%s)]
+isreal(r)
  ]]></programlisting>
     </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 74d5147..9048c9e 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * along with this program.
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="real" xml:lang="en">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="real" xml:lang="pt">
     <refnamediv>
         <refname>real</refname>
-        <refpurpose>parte real</refpurpose>
+        <refpurpose>parte real dos números complexos</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
-        <synopsis>[y]=real(x)</synopsis>
+        <title>Seqüência de Chamamento</title>
+        <synopsis>y = real(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
-        <title>Parâmetros</title>
+    <refsection role="parameters">
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>vetor ou matriz de reais ou complexos </para>
+                    <para>matriz de números reais ou complexos, ou de polinômios
+                    ou de razões de polinômios com coeficientes reais ou complexos.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>matriz de reais </para>
+                    <para>matriz de reais ou de polinômios ou de razões de polinômios com
+                    coeficientes reais. <varname>y</varname> tem o seu tamanho de
+                    <varname>x</varname>
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
-        <title>Descrição</title>
+    <refsection role="description">
+        <title>Descrição</title>
         <para>
-            <literal>real(x)</literal> é a parte real de <literal>x</literal>
-            (ver <literal>%i</literal> para entrar com números complexos).
+            <literal>real(x)</literal> é a parte real de <literal>x</literal>
+            (ver <literal>%i</literal> para entrar com números complexos).
         </para>
     </refsection>
+    <refsection role="example">
+        <title>Exemplos</title>
+        <programlisting role="example"><![CDATA[
+real([1 %i 2])
+real(1+0*%i)
+real(2+3*%i)
+real(1+%s)
+real(sprand(3,3,0.1))
+
+// With polynomials:
+A = [1-%i*%z (%z-%i)^2]
+real(A)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1])
+C = A + %i*B
+A, real(C)
+ ]]></programlisting>
+    </refsection>
     <refsection role="see also">
-        <title>Ver Também</title>
+        <title>Ver Também</title>
         <simplelist type="inline">
             <member>
                 <link linkend="imag">imag</link>
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index a867525..8462d6a 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
     </refnamediv>
     <refsynopsisdiv>
         <title>Последовательность вызова</title>
-        <synopsis>[y]=conj(x)</synopsis>
+        <synopsis>y = conj(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Аргументы</title>
         <variablelist>
             <varlistentry>
                 <term>x,y</term>
                 <listitem>
-                    <para>вещественная или комплексная матрица.</para>
+                    <para>
+                    Матрицы действительных или комплексных чисел (плотной или редкой хранения).
+                    Матрицы многочленов или рациональных, с действительными или комплексными коэффициентами.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Описание</title>
         <para>
-            <literal>conj(x)</literal> is the complex conjugate of
-            <literal>x</literal>.
+            <literal>conj(x)</literal> is the complex conjugate of <literal>x</literal>.
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Примеры</title>
-        <programlisting role="example"><![CDATA[ 
-x=[1+%i,-%i;%i,2*%i];
+        <programlisting role="example"><![CDATA[
+x = [1+%i, -%i; %i, 2*%i];
 conj(x)
 x'-conj(x)  //x'  транспонирование с сопряжением
+
+// With polynomials:
+x = [%z-%i 2*%i %i*%z^2-1]
+conj(x)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2]
+B = A(1,[2 1])
+C = A + %i*B
+conj(C)
+B,imag(conj(C))
  ]]></programlisting>
     </refsection>
+    <refsection role="see also">
+        <title>Смотрите также</title>
+        <simplelist type="inline">
+            <member>
+                <link linkend="quote">quote</link>
+            </member>
+        </simplelist>
+    </refsection>
+    <refsection role="history">
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 70ec5be..8539541 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
     </refnamediv>
     <refsynopsisdiv>
         <title>Последовательность вызова</title>
-        <synopsis>[y]=imag(x)</synopsis>
+        <synopsis>y = imag(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Аргументы</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>вещественный или комплексный вектор или матрица.</para>
+                    <para>Массив действительных или комплексных чисел. Матричные многочлены или рациональные функции с вещественными или комплексными коэффициентам
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>вещественный вектор или матрица.</para>
+                    <para>Матрица действительных чисел. Матричные многочлены или
+                    рациональные функции с вещественными коэффициентам,
+                    with same sizes than <varname>x</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Описание</title>
         <para>
             <code>imag(x)</code> является мнимой частью
             <varname>x</varname>. (См. <constant>%i</constant> для ввода комплексных чисел).
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
-imag([1 %i 2])
-imag(1+0*%i)
-imag(2+3*%i)
-imag(1+%s)
-imag(sprand(3,3,0.1))
+c = [ 2 %i, 1+0*%i, 2-3*%i  log(-1) (-1)^(1/3) ]
+imag(c)
+
+s = sprand(3,3,0.3) + sprand(3,3,0.3)*%i
+imag(s)
+
+// Polynomials with complex coeficients:
+A = [1-%i*%z (%z-%i)^2]
+imag(A)
+
+// Rationals with complex coeficients:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1]);
+C = A + %i*B
+B, imag(C)
  ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -64,4 +78,14 @@ imag(sprand(3,3,0.1))
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index cd9750e..befc154 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="isreal" xml:lang="ru">
     <refnamediv>
         <refname>isreal</refname>
-        <refpurpose>проверка, имеет ли переменная вещественные или комплексные элементы.</refpurpose>
+        <refpurpose>проверка, имеет ли переменная вещественные или комплексные элементы</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Последовательность вызова</title>
         <synopsis>
-            t=isreal(x)
-            t=isreal(x,eps)
+            t = isreal(x)
+            t = isreal(x, eps)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>вектор или матрица с элементами с плавающей запятой или коэффициенты</para>
+                    <para>Matrix of real or complex numbers (full or sparse storage).
+                    Matrix of polynomials or rationals, with real or complex coefficients.</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>eps</term>
+                <listitem>
+                    <para>положительный или нулевой реальный номер (по умолчанию = 0)</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
     <refsection>
         <title>Описание</title>
         <para>
-            <literal>isreal(x)</literal> возвращает значение "истина", если <literal>x</literal> хранится как вещественная переменная, и "ложь", если <literal>x</literal> имеет мнимую часть (даже если она нулевая).
+            <literal>isreal(x)</literal> возвращает значение "истина", если
+            <literal>x</literal> хранится как вещественная переменная, и
+            "ложь", если <literal>x</literal> имеет мнимую часть (даже если она нулевая).
         </para>
         <para>
-            <literal>isreal(x,eps)</literal> возвращает "истину", если <literal>x</literal> хранится как вещественная переменная или если максимальное по модулю значение мнимой части меньше или равно <literal>eps</literal>.
+            <literal>isreal(x,eps)</literal> возвращает "истину", если
+            <literal>x</literal> хранится как вещественная переменная или если
+            максимальное по модулю значение мнимой части меньше или равно
+            <literal>eps</literal>.
         </para>
     </refsection>
     <refsection>
         <title>Примеры</title>
-        <programlisting role="example"><![CDATA[ 
+        <programlisting role="example"><![CDATA[
 isreal([1 2])
 isreal(1+0*%i)
 isreal(1+0*%i,0)
-isreal(1+%s)
-isreal(sprand(3,3,0.1))
- ]]></programlisting>
+
+// Sparse complex matrix:
+isreal(sparse([1-%i -3+4*%i]))
+
+// Complex polynomial:
+p = (1-2*%s)^2
+isreal(p)
+
+// Complex rational fraction:
+r = [ (%i-%s)/%s^2 %s/(2-%s)]
+isreal(r) 
+]]></programlisting>
+    </refsection>
+    <refsection role="history">
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
     </refsection>
 </refentry>
index 4bc1ba1..fac87d6 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * 
+ * Copyright (C) 2015 - Samuel GOUGEON
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
     </refnamediv>
     <refsynopsisdiv>
         <title>Последовательность вызова</title>
-        <synopsis>[y]=real(x)</synopsis>
+        <synopsis>y = real(x)</synopsis>
     </refsynopsisdiv>
-    <refsection>
+    <refsection role="parameters">
         <title>Аргументы</title>
         <variablelist>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>вещественный или комплексный вектор или матрица</para>
+                    <para>Массив действительных или комплексных чисел.
+                    Матричные многочлены или рациональные функции с
+                    вещественными или комплексными коэффициентам
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>y</term>
                 <listitem>
-                    <para>вещественная матрица</para>
+                    <para>Матрица действительных чисел. Матричные многочлены
+                    или рациональные функции с вещественными коэффициентам.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
-    <refsection>
+    <refsection role="description">
         <title>Описание</title>
         <para>
             <code>real(x)</code> является реальной частью <varname>x</varname> (См. <constant>%i</constant> для ввода комплексных чисел).
         </para>
     </refsection>
-    <refsection>
+    <refsection role="examples">
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
 real([1 %i 2])
@@ -53,6 +58,16 @@ real(1+0*%i)
 real(2+3*%i)
 real(1+%s)
 real(sprand(3,3,0.1))
+
+// With polynomials:
+A = [1-%i*%z (%z-%i)^2]
+real(A)
+
+// With rationals:
+A = [ %z/(1-%z)  (1-%z)/%z^2];
+B = A(1,[2 1])
+C = A + %i*B
+A, real(C)
  ]]></programlisting>
     </refsection>
     <refsection role="see also">
@@ -63,4 +78,14 @@ real(sprand(3,3,0.1))
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0</revnumber>
+                <revdescription>Extension to rationals
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 068f170..734aba2 100644 (file)
@@ -1,7 +1,7 @@
 // =============================================================================
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
-//
+// Copyright (C) 2016 - Samuel GOUGEON
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 //
@@ -28,7 +28,15 @@ assert_checkequal(conj(spA), sparse(conj(A)));
 assert_checkequal(conj(diag(A)), [1-2*%i; 0]);
 assert_checkequal(conj(speye(4,4)), speye(4,4));
 assert_checkequal(conj(1+s+%i), 1+s-%i);
-assert_checkequal(conj(M),hypermat([1,2,2],[-%i;2;3;4]));
+// conj(rational)
+rr = (2-s)^2/(-1+2*s)^3;
+r = rr + %i;
+tc = rr - %i;
+c = conj(r);
+f = coeff(tc.num)(1)/coeff(c.num)(1);
+c.num = c.num*f;
+c.den = c.den*f;
+assert_checkequal(clean(tc-c), 0/%s);
 // Error messages
 errmsg1=msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "conj", 1);
 assert_checkerror("conj()", errmsg1, 77);
index 9dfdb0e..041dd00 100644 (file)
@@ -1,7 +1,7 @@
 // =============================================================================
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
-//
+// Copyright (C) 2016 - Samuel GOUGEON
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 //
@@ -14,7 +14,7 @@ d=1;
 c_d=1+2*%i;
 A=[1+2*%i, 3+2*%i; 0, 0];
 spA=sparse(A);
-s=poly(0,"s");
+s = poly(0,"s");
 M = hypermat([1 2 2],1:4);
 M(:,1,1)=%i;
 
@@ -30,7 +30,15 @@ assert_checkequal(conj(spA), sparse(conj(A)));
 assert_checkequal(conj(diag(A)), [1-2*%i; 0]);
 assert_checkequal(conj(speye(4,4)), speye(4,4));
 assert_checkequal(conj(1+s+%i), 1+s-%i);
-assert_checkequal(conj(M),hypermat([1,2,2],[-%i;2;3;4]));
+// conj(rational)
+rr = (2-s)^2/(-1+2*s)^3;
+r = rr + %i;
+tc = rr - %i;
+c = conj(r);
+f = coeff(tc.num)(1)/coeff(c.num)(1);
+c.num = c.num*f;
+c.den = c.den*f;
+assert_checkequal(clean(tc-c), 0/%s);
 
 // Error messages
 errmsg1=msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "conj", 1);
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/imag.dia.ref b/scilab/modules/elementary_functions/tests/unit_tests/imag.dia.ref
new file mode 100644 (file)
index 0000000..267bc72
--- /dev/null
@@ -0,0 +1,49 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// Unit test for imag
+assert_checkequal(imag([]),[]);
+// with scalar real numbers
+assert_checkequal(imag(%pi),0);
+assert_checkequal(imag(%inf),0);
+assert_checkequal(imag(-%inf),0);
+assert_checkequal(imag(%nan),0);
+assert_checkequal(imag(-%nan),0);
+// with scalar complex numbers
+c = complex(1, 1);       assert_checkequal(imag(c),1);
+c = complex(1, 0);       assert_checkequal(imag(c),0);
+c = complex(1, -10);     assert_checkequal(imag(c),-10);
+c = complex(1, %inf);    assert_checkequal(imag(c),%inf);
+c = complex(-%inf, %inf); assert_checkequal(imag(c),%inf);
+c = complex(0, -%inf);   assert_checkequal(imag(c),-%inf);
+c = complex(%nan, %pi);  assert_checkequal(imag(c),%pi);
+c = complex(%nan, %nan); assert_checkequal(imag(c),%nan);
+// With hypermatrix of complex numbers
+r = rand(3,4,2);
+c = complex(-r,r); assert_checkequal(imag(c),r);
+r(2,2,2) = %nan;
+r(3,1,1) = %inf;
+r(2,4,2) = -%inf;
+c = complex(-r, r); assert_checkequal(imag(c),r);
+// With a sparse complex matrix
+r = sprand(100,100,0.001);
+i = sqrt(r);
+s = r+i*%i;
+assert_checkequal(imag(s),i);
+// With a scalar polynomial
+r = rand(1, 10) - 0.5;
+p = poly(r, "x", "coeff");
+assert_checkequal(imag(p), 0*%z);
+pc = poly(complex(r,-r), "x", "coeff");
+assert_checkequal(imag(pc), -p);
+// With a matrix of real and complex polynomials
+pc = [p, pc ; -p-%i, -pc+%i];
+assert_checkequal(imag(pc),[0, -p; -1, 1+p]);
+// With a matrix of rationals
+r = [(1-%z)^2 / %z - %i , (%z + %i)/(1+%z)];
+assert_checkequal(imag(r),[-1/1+0*%z 1/(1+%z)]);
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/imag.tst b/scilab/modules/elementary_functions/tests/unit_tests/imag.tst
new file mode 100644 (file)
index 0000000..267bc72
--- /dev/null
@@ -0,0 +1,49 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// Unit test for imag
+assert_checkequal(imag([]),[]);
+// with scalar real numbers
+assert_checkequal(imag(%pi),0);
+assert_checkequal(imag(%inf),0);
+assert_checkequal(imag(-%inf),0);
+assert_checkequal(imag(%nan),0);
+assert_checkequal(imag(-%nan),0);
+// with scalar complex numbers
+c = complex(1, 1);       assert_checkequal(imag(c),1);
+c = complex(1, 0);       assert_checkequal(imag(c),0);
+c = complex(1, -10);     assert_checkequal(imag(c),-10);
+c = complex(1, %inf);    assert_checkequal(imag(c),%inf);
+c = complex(-%inf, %inf); assert_checkequal(imag(c),%inf);
+c = complex(0, -%inf);   assert_checkequal(imag(c),-%inf);
+c = complex(%nan, %pi);  assert_checkequal(imag(c),%pi);
+c = complex(%nan, %nan); assert_checkequal(imag(c),%nan);
+// With hypermatrix of complex numbers
+r = rand(3,4,2);
+c = complex(-r,r); assert_checkequal(imag(c),r);
+r(2,2,2) = %nan;
+r(3,1,1) = %inf;
+r(2,4,2) = -%inf;
+c = complex(-r, r); assert_checkequal(imag(c),r);
+// With a sparse complex matrix
+r = sprand(100,100,0.001);
+i = sqrt(r);
+s = r+i*%i;
+assert_checkequal(imag(s),i);
+// With a scalar polynomial
+r = rand(1, 10) - 0.5;
+p = poly(r, "x", "coeff");
+assert_checkequal(imag(p), 0*%z);
+pc = poly(complex(r,-r), "x", "coeff");
+assert_checkequal(imag(pc), -p);
+// With a matrix of real and complex polynomials
+pc = [p, pc ; -p-%i, -pc+%i];
+assert_checkequal(imag(pc),[0, -p; -1, 1+p]);
+// With a matrix of rationals
+r = [(1-%z)^2 / %z - %i , (%z + %i)/(1+%z)];
+assert_checkequal(imag(r),[-1/1+0*%z 1/(1+%z)]);
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/real.dia.ref b/scilab/modules/elementary_functions/tests/unit_tests/real.dia.ref
new file mode 100644 (file)
index 0000000..8c19995
--- /dev/null
@@ -0,0 +1,49 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// Unit test for real
+assert_checkequal(real([]),[]);
+// with scalar real numbers
+assert_checkequal(real(%pi),%pi);
+assert_checkequal(real(%inf),%inf);
+assert_checkequal(real(-%inf),-%inf);
+assert_checkequal(real(%nan),%nan);
+assert_checkequal(real(-%nan),%nan);
+// with scalar complex numbers
+c = complex(0, 1);       assert_checkequal(real(c),0);
+c = complex(1, 1);       assert_checkequal(real(c),1);
+c = complex(-10, -1);    assert_checkequal(real(c),-10);
+c = complex(%inf, 1);    assert_checkequal(real(c),%inf);
+c = complex(%inf, -%inf); assert_checkequal(real(c),%inf);
+c = complex(-%inf, 0);   assert_checkequal(real(c),-%inf);
+c = complex(%pi, %nan);  assert_checkequal(real(c),%pi);
+c = complex(%nan, %nan); assert_checkequal(real(c),%nan);
+// With hypermatrix of complex numbers
+r = rand(3,4,2);
+c = complex(-r,r); assert_checkequal(real(c), -r);
+r(2,2,2) = %nan;
+r(3,1,1) = %inf;
+r(2,4,2) = -%inf;
+c = complex(-r, r); assert_checkequal(real(c), -r);
+// With a sparse complex matrix
+r = sprand(100,100,0.001);
+i = sqrt(r);
+s = r+i*%i;
+assert_checkequal(real(s), r);
+// With a scalar polynomial
+r = rand(1, 10) - 0.5;
+p = poly(r, "x", "coeff");
+assert_checkequal(real(p), p);
+pc = poly(complex(r,-r), "x", "coeff");
+assert_checkequal(real(pc), p);
+// With a matrix of real and complex polynomials
+pc = [p, pc ; -p-%i, -pc+%i];
+assert_checkequal(real(pc),[p, p; -p, -p]);
+// With a matrix of rationals
+r = [(1-%z)^2 / %z - %i , (%z + %i)/(1+%z)];
+assert_checkequal(real(r),[(1-%z)^2 / %z , %z/(1+%z)]);
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/real.tst b/scilab/modules/elementary_functions/tests/unit_tests/real.tst
new file mode 100644 (file)
index 0000000..8c19995
--- /dev/null
@@ -0,0 +1,49 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Samuel GOUGEON
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// Unit test for real
+assert_checkequal(real([]),[]);
+// with scalar real numbers
+assert_checkequal(real(%pi),%pi);
+assert_checkequal(real(%inf),%inf);
+assert_checkequal(real(-%inf),-%inf);
+assert_checkequal(real(%nan),%nan);
+assert_checkequal(real(-%nan),%nan);
+// with scalar complex numbers
+c = complex(0, 1);       assert_checkequal(real(c),0);
+c = complex(1, 1);       assert_checkequal(real(c),1);
+c = complex(-10, -1);    assert_checkequal(real(c),-10);
+c = complex(%inf, 1);    assert_checkequal(real(c),%inf);
+c = complex(%inf, -%inf); assert_checkequal(real(c),%inf);
+c = complex(-%inf, 0);   assert_checkequal(real(c),-%inf);
+c = complex(%pi, %nan);  assert_checkequal(real(c),%pi);
+c = complex(%nan, %nan); assert_checkequal(real(c),%nan);
+// With hypermatrix of complex numbers
+r = rand(3,4,2);
+c = complex(-r,r); assert_checkequal(real(c), -r);
+r(2,2,2) = %nan;
+r(3,1,1) = %inf;
+r(2,4,2) = -%inf;
+c = complex(-r, r); assert_checkequal(real(c), -r);
+// With a sparse complex matrix
+r = sprand(100,100,0.001);
+i = sqrt(r);
+s = r+i*%i;
+assert_checkequal(real(s), r);
+// With a scalar polynomial
+r = rand(1, 10) - 0.5;
+p = poly(r, "x", "coeff");
+assert_checkequal(real(p), p);
+pc = poly(complex(r,-r), "x", "coeff");
+assert_checkequal(real(pc), p);
+// With a matrix of real and complex polynomials
+pc = [p, pc ; -p-%i, -pc+%i];
+assert_checkequal(real(pc),[p, p; -p, -p]);
+// With a matrix of rationals
+r = [(1-%z)^2 / %z - %i , (%z + %i)/(1+%z)];
+assert_checkequal(real(r),[(1-%z)^2 / %z , %z/(1+%z)]);
index df3a95e..ce6a410 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%r_a_s(f,m)
+function f = %r_a_s(f,m)
     //f = f+m,
     //f: transfer matrix, m : scalar or scalar matrix
     //author Serge Steer INRIA
     //!
-    [num,den]=f(["num","den"])
-    szf=size(den)
-    szm=size(m)
+    [num,den] = f(["num","den"])
+    szf = size(den)
+    szm = size(m)
 
     if isempty(m)
         f = [];
         return
     end
 
-    if and(szf>=0)&and(szm>=0) then
-        if prod(szf)==1&prod(szm)>1 then
-            den=den(ones(m))
-            szf=szm
+    if and(szf>=0) & and(szm>=0) then
+        if prod(szf)==1 & prod(szm)>1 then
+            den = den(ones(m))
+            szf = szm
         end
-
         if size(szf,"*")>2 then
-            num=num(:);den=den(:);m=m(:)
+            num = num(:);
+            den = den(:);
+            m = m(:)
         end
-        [num,den]=simp(num+m.*den,den)
-        num=matrix(num,szf)
-        den=matrix(den,szf)
+        [num,den] = simp(num+m.*den, den)
+        num = matrix(num,szf)
+        den = matrix(den,szf)
     else
         //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
+        if size(szf,"*")>2 | size(szm,"*")>2 then
             error(8)
         end
-        if or(szf<0)&or(szm<0) then
-            [num,den]=simp(num+m.*den,den)
+        if or(szf<0) & or(szm<0) then
+            [num,den] = simp(num+m.*den,den)
         elseif or(szf<0) then
-            [num,den]=simp(num+m.*den,den*ones(m))
+            [num,den] = simp(num+m.*den,den*ones(m))
         elseif or(szm<0) then
-            [num,den]=simp(num+(m+0)*eye(den).*den,den)
+            [num,den] = simp(num+(m+0)*eye(den).*den,den)
         end
     end
-    f=rlist(num,den,f.dt)
+    f = rlist(num, den,f.dt)
 endfunction
diff --git a/scilab/modules/overloading/macros/%r_conj.sci b/scilab/modules/overloading/macros/%r_conj.sci
new file mode 100644 (file)
index 0000000..328f66c
--- /dev/null
@@ -0,0 +1,15 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2016 - Samuel GOUGEON
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+
+function rr = %r_conj(R)
+    rr = real(R) - %i*imag(R)
+endfunction
index 8d99510..588517a 100644 (file)
@@ -1,6 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-//
+// Copyright (C) 2016 - Samuel GOUGEON
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function r=%r_d_s(r,m)
-    // r=r./m
-    //!
-
-    if size(m,"*")==0 then r=[],return,end
-    r=rlist(r.num./m,r.den.*ones(m),r.dt)
+function r = %r_d_s(r, m)
+    // r = r./m
+    if size(m,"*")==0 then
+        r = []
+    else
+       if isfield(r, "dt")
+           r3 = r.dt
+       else
+           r3 = []
+       end
+       r = rlist(r.num ./ m, r.den.*ones(m), r3)
+    end
 endfunction
diff --git a/scilab/modules/overloading/macros/%r_imag.sci b/scilab/modules/overloading/macros/%r_imag.sci
new file mode 100644 (file)
index 0000000..89c1bf9
--- /dev/null
@@ -0,0 +1,17 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2016 - Samuel GOUGEON
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+
+function rr = %r_imag(R)
+  n = R(2)
+  d = R(3)
+  rr = imag(n.*conj(d))./(d.*conj(d))
+endfunction
diff --git a/scilab/modules/overloading/macros/%r_real.sci b/scilab/modules/overloading/macros/%r_real.sci
new file mode 100644 (file)
index 0000000..32fbcc2
--- /dev/null
@@ -0,0 +1,17 @@
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2016 - Samuel GOUGEON
+// Copyright (C) 2012 - 2016 - Scilab Enterprises
+//
+// This file is hereby licensed under the terms of the GNU GPL v2.0,
+// pursuant to article 5.3.4 of the CeCILL v.2.1.
+// This file was originally licensed under the terms of the CeCILL v2.1,
+// and continues to be available under such terms.
+// For more information, see the COPYING file which you should have received
+// along with this program.
+
+function rr = %r_real(R)
+  n = R(2)
+  d = R(3)
+  rr = real(n.*conj(d))./(d.*conj(d))
+endfunction
index 8db50d9..f570272 100644 (file)
@@ -1,6 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-//
+// Copyright (C) 2016 - Samuel GOUGEON
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%r_s_s(f,m)
-    //f = f-m,
-    //f: transfer matrix, m : scalar or scalar matrix
-    //author Serge Steer INRIA
-    //!
-    [num,den]=f(["num","den"])
-    szf=size(den)
-    szm=size(m)
-
-    if and(szf>=0)&and(szm>=0) then
-        if prod(szf)==1&prod(szm)>1 then
-            den=den(ones(m))
-            szf=szm
-        end
-
-        if size(szf,"*")>2 then
-            num=num(:);den=den(:);m=m(:)
-        end
-        [num,den]=simp(num-m.*den,den)
-        num=matrix(num,szf)
-        den=matrix(den,szf)
-    else
-        //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(9)
-        end
-        if or(szf<0)&or(szm<0) then
-            [num,den]=simp(num-m.*den,den)
-        elseif or(szf<0) then
-            [num,den]=simp(num-m.*den,den*ones(m))
-        elseif or(szm<0) then
-            [num,den]=simp(num-(m+0)*eye(den).*den,den)
-        end
-    end
-    f=rlist(num,den,f.dt)
+function f = %r_s_s(f,m)
+    f = f + (-m)
+    // see %r_a_s
 endfunction
index f626d44..a9dbd72 100644 (file)
@@ -1,6 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-// Copyright (C) Samuel GOUGEON - 2015 - sgougeon@free.fr : Bug 13893
+// Copyright (C) Samuel GOUGEON - 2015-2016 - sgougeon@free.fr : Bug 13893
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function h = %r_simp(h)
+function h = %r_simp(h, d)
     // implement complex case
     // 0/den => 0/1
-    n = numer(h)
-    d = denom(h)
+    if argn(2)==1 then
+        n = numer(h)
+        d = denom(h)
+    else
+        n = h
+        h = []
+    end
     i = find(clean(n)==0 & clean(d)~=0)
     [n, d] = simp(n, d);
     d(i) = 1
index ac08059..89aa9a3 100644 (file)
@@ -1,6 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-//
+// Copyright (C) 2016 - Samuel GOUGEON
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
@@ -9,43 +9,8 @@
 // and continues to be available under such terms.
 // For more information, see the COPYING file which you should have received
 // along with this program.
-function f=%s_a_r(m,f)
-    //f=  m+f
-    // author Serge Steer, INRIA
-    //!
-    [num,den]=f(["num","den"])
-    szf=size(den)
-    szm=size(m)
-
-    if isempty(m)
-        f = [];
-        return;
-    end
-    if and(szf>=0)&and(szm>=0) then
-        if prod(szf)==1&prod(szm)>1 then
-            den=den(ones(m))
-            szf=szm
-        end
 
-        if size(szf,"*")>2 then
-            num=num(:);den=den(:);m=m(:)
-        end
-        [num,den]=simp(num+m.*den,den)
-        num=matrix(num,szf)
-        den=matrix(den,szf)
-    else
-        //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(8)
-        end
-        if or(szf<0)&or(szm<0) then
-            [num,den]=simp(num+m.*den,den)
-        elseif or(szf<0) then
-            [num,den]=simp(num+m.*den,den*ones(m))
-        elseif or(szm<0) then
-            [num,den]=simp(num+(m+0)*eye(den).*den,den)
-        end
-    end
-    f=rlist(num,den,f.dt)
+function f = %s_a_r(m, f)
+    f = f + m
+    // see %r_a_s
 endfunction
-
index 648022a..a4082e0 100644 (file)
 // For more information, see the COPYING file which you should have received
 // along with this program.
 
-function f=%s_d_r(n1,f2)
-    // n1./f2
-    //!
-
-    if size(n1,"*")==0 then f=[],return,end
-    f=rlist(n1.*f2("den"),ones(n1).*f2("num"),f2("dt"))
+function f = %s_d_r(n1, f2)
+    // n1 ./ f2
+    if size(n1,"*")==0 then
+        f = []
+    else
+       if isfield(f2, "dt")
+           r3 = f2.dt
+       else
+           r3 = []
+       end
+        f = rlist(n1.*f2("den"), ones(n1).*f2("num"), r3)
+    end
 endfunction
index 29ff043..71e5952 100644 (file)
@@ -1,6 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
-//
+// Copyright (C) 2016 - Samuel GOUGEON
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
@@ -9,39 +9,8 @@
 // and continues to be available under such terms.
 // For more information, see the COPYING file which you should have received
 // along with this program.
-function f=%s_s_r(m,f)
-    //f=  m-f
-    //author Serge Steer INRIA
-    //!
-    [num,den]=f(["num","den"])
-    szf=size(den)
-    szm=size(m)
-
-    if and(szf>=0)&and(szm>=0) then
-        if prod(szf)==1&prod(szm)>1 then
-            den=den(ones(m))
-            szf=szm
-        end
 
-        if size(szf,"*")>2 then
-            num=num(:);den=den(:);m=m(:)
-        end
-        [num,den]=simp(-num+m.*den,den)
-        num=matrix(num,szf)
-        den=matrix(den,szf)
-    else
-        //at leat one matrix is eye*x
-        if size(szf,"*")>2|size(szm,"*")>2 then
-            error(9)
-        end
-        if or(szf<0)&or(szm<0) then
-            [num,den]=simp(-num+m.*den,den)
-        elseif or(szf<0) then
-            [num,den]=simp(-num+m.*den,den*ones(m))
-        elseif or(szm<0) then
-            [num,den]=simp(-num+(m+0)*eye(den).*den,den)
-        end
-    end
-    f=rlist(num,den,f.dt)
+function f = %s_s_r(m, f)
+    f = (-f) + m
+    // see %r_a_s
 endfunction
-