* Bug #5694 fixed - numdiff help page fixed
[scilab.git] / scilab / modules / differential_equations / help / en_US / diff.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  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <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="en">
14     <refnamediv>
15         <refname>diff</refname>
16         <refpurpose>Difference and discrete derivative</refpurpose>
17     </refnamediv>
18     <refsynopsisdiv>
19         <title>Calling Sequence</title>
20         <synopsis>y=diff(x)
21             y=diff(x [,n [,dim]])
22         </synopsis>
23     </refsynopsisdiv>
24     <refsection>
25         <title>Arguments</title>
26         <variablelist>
27             <varlistentry>
28                 <term>x</term>
29                 <listitem>
30                     <para>vector or matrix (real, complex, sparse or polynomial)</para>
31                 </listitem>
32             </varlistentry>
33             <varlistentry>
34                 <term>n</term>
35                 <listitem>
36                     <para>integer the order of differentiation</para>
37                 </listitem>
38             </varlistentry>
39             <varlistentry>
40                 <term>dim</term>
41                 <listitem>
42                     <para>integer or character string with values "r","c" and "*"</para>
43                 </listitem>
44             </varlistentry>
45             <varlistentry>
46                 <term>y</term>
47                 <listitem>
48                     <para>scalar or vector/matrix</para>
49                 </listitem>
50             </varlistentry>
51         </variablelist>
52     </refsection>
53     <refsection>
54         <title>Description</title>
55         <para>
56             <literal>y=diff(x)</literal> compute the difference function
57             <literal>y=x(2:$)-x(1:$-1)</literal>
58         </para>
59         <para>
60             <literal>diff(x,n,dim)</literal> is the <literal>n</literal>th
61             difference function along dimension <literal>dim</literal>.
62         </para>
63         <para>
64             <literal>diff(x,n,"*")</literal> is equivalent to
65             <literal>diff(x(:),n)</literal>.
66         </para>
67         <para>
68             Default value for <literal>n</literal> is 1. Default value for
69             <literal>dim</literal> is <literal>"*"</literal>.
70         </para>
71         <para>
72             <literal>dim='r'</literal> is equivalent to <literal>dim=1</literal>
73             and <literal>dim='c'</literal> is equivalent to
74             <literal>dim=2</literal>.
75         </para>
76     </refsection>
77     <refsection>
78         <title>Examples</title>
79         <programlisting role="example"><![CDATA[ 
80 v=(1:8)^3;
81 diff(v)
82 diff(v,3)
83
84 A=[(1:8)^2
85    (1:8)^3
86    (1:8)^4];
87
88 diff(A,3,2)
89
90 //approximate differentiation
91 step=0.001
92 t=0:step:10;
93 y=sin(t);
94 dy=diff(sin(t))/step; //approximate differentiation of sine function
95 norm(dy-cos(t(1:$-1)),%inf)
96  ]]></programlisting>
97     </refsection>
98     <refsection role="see also">
99         <title>See Also</title>
100         <simplelist type="inline">
101             <member>
102                 <link linkend="interp">interp</link>
103             </member>
104             <member>
105                 <link linkend="interp2d">interp2d</link>
106             </member>
107             <member>
108                 <link linkend="splin">splin</link>
109             </member>
110             <member>
111                 <link linkend="eval_cshep2d">eval_cshep2d</link>
112             </member>
113             <member>
114                 <link linkend="derivative">derivative</link>
115             </member>
116             <member>
117                 <link linkend="numdiff">numdiff</link>
118             </member>
119         </simplelist>
120     </refsection>
121     
122 </refentry>