* Bug 16620 fixed: polyint() introduced
[scilab.git] / scilab / modules / polynomials / help / en_US / polyint.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) 2020 - Samuel GOUGEON - Le Mans Université
5  *
6  * This file is hereby licensed under the terms of the GNU GPL v2.0,
7  * pursuant to article 5.3.4 of the CeCILL v.2.1.
8  * This file was originally licensed under the terms of the CeCILL v2.1,
9  * and continues to be available under such terms.
10  * For more information, see the COPYING file which you should have received
11  * along with this program.
12  *
13  -->
14 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
15           xmlns:svg="http://www.w3.org/2000/svg" xmlns:db="http://docbook.org/ns/docbook"
16           xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="polyint">
17     <refnamediv>
18         <refname>polyint</refname>
19         <refpurpose>
20             Polynomial integration
21         </refpurpose>
22     </refnamediv>
23     <refsynopsisdiv>
24         <title>Syntax</title>
25         <synopsis>
26             polyint  // example
27             Q = polyint(P)
28             Q = polyint(P, Const)
29         </synopsis>
30     </refsynopsisdiv>
31     <refsection>
32         <title>Arguments</title>
33         <variablelist>
34             <varlistentry>
35                 <term>P, Q</term>
36                 <listitem>
37                     arrays (from scalars to hypermatrices) of polynomials with real or complex
38                     coefficients, of same size.
39                     <para/>
40                 </listitem>
41             </varlistentry>
42             <varlistentry>
43                 <term>Const</term>
44                 <listitem>
45                     Set of real or complex constants of integration.
46                     <literal>length(Const)</literal> sets the number of consecutive integrations
47                     to perform. By default, 0 is used.
48                     <varname>Const</varname> can be one of the following:
49                     <itemizedlist>
50                         <listitem>
51                             a scalar: then only the first antiderivatives are computed, and all use
52                             the same <varname>Const</varname> value.
53                         </listitem>
54                         <listitem>
55                             an array of size size(P): then only the first antiderivatives are computed,
56                             with the respective <literal>Const(i)</literal> for <literal>Q(i)</literal>.
57                         </listitem>
58                         <listitem>
59                             a list that can mix scalars, arrays of size size(P), or undefined elements.
60                             Then <literal>Const(i)</literal> is used for the i<superscript>th</superscript>
61                             antiderivatives. Undefined elements are equivalent to 0.
62                         </listitem>
63                     </itemizedlist>
64                     <para/>
65                 </listitem>
66             </varlistentry>
67         </variablelist>
68     </refsection>
69     <refsection>
70         <title>Description</title>
71         <para>
72             polyint(..) computes the first or any n<superscript>th</superscript> antiderivative
73             of each polynomial of the input array.
74         </para>
75     </refsection>
76     <refsection>
77         <title>Examples</title>
78         <para>
79             Single integration (first order):
80         </para>
81         <programlisting role="example"><![CDATA[
82 s = %s;
83 P = [-2, s ; s^2-3, s-2*s^3]
84 polyint(P)
85 polyint(P, 1)
86 polyint(P, [1 2 ; 3 4])
87      ]]></programlisting>
88         <screen><![CDATA[
89 --> P = [-2, s ; s^2-3, s-2*s^3]
90  P  =
91   -2      s
92   -3 +s²  s -2s³
93
94 --> polyint(P)
95  ans  =
96   -2s               0.5s²
97   -3s +0.3333333s³  0.5s² -0.5s⁴
98
99 --> polyint(P, 1)
100  ans  =
101   1 -2s               1 +0.5s²
102   1 -3s +0.3333333s³  1 +0.5s² -0.5s⁴
103
104 --> polyint(P, [1 2 ; 3 4])
105  ans  =
106   1 -2s               2 +0.5s²
107   3 -3s +0.3333333s³  4 +0.5s² -0.5s⁴
108 ]]></screen>
109         <para/>
110         <para>
111             Multiple integrations:
112         </para>
113         <programlisting role="example"><![CDATA[
114 s = %s;
115 polyint(1-3*s, list(-1,1))
116 P = [3 ; 1-s ; 6*s^2-2]
117 polyint(P, list(2, [-2 1 0]))
118 polyint(P, list(, [-2 1 0]))
119
120 k = list(); k(5) = 0;
121 polyint(1+0*s, k)
122 1 / factorial(5)
123      ]]></programlisting>
124         <screen><![CDATA[
125 --> polyint(1-3*s, list(-1,1))
126  ans  =
127   1 -s +0.5s² -0.5s³
128
129 --> P = [3 ; 1-s ; 6*s^2-2]
130  P  =
131   3
132   1 -s
133   -2 +6s²
134
135 --> polyint(P, list(2, [-2 1 0]))
136  ans  =
137   -2 +2s +1.5s²
138   1 +2s +0.5s² -0.1666667s³
139   2s -s² +0.5s⁴
140
141 --> polyint(P, list(, [-2 1 0]))
142  ans  =
143   -2 +1.5s²
144   1 +0.5s² -0.1666667s³
145   -s² +0.5s⁴
146
147
148 --> k = list(); k(5) = 0;
149 --> polyint(1+0*s, k)
150  ans  =
151   0.0083333s⁵
152
153 --> 1 / factorial(5)
154  ans  =
155    0.0083333
156 ]]></screen>
157     </refsection>
158     <refsection role="see also">
159         <title>See also</title>
160         <simplelist type="inline">
161             <member>
162                 <link linkend="derivat">derivat</link>
163             </member>
164         </simplelist>
165     </refsection>
166     <refsection role="history">
167         <title>History</title>
168         <revhistory>
169             <revision>
170                 <revnumber>6.1.1</revnumber>
171                 <revdescription>
172                     polyint() introduced.
173                 </revdescription>
174             </revision>
175         </revhistory>
176     </refsection>
177 </refentry>