<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 * Copyright (C) 2016 - 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.
 *
 -->
<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="isinf" xml:lang="en">
    <refnamediv>
        <refname>isinf</refname>
        <refpurpose>tests for infinite elements</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>
            r = isinf(x)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>
                        matrix of real or complex numbers, or of polynomials with real or complex
                        coefficients.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>r</term>
                <listitem>
                    <para>
                        matrix of booleans of the same size as <varname>x</varname>.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <emphasis>
                <varname>x</varname> are real or complex numbers:
            </emphasis>
            <literal>r = isinf(x)</literal> returns the matrix <varname>r</varname>
            of booleans such that <literal>r(i)</literal> is <literal>%T</literal>
            if <literal>abs(x(i))</literal> is infinite, and <literal>%F</literal> otherwise.
        </para>
        <para>
            <emphasis>
                <varname>x</varname> are polynomials with real or complex coefficients:
            </emphasis>
            Then after <literal>r = isinf(x)</literal>, <literal>r(i)</literal> is <literal>%T</literal>
            if at least one of the <literal>x(i)</literal> coefficients is infinite,
            and <literal>%F</literal> otherwise.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <para>
            With real and complex numbers:
        </para>
        <programlisting role="example"><![CDATA[
[i, inf, nan] = (%i, %inf, %nan);
isinf([-1  0.01 -inf  inf  nan])
isinf([2+i, -10-inf, inf+i])
isinf([nan-i, nan+i*inf])
isinf(inf-nan*i)
 ]]></programlisting>
        <screen><![CDATA[
--> isinf([-1  0.01 -inf  inf  nan])
 ans  =
  F F T T F

--> isinf([2+i, -10-inf, inf+i])
 ans  =
  F T T

--> isinf([nan-i, nan+i*inf])
 ans  =
  F T

--> isinf(inf-nan*i)
 ans  =
  F
]]></screen>
        Please note that <literal>%inf-%nan*%i</literal> is computed as
        <literal>%inf - %nan*complex(0,1) == %inf - complex(%nan*0, %nan*1) == %inf - complex(%nan, %nan)
            == complex(%inf-%nan, -%nan) == complex(%nan, %nan)
        </literal>
        , where Inf is eaten by Nan and no longer appears.
        <para/>
        <para>
            With polynomials :
        </para>
        <programlisting role="example"><![CDATA[
p = poly([%nan -2 0 3],"x","coeff")
q = poly([0 %inf %i],"x","coeff")
r = poly([%nan %inf*%i 1],"x","coeff")
isinf([p q r])
 ]]></programlisting>
        <screen><![CDATA[
--> p = poly([%nan -2 0 3],"x","coeff")
 p  =
  Nan -2x +3x³

--> q = poly([0 %inf %i],"x","coeff")
 q  =
  Infx +ix²

--> r = poly([%nan %inf*%i 1],"x","coeff")
 r  =
  Nan -(Nan-Infi)x +x²

--> isinf([p q r])
 ans  =
  F T F
]]></screen>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="percentinf">percentinf</link>
            </member>
            <member>
                <link linkend="isnan">isnan</link>
            </member>
            <member>
                <link linkend="isreal">isreal</link>
            </member>
            <member>
                <link linkend="isnum">isnum</link>
            </member>
            <member>
                <link linkend="type">type</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>6.1.0</revnumber>
                <revdescription>
                    Extension to polynomials.
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>
