<?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
 *
 * 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="diff" xml:lang="ja">

    <refnamediv>

        <refname>diff</refname>

        <refpurpose>差分および離散微分</refpurpose>

    </refnamediv>

    <refsynopsisdiv>

        <title>呼び出し手順</title>

        <synopsis>

            y=diff(x)

            y=diff(x [,n [,dim]])

        </synopsis>

    </refsynopsisdiv>

    <refsection>

        <title>引数</title>

        <variablelist>

            <varlistentry>

                <term>x</term>

                <listitem>

                    <para>ベクトルまたは行列 (実数, 複素数, 疎行列 または多項式)</para>

                </listitem>

            </varlistentry>

            <varlistentry>

                <term>n</term>

                <listitem>

                    <para>整数,差分の次数</para>

                </listitem>

            </varlistentry>

            <varlistentry>

                <term>dim</term>

                <listitem>

                    <para>整数または"r","c" および "*"を値とする文字列</para>

                </listitem>

            </varlistentry>

            <varlistentry>

                <term>y</term>

                <listitem>

                    <para>スカラーまたはベクトル</para>

                </listitem>

            </varlistentry>

        </variablelist>

    </refsection>

    <refsection>

        <title>説明</title>

        <para>

            <literal>y=diff(x)</literal> は差分関数

            y=x(2:$)-x(1:$-1)を計算します.

        </para>

        <para>

            <literal>diff(x,n,dim)</literal> は,

            次元<literal>dim</literal>方向の<literal>n</literal> 次

            差分関数です.

        </para>

        <para>

            <literal>diff(x,n,"*")</literal> は

            diff(x(:),n)と等価です.

        </para>

        <para>

            <literal>n</literal>のデフォルト値は 1です.

            <literal>dim</literal> のデフォルト値は <literal>"*"</literal>です.

        </para>

        <para>

            <literal>dim='r'</literal> は <literal>dim=1</literal>と

            等価で,

            <literal>dim='c'</literal> は

            <literal>dim=2</literal>と等価です.

        </para>

    </refsection>

    <refsection>

        <title>例</title>

        <programlisting role="example"><![CDATA[
v=(1:8)^3;
diff(v)
diff(v,3)
A=[(1:8)^2
   (1:8)^3
   (1:8)^4];
diff(A,3,2)
//approximate differentiation
step=0.001
t=0:step:10;
y=sin(t);
dy=diff(sin(t))/step; //approximate differentiation of sine function
norm(dy-cos(t(1:$-1)),%inf)
 ]]></programlisting>

    </refsection>

    <refsection role="see also">

        <title>参照</title>

        <simplelist type="inline">

            <member>

                <link linkend="interp">interp</link>

            </member>

            <member>

                <link linkend="interp2d">interp2d</link>

            </member>

            <member>

                <link linkend="splin">splin</link>

            </member>

            <member>

                <link linkend="eval_cshep2d">eval_cshep2d</link>

            </member>

            <member>

                <link linkend="numderivative">numderivative</link>

            </member>

        </simplelist>

    </refsection>

</refentry>

