* Bug 14741 fixed: [m,e]=log2(x) documented. frexp()=>internal
[scilab.git] / scilab / modules / elementary_functions / help / ru_RU / extraction.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <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="extraction" xml:lang="ru">
3     <refnamediv>
4         <refname>выделение</refname>
5         <refpurpose>выделение элемента матрицы или списка</refpurpose>
6     </refnamediv>
7     <refsynopsisdiv>
8         <title>Синтаксис</title>
9         <synopsis>
10             x(i)
11             x(i,j)
12             x(i,j,k,..)
13             [...]=l(i)
14             [...]=l(k1)...(kn)(i) or [...]=l(list(k1,...,kn,i))
15             l(k1)...(kn)(i,j) or l(list(k1,...,kn,list(i,j))
16         </synopsis>
17     </refsynopsisdiv>
18     <refsection>
19         <title>Аргументы</title>
20         <variablelist>
21             <varlistentry>
22                 <term>x</term>
23                 <listitem>
24                     <para>матрица любого типа</para>
25                 </listitem>
26             </varlistentry>
27             <varlistentry>
28                 <term>l</term>
29                 <listitem>
30                     <para>переменная-список</para>
31                 </listitem>
32             </varlistentry>
33             <varlistentry>
34                 <term>i,j, k</term>
35                 <listitem>
36                     <para>индексы</para>
37                 </listitem>
38             </varlistentry>
39             <varlistentry>
40                 <term>k1,...kn</term>
41                 <listitem>
42                     <para>индексы</para>
43                 </listitem>
44             </varlistentry>
45         </variablelist>
46     </refsection>
47     <refsection>
48         <title>Описание</title>
49         <variablelist>
50             <varlistentry>
51                 <term>В СЛУЧАЕ МАТРИЦЫ</term>
52                 <listitem>
53                     <para>
54                         <literal>i</literal>, <literal>j</literal>,
55                         <literal>k</literal>,.. могут быть:
56                     </para>
57                     <variablelist>
58                         <varlistentry>
59                             <term>
60                                 вещественным скаляром или вектором или матрицей с положительными элементами.
61                             </term>
62                             <listitem>
63                                 <itemizedlist>
64                                     <listitem>
65                                         <para>
66                                             <literal>r=x(i,j)</literal> формирует матрицу
67                                             <literal>r</literal> такую, что
68                                             <literal>r(l,k)=x(int(i(l)),int(j(k)))</literal> для
69                                             <literal>l</literal> от 1 до
70                                             <literal>size(i,'*')</literal> и <literal>k</literal>
71                                             от 1 до <literal>size(j,'*')</literal>.
72                                         </para>
73                                         <para>
74                                             Максимальное значение <literal>i</literal> (<literal>j</literal>) должно
75                                             быть меньше, либо равно <literal>size(x,1)</literal>
76                                             (<literal>size(x,2)</literal>).
77                                         </para>
78                                     </listitem>
79                                     <listitem>
80                                         <para>
81                                             <literal>r=x(i)</literal> с матрицей <literal>x</literal>
82                                             размером 1x1 формирует матрицу <literal>r</literal> такую, что
83                                             <literal>r(l,k)=x(int(i(l)),int(i(k)))</literal> для
84                                             <literal>l</literal> от 1 до
85                                             <literal>size(i,1)</literal> и <literal>k</literal> от
86                                             1 до <literal>size(i,2)</literal>.
87                                         </para>
88                                         <para>
89                                             Заметьте, что в этом случае индекс <literal>i</literal> корректен только
90                                             если все её элементы равны единице.
91                                         </para>
92                                     </listitem>
93                                     <listitem>
94                                         <para>
95                                             <literal>r=x(i)</literal> с вектор-столбцом <literal>x</literal>
96                                             формирует вектор-строку <literal>r</literal> такую, что
97                                             <literal>r(l)=x(int(i(l)))</literal> для
98                                             <literal>l</literal> от 1 до
99                                             <literal>size(i,'*')</literal>
100                                         </para>
101                                         <para>
102                                             Максимальное значение <literal>i</literal>
103                                             должно быть меньше, либо равно <literal>size(x,'*')</literal>.
104                                         </para>
105                                     </listitem>
106                                     <listitem>
107                                         <para>
108                                             <literal>r=x(i)</literal> с матрицей <literal>x</literal>
109                                             с одним или более столбцов формирует вектор-столбец
110                                             <literal>r</literal> такой, что <literal>r(l)</literal>
111                                             (<literal>l</literal> от 1 до
112                                             <literal>size(i,'*')</literal>) содержит
113                                             <literal>int(i(l))</literal>-тые элементы вектор-столбца, сформированного
114                                             конкатенацией столбцов матрицы <literal>x</literal>.
115                                         </para>
116                                         <para>
117                                             Максимальное значение <literal>i</literal> должно быть меньше или равно
118                                             <literal>size(x,'*')</literal>.
119                                         </para>
120                                     </listitem>
121                                 </itemizedlist>
122                             </listitem>
123                         </varlistentry>
124                         <varlistentry>
125                             <term>
126                                 символом "двоеточие" <literal> : </literal>
127                             </term>
128                             <listitem>
129                                 <para><literal/>
130                                     означает "все элементы".
131                                 </para>
132                                 <itemizedlist>
133                                     <listitem>
134                                         <para>
135                                             <literal>r=x(i,:)</literal> формирует матрицу <literal>r</literal> такую,
136                                             что <literal>r(l,k)=x(int(i(l)),k))</literal> для
137                                             <literal>l</literal> от 1 до
138                                             <literal>size(i,'*')</literal> и <literal>k</literal>
139                                             от 1 до <literal>size(x,2)</literal>.
140                                         </para>
141                                     </listitem>
142                                     <listitem>
143                                         <para>
144                                             <literal>r=x(:,j)</literal> формирует матрицу <literal>r</literal> такую,
145                                             что <literal>r(l,k)=x(l,int(j(k)))</literal> для
146                                             <literal>l</literal> от 1 до
147                                             <literal>size(r,1)</literal> и <literal>k</literal> от
148                                             1 до <literal>size(j,'*')</literal>.
149                                         </para>
150                                     </listitem>
151                                     <listitem>
152                                         <para>
153                                             <literal>r=x(:)</literal> формирует вектор-столбец <literal>r</literal>,
154                                             сформированный постолбцовой конкатенацией столбцов матрицы
155                                             <literal> x</literal>. Это эквивалентно инструкции
156                                             <literal>matrix(x,size(x,'*'),1)</literal>.
157                                         </para>
158                                     </listitem>
159                                 </itemizedlist>
160                             </listitem>
161                         </varlistentry>
162                         <varlistentry>
163                             <term>вектором логических значений</term>
164                             <listitem>
165                                 <para>
166                                     Если индекс (<literal>i</literal> или <literal>j</literal>) является
167                                     вектором логических значений, то он интерпретируется как
168                                     <literal>find(i)</literal> или, соответственно, <literal>find(j)</literal>.
169                                 </para>
170                             </listitem>
171                         </varlistentry>
172                         <varlistentry>
173                             <term>полиномом</term>
174                             <listitem>
175                                 <para>
176                                     Если индекс (<literal>i</literal> или <literal>j</literal>) является вектором
177                                     полиномов или подразумевается вектором полиномов, то он интерпретируется как
178                                     <literal>horner(i,m)</literal> или, соответственно,
179                                     <literal>horner(j,n)</literal> где <literal>m</literal> и
180                                     <literal>n</literal> относятся к размерам матрицы <literal>x</literal>.
181                                     Даже если эта возможность работает со всеми полиномами, рекомендуется использовать для удобочитаемости символ <literal>$</literal>.
182                                 </para>
183                             </listitem>
184                         </varlistentry>
185                     </variablelist>
186                     <para>
187                         Для матриц, у которых больше двух размерностей (см. <link linkend="hypermatrices">гиперматрицы</link>) степень размерности автоматически уменьшается, когда самые крайние правые размерности равны 1.
188                     </para>
189                 </listitem>
190             </varlistentry>
191             <varlistentry>
192                 <term>В СЛУЧАЕ СПИСКА (LIST) ИЛИ ТИПИЗИРОВАННОГО СПИСКА (TLIST)</term>
193                 <listitem>
194                     <para>
195                         В этом случае <literal>ki</literal> указывает путь до элемента
196                         подсписка структуры данных <literal>l</literal>. Разрешено
197                         рекурсивное выделение без промежуточных копий. Инструкции
198                     </para>
199                     <para>
200                         <literal>[...]=l(k1)...(kn)(i)</literal>
201                     </para>
202                     <para>и</para>
203                     <para>
204                         <literal>[...]=l(list(k1,...,kn,i))</literal>
205                     </para>
206                     <para>интерпретируются как:</para>
207                     <para>
208                         <literal>lk1 = l(k1)</literal>
209                     </para>
210                     <para>
211                         <literal> .. = .. </literal>
212                     </para>
213                     <para>
214                         <literal>lkn = lkn-1(kn)</literal>
215                     </para>
216                     <para>
217                         <literal>[...] = lkn(i)</literal>.
218                     </para>
219                     <para>
220                         А инструкции <literal>l(k1)...(kn)(i,j)</literal> и
221                         <literal>l(list(k1,...,kn,list(i,j))</literal> интерпретируются как:
222                     </para>
223                     <para>
224                         <literal>lk1 = l(k1)</literal>
225                     </para>
226                     <para>
227                         <literal> .. = .. </literal>
228                     </para>
229                     <para>
230                         <literal>lkn = lkn-1(kn)</literal>
231                     </para>
232                     <para>
233                         <literal>
234                             lkn(i,j)
235                         </literal>
236                     </para>
237                     <para>
238                         Когда путь указывает более одного элемента списка,то инструкция
239                         должна иметь столько аргументов слева, сколько выбрано элементов. Однако, если
240                         синтаксис выделения используется внутри вызывающей последовательности ввода
241                         функции, то каждый возвращаемый элемент списка добавляется к вызывающей
242                         последовательности функции.
243                     </para>
244                     <para>
245                         Заметьте, что <literal>l(list())</literal> -- это то же самое, что и <literal>l</literal>.
246                     </para>
247                     <variablelist>
248                         <varlistentry>
249                             <term>i и j могут быть:</term>
250                             <listitem>
251                                 <variablelist>
252                                     <varlistentry>
253                                         <term>вещественными скалярами или векторами или матрицами с положительными элементами.
254                                         </term>
255                                         <listitem>
256                                             <para>
257                                                 <literal>[r1,...rn]=l(i)</literal> выделяет элементы
258                                                 <literal>i(k)</literal> из списка <literal>l</literal> и хранит их в переменных
259                                                 <literal>rk</literal>, где <literal>k</literal> от 1 до <literal>size(i,'*')</literal>.
260                                             </para>
261                                         </listitem>
262                                     </varlistentry>
263                                     <varlistentry>
264                                         <term>
265                                             символом "двоеточие"
266                                         </term>
267                                         <listitem>
268                                             <para>который ставится для "всех элементов".</para>
269                                         </listitem>
270                                     </varlistentry>
271                                     <varlistentry>
272                                         <term>вектором логических значений.</term>
273                                         <listitem>
274                                             <para>
275                                                 Если <literal>i</literal> является вектором логических значений, то
276                                                 он интерпретируется как <literal>find(i)</literal>.
277                                             </para>
278                                         </listitem>
279                                     </varlistentry>
280                                     <varlistentry>
281                                         <term>полиномом</term>
282                                         <listitem>
283                                             <para>
284                                                 Если <literal>i</literal> является вектором полиномов или вектором неявных полиномов,
285                                                 то он интерпретируется как <literal>horner(i,m)</literal>, где
286                                                 <literal>m=size(l)</literal>. Даже если эта возможность работает со всеми полиномами,
287                                                 рекомендуется использовать для удобочитаемости символ <literal>$</literal>.
288                                             </para>
289                                         </listitem>
290                                     </varlistentry>
291                                 </variablelist>
292                             </listitem>
293                         </varlistentry>
294                         <varlistentry>
295                             <term>k1 ... kn могут быть:</term>
296                             <listitem>
297                                 <variablelist>
298                                     <varlistentry>
299                                         <term>вещественным положительным скаляром</term>
300                                         <listitem>
301                                             <para/>
302                                         </listitem>
303                                     </varlistentry>
304                                     <varlistentry>
305                                         <term>полиномом</term>
306                                         <listitem>
307                                             <para>
308                                                 интерпретируемым как <literal>horner(ki,m)</literal>, где
309                                                 <literal>m</literal> -- соответствующий размер подсписка.
310                                             </para>
311                                         </listitem>
312                                     </varlistentry>
313                                     <varlistentry>
314                                         <term>символьной строкой</term>
315                                         <listitem>
316                                             <para>связанной с именем элемента подсписка.</para>
317                                         </listitem>
318                                     </varlistentry>
319                                 </variablelist>
320                             </listitem>
321                         </varlistentry>
322                     </variablelist>
323                 </listitem>
324             </varlistentry>
325         </variablelist>
326     </refsection>
327     <refsection>
328         <title>Примечания</title>
329         <para>
330             Для программно определяемых типов матриц, таких как рациональные функции
331             и линейные системы в пространстве состояний, синтаксис <literal>x(i)</literal>
332             нельзя использовать для выделения элемента вектора из-за путаницы с выделением
333             элемнта списка. Нужно использовать синтаксис <literal>x(1,j)</literal> или
334             <literal>x(i,1)</literal>.
335         </para>
336     </refsection>
337     <refsection>
338         <title>Примеры</title>
339         <programlisting role="example"><![CDATA[
340 // В СЛУЧАЕ МАТРИЦЫ
341 a=[1 2 3;4 5 6]
342 a(1,2)
343 a([1 1],2)
344 a(:,1)
345 a(:,3:-1:1)
346 a(1)
347 a(6)
348 a(:)
349 a([%t %f %f %t])
350 a([%t %f],[2 3])
351 a(1:2,$-1)
352 a($:-1:1,2)
353 a($)
354 //
355 x='test'
356 x([1 1;1 1;1 1])
357 //
358 b=[1/%s,(%s+1)/(%s-1)]
359 b(1,1)
360 b(1,$)
361 b(2) // числитель
362 // в случае LIST или TLIST
363 l=list(1,'qwerw',%s)
364 l(1)
365 [a,b]=l([3 2])
366 l($)
367 x=tlist(l(2:3)) // формирование типизированного списка с двумя последними компонентами l
368 //
369 dts=list(1,tlist(['x';'a';'b'],10,[2 3]));
370 dts(2)('a')
371 dts(2)('b')(1,2)
372 [a,b]=dts(2)(['a','b'])
373  ]]></programlisting>
374     </refsection>
375     <refsection role="see also">
376         <title>Смотрите также</title>
377         <simplelist type="inline">
378             <member>
379                 <link linkend="find">find</link>
380             </member>
381             <member>
382                 <link linkend="horner">horner</link>
383             </member>
384             <member>
385                 <link linkend="parentheses">круглые скобки</link>
386             </member>
387             <member>
388                 <link linkend="insertion">вставка</link>
389             </member>
390         </simplelist>
391     </refsection>
392 </refentry>