<?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) 2020 - 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: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="integrate" xml:lang="ja">
    <refnamediv>
        <refname>integrate</refname>
        <refpurpose>求積法による式の積分</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>呼び出し手順</title>
        <synopsis>
          y = integrate(expr, v, x0, x1)
          y = integrate(expr, v, x0, x1, atol)
          y = integrate(expr, v, x0, x1, atol, rtol)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>引数</title>
        <variablelist>
            <varlistentry>
                <term>expr</term>
                <listitem>
                    文字列, Scilab 式を定義
                    <para/>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>v</term>
                <listitem>
                    文字列, 積分変数名
                    <para/>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>x0</term>
                <listitem>
                    実数, 積分区間の下限
                    <para/>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>x1</term>
                <listitem>
                    実数のベクトル, 積分区間の上限
                    <para/>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>atol</term>
                <listitem>
                    実数 (絶対許容誤差) デフォルト値: 1e-13
                    <para/>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>rtol</term>
                <listitem>
                    実数, (相対許容誤差) デフォルト値: 1e-8
                    <para/>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>y</term>
                <listitem>
                    実数のベクトル, 各<literal>x1(i)</literal>に関する積分値.
                    <para/>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>説明</title>
        <para>
            以下を計算します
            <latex alt="y(i) = integral_{x_0}^{x_1(i)} f(v).dv">
                y(i) = \int_{x_0}^{x_1(i)} f(v)\,dv
            </latex>
            for <literal>i=1:size(x1,'*')</literal>, ただし <emphasis>f(v)</emphasis>
            は式 <literal>expr</literal>で指定されます.
        </para>
        <para>
            この処理は以下の精度指標を満足することが期待されます:
            <literal>abs(I-y) &lt;= max(atol, rtol*abs(I))</literal> ただし
            <literal>I</literal>はこの積分の真値を意味します.
        </para>
        <para>
            <warning>
                制約: 式を指定する際に <literal>%</literal>から始まる変数名を使用することはできません.
            </warning>
        </para>
    </refsection>
    <refsection>
        <title>例</title>
        <programlisting role="example"><![CDATA[
x1 = 0:0.1:2*%pi;
Y = integrate('sin(x)', 'x', 0, x1);
norm(cos(x1)-(1-Y))

x1 = -10:0.1:10;
Y = integrate(['if x==0 then 1,';
               'else sin(x)/x,end'], 'x', 0, x1)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>参照</title>
        <simplelist type="inline">
            <member>
                <link linkend="intg">intg</link>
            </member>
            <member>
                <link linkend="inttrap">inttrap</link>
            </member>
            <member>
                <link linkend="intsplin">intsplin</link>
            </member>
            <member>
                <link linkend="ode">ode</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>履歴</title>
        <revhistory>
            <revision>
                <revnumber>6.1.0</revnumber>
                <revdescription>
                    Default atol value increased from
                    10<superscript>-14</superscript> to 10<superscript>-13</superscript>.
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>