<?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
 *
 * 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="feval" xml:lang="en">
    <refnamediv>
        <refname>feval</refname>
        <refpurpose>multiple evaluation</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>[z]=feval(x,y,f)
            [z]=feval(x,f)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>x,y</term>
                <listitem>
                    <para>two vectors</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>f</term>
                <listitem>
                    <para>a function or a character string (for Fortran or C call)</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>Multiple evaluation of a function for one or two arguments of vector
            type :
        </para>
        <variablelist>
            <varlistentry>
                <term>z=feval(x,f)</term>
                <listitem>
                    <para>
                        returns the vector <literal>z</literal> defined by
                        <literal>z(i)=f(x(i))</literal>
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>z=feval(x,y,f)</term>
                <listitem>
                    <para>
                        returns the matrix <literal>z</literal> such as
                        <literal>z(i,j)=f(x(i),y(j))</literal>
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
        <para>
            <literal>f</literal> is an <link linkend="external">external</link>
            (function or routine) accepting on one or two arguments which are supposed to be real. The
            result returned  by <literal>f</literal> can be real or complex. In case of a Fortran call,
            the function <literal>f</literal> must be defined in the subroutine
            <literal>fevaltable.c</literal> (in directory
            <literal>SCI/modules/differential_equations/src/c</literal>).
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
deff('[z]=f(x,y)','z=x^2+y^2');
feval(1:10,1:5,f)
deff('[z]=f(x,y)','z=x+%i*y');
feval(1:10,1:5,f)
feval(1:10,1:5,'parab')   //See ffeval.f file
feval(1:10,'parab')
// For dynamic link (see example ftest in ffeval.f)
// you can use the link command (the parameters depend on the machine):
// unix('make ftest.o');link('ftest.o','ftest'); feval(1:10,1:5,'ftest')
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="evstr">evstr</link>
            </member>
            <member>
                <link linkend="horner">horner</link>
            </member>
            <member>
                <link linkend="execstr">execstr</link>
            </member>
            <member>
                <link linkend="external">external</link>
            </member>
            <member>
                <link linkend="link">link</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
