* Bug 10078 fixed: isinf(polynomials) was not reliable
[scilab.git] / scilab / modules / elementary_functions / help / en_US / floating_point / isinf.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  * Copyright (C) 2016 - Samuel GOUGEON
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
18           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19           xmlns:scilab="http://www.scilab.org" xml:id="isinf" xml:lang="en">
20     <refnamediv>
21         <refname>isinf</refname>
22         <refpurpose>tests for infinite elements</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Syntax</title>
26         <synopsis>
27             r = isinf(x)
28         </synopsis>
29     </refsynopsisdiv>
30     <refsection>
31         <title>Arguments</title>
32         <variablelist>
33             <varlistentry>
34                 <term>x</term>
35                 <listitem>
36                     <para>
37                         matrix of real or complex numbers, or of polynomials with real or complex
38                         coefficients.
39                     </para>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>r</term>
44                 <listitem>
45                     <para>
46                         matrix of booleans of the same size as <varname>x</varname>.
47                     </para>
48                 </listitem>
49             </varlistentry>
50         </variablelist>
51     </refsection>
52     <refsection>
53         <title>Description</title>
54         <para>
55             <emphasis>
56                 <varname>x</varname> are real or complex numbers:
57             </emphasis>
58             <literal>r = isinf(x)</literal> returns the matrix <varname>r</varname>
59             of booleans such that <literal>r(i)</literal> is <literal>%T</literal>
60             if <literal>abs(x(i))</literal> is infinite, and <literal>%F</literal> otherwise.
61         </para>
62         <para>
63             <emphasis>
64                 <varname>x</varname> are polynomials with real or complex coefficients:
65             </emphasis>
66             Then after <literal>r = isinf(x)</literal>, <literal>r(i)</literal> is <literal>%T</literal>
67             if at least one of the <literal>x(i)</literal> coefficients is infinite,
68             and <literal>%F</literal> otherwise.
69         </para>
70     </refsection>
71     <refsection>
72         <title>Examples</title>
73         <programlisting role="example"><![CDATA[
74 [i, inf, nan] = (%i, %inf, %nan);
75 isinf([-1  0.01 -inf  inf  nan])
76 isinf([2+i, -10-inf, inf+i])
77 isinf([nan-i, nan+i*inf])
78 isinf(inf-nan*i)
79  ]]></programlisting>
80         <screen><![CDATA[
81 --> isinf([-1  0.01 -inf  inf  nan])
82  ans  =
83   F F T T F
84
85 --> isinf([2+i, -10-inf, inf+i])
86  ans  =
87   F T T
88
89 --> isinf([nan-i, nan+i*inf])
90  ans  =
91   F T
92
93 --> isinf(inf-nan*i)
94  ans  =
95   F
96 ]]></screen>
97         Please note that <literal>%inf-%nan*%i</literal> is computed as
98         <literal>%inf - %nan*complex(0,1) == %inf - complex(%nan*0, %nan*1) == %inf - complex(%nan, %nan)
99             == complex(%inf-%nan, -%nan) == complex(%nan, %nan)
100         </literal>
101         ,where Inf is eaten by Nan
102         and no longer appears.
103         <para/>
104         <para>
105             With polynomials :
106         </para>
107         <programlisting role="example"><![CDATA[
108 p = poly([%nan -2 0 3],"x","coeff")
109 q = poly([0 %inf %i],"x","coeff")
110 r = poly([%nan %inf*%i 1],"x","coeff")
111 isinf([p q r])
112  ]]></programlisting>
113         <screen><![CDATA[
114 --> p = poly([%nan -2 0 3],"x","coeff")
115  p  =
116
117   Nan -2x +3x³
118
119 --> q = poly([0 %inf %i],"x","coeff")
120  q  =
121
122   Infx +ix²
123
124 --> r = poly([%nan %inf*%i 1],"x","coeff")
125  r  =
126
127   Nan -(Nan-Infi)x +x²
128
129 --> isinf([p q r])
130  ans  =
131
132   F T F
133 ]]></screen>
134     </refsection>
135     <refsection role="see also">
136         <title>See also</title>
137         <simplelist type="inline">
138             <member>
139                 <link linkend="percentinf">percentinf</link>
140             </member>
141             <member>
142                 <link linkend="isnan">isnan</link>
143             </member>
144             <member>
145                 <link linkend="isreal">isreal</link>
146             </member>
147             <member>
148                 <link linkend="isnum">isnum</link>
149             </member>
150             <member>
151                 <link linkend="type">type</link>
152             </member>
153         </simplelist>
154     </refsection>
155     <refsection role="history">
156         <title>History</title>
157         <revhistory>
158             <revision>
159                 <revnumber>6.1.0</revnumber>
160                 <revdescription>
161                     Extension to polynomials.
162                 </revdescription>
163             </revision>
164         </revhistory>
165     </refsection>
166 </refentry>