version 1.1, 1999/12/08 05:47:44 |
version 1.14, 2016/03/22 07:25:14 |
|
|
|
@comment $OpenXM: OpenXM/src/asir-doc/parts/type.texi,v 1.13 2007/02/15 02:41:38 noro Exp $ |
|
\BJP |
@node $B7?(B,,, Top |
@node $B7?(B,,, Top |
@chapter $B7?(B |
@chapter $B7?(B |
|
\E |
|
\BEG |
|
@node Data types,,, Top |
|
@chapter Data types |
|
\E |
|
|
@menu |
@menu |
|
\BJP |
* Asir $B$G;HMQ2DG=$J7?(B:: |
* Asir $B$G;HMQ2DG=$J7?(B:: |
* $B?t$N7?(B:: |
* $B?t$N7?(B:: |
* $BITDj85$N7?(B:: |
* $BITDj85$N7?(B:: |
|
\E |
|
\BEG |
|
* Types in Asir:: |
|
* Types of numbers:: |
|
* Types of indeterminates:: |
|
\E |
@end menu |
@end menu |
|
|
|
\BJP |
@node Asir $B$G;HMQ2DG=$J7?(B,,, $B7?(B |
@node Asir $B$G;HMQ2DG=$J7?(B,,, $B7?(B |
@section @b{Asir} $B$G;HMQ2DG=$J7?(B |
@section @b{Asir} $B$G;HMQ2DG=$J7?(B |
|
\E |
|
\BEG |
|
@node Types in Asir,,, Data types |
|
@section Types in @b{Asir} |
|
\E |
|
|
@noindent |
@noindent |
|
\BJP |
@b{Asir} $B$K$*$$$F$O(B, $B2DFI$J7A<0$GF~NO$5$l$?$5$^$6$^$JBP>]$O(B, $B%Q!<%6$K$h$j(B |
@b{Asir} $B$K$*$$$F$O(B, $B2DFI$J7A<0$GF~NO$5$l$?$5$^$6$^$JBP>]$O(B, $B%Q!<%6$K$h$j(B |
$BCf4V8@8l$KJQ49$5$l(B, $B%$%s%?%W%j%?$K$h$j(B @b{Risa} $B$N7W;;%(%s%8%s$r8F$S=P$7(B |
$BCf4V8@8l$KJQ49$5$l(B, $B%$%s%?%W%j%?$K$h$j(B @b{Risa} $B$N7W;;%(%s%8%s$r8F$S=P$7(B |
$B$J$,$iFbIt7A<0$KJQ49$5$l$k(B. $BJQ49$5$l$?BP>]$O(B, $B<!$N$$$:$l$+$N7?$r;}$D(B. |
$B$J$,$iFbIt7A<0$KJQ49$5$l$k(B. $BJQ49$5$l$?BP>]$O(B, $B<!$N$$$:$l$+$N7?$r;}$D(B. |
$B3FHV9f$O(B, $BAH$_9~$_H!?t(B @code{type()} $B$K$h$jJV$5$l$kCM$KBP1~$7$F$$$k(B. |
$B3FHV9f$O(B, $BAH$_9~$_H!?t(B @code{type()} $B$K$h$jJV$5$l$kCM$KBP1~$7$F$$$k(B. |
$B3FNc$O(B, @b{Asir} $B$N%W%m%s%W%H$KBP$9$kF~NO$,2DG=$J7A<0$N$$$/$D$+$r(B |
$B3FNc$O(B, @b{Asir} $B$N%W%m%s%W%H$KBP$9$kF~NO$,2DG=$J7A<0$N$$$/$D$+$r(B |
$B<($9(B. |
$B<($9(B. |
|
\E |
|
\BEG |
|
In @b{Asir}, various objects described according to the syntax of |
|
@b{Asir} are translated to intermediate forms and by @b{Asir} |
|
interpreter further translated into internal forms with the help of |
|
basic algebraic engine. Such an object in an internal form has one of |
|
the following types listed below. |
|
In the list, the number coincides with the value returned by the |
|
built-in function @code{type()}. |
|
Each example shows possible forms of inputs for @b{Asir}'s prompt. |
|
\E |
|
|
@table @code |
@table @code |
@item 0 |
@item 0 @b{0} |
@b{0} |
@* |
|
\BJP |
$B<B:]$K$O(B 0 $B$r<1JL;R$K$b$DBP>]$OB8:_$7$J$$(B. 0 $B$O(B, C $B$K$*$1$k(B 0 $B%]%$%s%?$K(B |
$B<B:]$K$O(B 0 $B$r<1JL;R$K$b$DBP>]$OB8:_$7$J$$(B. 0 $B$O(B, C $B$K$*$1$k(B 0 $B%]%$%s%?$K(B |
$B$h$jI=8=$5$l$F$$$k(B. $B$7$+$7(B, $BJX59>e(B @b{Asir} $B$N(B @code{type(0)} $B$O(B |
$B$h$jI=8=$5$l$F$$$k(B. $B$7$+$7(B, $BJX59>e(B @b{Asir} $B$N(B @code{type(0)} $B$O(B |
$BCM(B 0 $B$rJV$9(B. |
$BCM(B 0 $B$rJV$9(B. |
|
\E |
|
\BEG |
|
As a matter of fact, no object exists that has 0 as its identification |
|
number. The number 0 is implemented as a null (0) pointer of C language. |
|
For convenience's sake, a 0 is returned for the input @code{type(0)}. |
|
\E |
|
|
@item 1 |
\JP @item 1 @b{$B?t(B} |
@b{$B?t(B} |
\EG @item 1 @b{number} |
|
|
@example |
@example |
1 2/3 14.5 3+2*@@i |
1 2/3 14.5 3+2*@@i |
@end example |
@end example |
|
|
$B?t$O(B, $B$5$i$K$$$/$D$+$N7?$KJ,$1$i$l$k(B. $B$3$l$K$D$$$F$O2<$G=R$Y$k(B. |
\JP $B?t$O(B, $B$5$i$K$$$/$D$+$N7?$KJ,$1$i$l$k(B. $B$3$l$K$D$$$F$O2<$G=R$Y$k(B. |
|
\EG Numbers have sub-types. @xref{Types of numbers}. |
|
|
@item 2 |
\JP @item 2 @b{$BB?9`<0(B} ($B?t$G$J$$(B) |
@b{$BB?9`<0(B} ($B?t$G$J$$(B) |
\EG @item 2 @b{polynomial} (but not a number) |
|
|
@example |
@example |
x afo (2.3*x+y)^10 |
x afo (2.3*x+y)^10 |
@end example |
@end example |
|
|
|
\BJP |
$BB?9`<0$O(B, $BA4$FE83+$5$l(B, $B$=$N;~E@$K$*$1$kJQ?t=g=x$K=>$C$F(B, $B:F5"E*$K(B |
$BB?9`<0$O(B, $BA4$FE83+$5$l(B, $B$=$N;~E@$K$*$1$kJQ?t=g=x$K=>$C$F(B, $B:F5"E*$K(B |
1 $BJQ?tB?9`<0$H$7$F9_QQ$N=g$K@0M}$5$l$k(B (@xref{$BJ,;6I=8=B?9`<0(B}). |
1 $BJQ?tB?9`<0$H$7$F9_QQ$N=g$K@0M}$5$l$k(B. (@xref{$BJ,;6I=8=B?9`<0(B}.) |
$B$3$N;~(B, $B$=$NB?9`<0$K8=$l$k=g=x:GBg$NJQ?t$r(B @b{$B<gJQ?t(B} $B$H8F$V(B. |
$B$3$N;~(B, $B$=$NB?9`<0$K8=$l$k=g=x:GBg$NJQ?t$r(B @b{$B<gJQ?t(B} $B$H8F$V(B. |
|
\E |
|
\BEG |
|
Every polynomial is maintained internally in its full expanded form, |
|
represented as a nested univariate polynomial, according to the current |
|
variable ordering, arranged by the descending order of exponents. |
|
(@xref{Distributed polynomial}.) |
|
In the representation, the indeterminate (or variable), appearing in |
|
the polynomial, with maximum ordering is called the @b{main variable}. |
|
Moreover, we call the coefficient of the maximum degree term of |
|
the polynomial with respect to the main variable the @b{leading coefficient}. |
|
\E |
|
|
@item 3 |
\JP @item 3 @b{$BM-M}<0(B} ($BB?9`<0$G$J$$(B) |
@b{$BM-M}<0(B} ($BB?9`<0$G$J$$(B) |
\EG @item 3 @b{rational expression} (not a polynomial) |
|
|
@example |
@example |
(x+1)/(y^2-y-x) x/x |
(x+1)/(y^2-y-x) x/x |
@end example |
@end example |
|
|
|
\BJP |
$BM-M}<0$O(B, $BJ,JlJ,;R$,LsJ,2DG=$G$b(B, $BL@<(E*$K(B @code{red()} $B$,8F$P$l$J$$(B |
$BM-M}<0$O(B, $BJ,JlJ,;R$,LsJ,2DG=$G$b(B, $BL@<(E*$K(B @code{red()} $B$,8F$P$l$J$$(B |
$B8B$jLsJ,$O9T$o$l$J$$(B. $B$3$l$O(B, $BB?9`<0$N(B GCD $B1i;;$,6K$a$F=E$$1i;;$G$"$k(B |
$B8B$jLsJ,$O9T$o$l$J$$(B. $B$3$l$O(B, $BB?9`<0$N(B GCD $B1i;;$,6K$a$F=E$$1i;;$G$"$k(B |
$B$?$a$G(B, $BM-M}<0$N1i;;$OCm0U$,I,MW$G$"$k(B. |
$B$?$a$G(B, $BM-M}<0$N1i;;$OCm0U$,I,MW$G$"$k(B. |
|
\E |
|
\BEG |
|
Note that in @b{Risa/Asir} a rational expression is not simplified |
|
by reducing the common divisors unless @code{red()} is called |
|
explicitly, even if it is possible. This is because the GCD computation |
|
of polynomials is a considerably heavy operation. You have to be careful |
|
enough in operating rational expressions. |
|
\E |
|
|
@item 4 |
\JP @item 4 @b{$B%j%9%H(B} |
@b{$B%j%9%H(B} |
\EG @item 4 @b{list} |
|
|
@example |
@example |
[] [1,2,[3,4],[x,y]] |
[] [1,2,[3,4],[x,y]] |
@end example |
@end example |
|
|
|
\BJP |
$B%j%9%H$OFI$_=P$7@lMQ$G$"$k(B. @code{[]} $B$O6u%j%9%H$r0UL#$9$k(B. $B%j%9%H$KBP$9$k(B |
$B%j%9%H$OFI$_=P$7@lMQ$G$"$k(B. @code{[]} $B$O6u%j%9%H$r0UL#$9$k(B. $B%j%9%H$KBP$9$k(B |
$BA`:n$H$7$F$O(B, @code{car()}, @code{cdr()}, @code{cons()} $B$J$I$K$h$kA`:n$NB>$K(B, |
$BA`:n$H$7$F$O(B, @code{car()}, @code{cdr()}, @code{cons()} $B$J$I$K$h$kA`:n$NB>$K(B, |
$BFI$_=P$7@lMQ$NG[Ns$H$_$J$7$F(B, @code{[@var{index}]} $B$rI,MW$J$@$1$D$1$k$3$H$K$h$j(B |
$BFI$_=P$7@lMQ$NG[Ns$H$_$J$7$F(B, @code{[@var{index}]} $B$rI,MW$J$@$1$D$1$k$3$H$K$h$j(B |
$BMWAG$N<h$j=P$7$r9T$&$3$H$,$G$-$k(B. $BNc$($P(B |
$BMWAG$N<h$j=P$7$r9T$&$3$H$,$G$-$k(B. $BNc$($P(B |
|
\E |
|
\BEG |
|
Lists are all read-only object. A null list is specified by @code{[]}. |
|
There are operations for lists: @code{car()}, @code{cdr()}, |
|
@code{cons()} etc. And further more, element referencing by indexing is |
|
available. Indexing is done by putting @code{[@var{index}]}'s after a |
|
program variable as many as are required. |
|
For example, |
|
\E |
|
|
@example |
@example |
[0] L = [[1,2,3],[4,[5,6]],7]$ |
[0] L = [[1,2,3],[4,[5,6]],7]$ |
Line 75 x afo (2.3*x+y)^10 |
|
Line 145 x afo (2.3*x+y)^10 |
|
[5,6] |
[5,6] |
@end example |
@end example |
|
|
|
\BJP |
$BCm0U$9$Y$-$3$H$O(B, $B%j%9%H(B, $BG[Ns(B ($B9TNs(B, $B%Y%/%H%k(B) $B6&$K(B, $B%$%s%G%C%/%9$O(B |
$BCm0U$9$Y$-$3$H$O(B, $B%j%9%H(B, $BG[Ns(B ($B9TNs(B, $B%Y%/%H%k(B) $B6&$K(B, $B%$%s%G%C%/%9$O(B |
0 $B$+$i;O$^$k$3$H$H(B, $B%j%9%H$NMWAG$N<h$j=P$7$r%$%s%G%C%/%9$G9T$&$3$H$O(B, |
0 $B$+$i;O$^$k$3$H$H(B, $B%j%9%H$NMWAG$N<h$j=P$7$r%$%s%G%C%/%9$G9T$&$3$H$O(B, |
$B7k6I$O@hF,$+$i%]%$%s%?$r$?$I$k$3$H$KAjEv$9$k$?$a(B, $BG[Ns$KBP$9$kA`:n$K(B |
$B7k6I$O@hF,$+$i%]%$%s%?$r$?$I$k$3$H$KAjEv$9$k$?$a(B, $BG[Ns$KBP$9$kA`:n$K(B |
$BHf3S$7$FBg$-$J%j%9%H$G$O;~4V$,$+$+$k>l9g$,$"$k$H$$$&$3$H$G$"$k(B. |
$BHf3S$7$FBg$-$J%j%9%H$G$O;~4V$,$+$+$k>l9g$,$"$k$H$$$&$3$H$G$"$k(B. |
|
\E |
|
\BEG |
|
Notice that for lists, matrices and vectors, the index begins with |
|
number 0. Also notice that referencing list elements is done by |
|
following pointers from the first element. Therefore, it sometimes takes |
|
much more time to perform referencing operations on a large list than |
|
on a vectors or a matrices with the same size. |
|
\E |
|
|
@item 5 |
\JP @item 5 @b{$B%Y%/%H%k(B} |
@b{$B%Y%/%H%k(B} |
\EG @item 5 @b{vector} |
|
|
@example |
@example |
newvect(3) newvect(2,[a,1]) |
newvect(3) newvect(2,[a,1]) |
@end example |
@end example |
|
|
|
\BJP |
$B%Y%/%H%k$O(B, @code{newvect()} $B$GL@<(E*$K@8@.$9$kI,MW$,$"$k(B. $BA0<T$NNc$G(B |
$B%Y%/%H%k$O(B, @code{newvect()} $B$GL@<(E*$K@8@.$9$kI,MW$,$"$k(B. $BA0<T$NNc$G(B |
$B$O(B2 $B@.J,$N(B 0 $B%Y%/%H%k$,@8@.$5$l(B, $B8e<T$G$O(B, $BBh(B 0 $B@.J,$,(B @code{a}, $BBh(B 1 |
$B$O(B2 $B@.J,$N(B 0 $B%Y%/%H%k$,@8@.$5$l(B, $B8e<T$G$O(B, $BBh(B 0 $B@.J,$,(B @code{a}, $BBh(B 1 |
$B@.J,$,(B @code{1} $B$N%Y%/%H%k$,@8@.$5$l$k(B. $B=i4|2=$N$?$a$N(B $BBh(B 2 $B0z?t$O(B, $BBh(B |
$B@.J,$,(B @code{1} $B$N%Y%/%H%k$,@8@.$5$l$k(B. $B=i4|2=$N$?$a$N(B $BBh(B 2 $B0z?t$O(B, $BBh(B |
Line 94 newvect(3) newvect(2,[a,1]) |
|
Line 174 newvect(3) newvect(2,[a,1]) |
|
$B$j$J$$J,$O(B 0 $B$,Jd$o$l$k(B. $B@.J,$O(B @code{[@var{index}]} $B$K$h$j<h$j=P$;$k(B. $B<B:](B |
$B$j$J$$J,$O(B 0 $B$,Jd$o$l$k(B. $B@.J,$O(B @code{[@var{index}]} $B$K$h$j<h$j=P$;$k(B. $B<B:](B |
$B$K$O(B, $B3F@.J,$K(B, $B%Y%/%H%k(B, $B9TNs(B, $B%j%9%H$r4^$`G$0U$N7?$NBP>]$rBeF~$G$-$k(B |
$B$K$O(B, $B3F@.J,$K(B, $B%Y%/%H%k(B, $B9TNs(B, $B%j%9%H$r4^$`G$0U$N7?$NBP>]$rBeF~$G$-$k(B |
$B$N$G(B, $BB?<!85G[Ns$r%Y%/%H%k$GI=8=$9$k$3$H$,$G$-$k(B. |
$B$N$G(B, $BB?<!85G[Ns$r%Y%/%H%k$GI=8=$9$k$3$H$,$G$-$k(B. |
|
\E |
|
\BEG |
|
Vector objects are created only by explicit execution of @code{newvect()} |
|
command. The first example above creates a null vector object with |
|
3 elements. The other example creates a vector object |
|
with 2 elements which is initialized such that its 0-th element |
|
is @code{a} and 1st element is @code{1}. |
|
The second argument for @code{newvect} is used to initialize |
|
elements of the newly created vector. A list with size smaller or equal |
|
to the first argument will be accepted. Elements of the initializing |
|
list is used from the left to the right. If the list is too short to |
|
specify all the vector elements, |
|
the unspecified elements are filled with as many 0's as are required. |
|
Any vector element is designated by indexing, e.g., |
|
@code{[@var{index}]}. |
|
@code{Asir} allows any type, including vector, matrix and list, |
|
for each respective element of a vector. |
|
As a matter of course, arrays with arbitrary dimensions can be |
|
represented by vectors, because each element of a vector can be a vector |
|
or matrix itself. |
|
An element designator of a vector can be a left value of assignment |
|
statement. This implies that an element designator is treated just like |
|
a simple program variable. |
|
Note that an assignment to the element designator of a vector has effect |
|
on the whole value of that vector. |
|
\E |
|
|
@example |
@example |
[0] A3 = newvect(3); |
[0] A3 = newvect(3); |
Line 101 newvect(3) newvect(2,[a,1]) |
|
Line 207 newvect(3) newvect(2,[a,1]) |
|
[1] for (I=0;I<3;I++)A3[I] = newvect(3); |
[1] for (I=0;I<3;I++)A3[I] = newvect(3); |
[2] for (I=0;I<3;I++)for(J=0;J<3;J++)A3[I][J]=newvect(3); |
[2] for (I=0;I<3;I++)for(J=0;J<3;J++)A3[I][J]=newvect(3); |
[3] A3; |
[3] A3; |
[ [ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] [ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] [ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] ] |
[ [ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] |
|
[ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] |
|
[ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] ] |
[4] A3[0]; |
[4] A3[0]; |
[ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] |
[ [ 0 0 0 ] [ 0 0 0 ] [ 0 0 0 ] ] |
[5] A3[0][0]; |
[5] A3[0][0]; |
[ 0 0 0 ] |
[ 0 0 0 ] |
@end example |
@end example |
|
|
@item 6 |
\JP @item 6 @b{$B9TNs(B} |
@b{$B9TNs(B} |
\EG @item 6 @b{matrix} |
|
|
@example |
@example |
newmat(2,2) newmat(2,3,[[x,y],[z]]) |
newmat(2,2) newmat(2,3,[[x,y],[z]]) |
@end example |
@end example |
|
|
|
\BJP |
$B9TNs$N@8@.$b(B @code{newmat()} $B$K$h$jL@<(E*$K9T$o$l$k(B. $B=i4|2=$b(B, $B0z?t(B |
$B9TNs$N@8@.$b(B @code{newmat()} $B$K$h$jL@<(E*$K9T$o$l$k(B. $B=i4|2=$b(B, $B0z?t(B |
$B$,%j%9%H$N%j%9%H$H$J$k$3$H$r=|$$$F$O%Y%/%H%k$HF1MM$G(B, $B%j%9%H$N3FMWAG(B |
$B$,%j%9%H$N%j%9%H$H$J$k$3$H$r=|$$$F$O%Y%/%H%k$HF1MM$G(B, $B%j%9%H$N3FMWAG(B |
($B$3$l$O$^$?%j%9%H$G$"$k(B) $B$O(B, $B3F9T$N=i4|2=$K;H$o$l(B, $BB-$j$J$$ItJ,$K$O(B |
($B$3$l$O$^$?%j%9%H$G$"$k(B) $B$O(B, $B3F9T$N=i4|2=$K;H$o$l(B, $BB-$j$J$$ItJ,$K$O(B |
0 $B$,Kd$a$i$l$k(B. $B9TNs$b(B, $B3FMWAG$K$OG$0U$NBP>]$rBeF~$G$-$k(B. $B9TNs$N3F(B |
0 $B$,Kd$a$i$l$k(B. $B9TNs$b(B, $B3FMWAG$K$OG$0U$NBP>]$rBeF~$G$-$k(B. $B9TNs$N3F(B |
$B9T$O(B, $B%Y%/%H%k$H$7$F<h$j=P$9$3$H$,$G$-$k(B. |
$B9T$O(B, $B%Y%/%H%k$H$7$F<h$j=P$9$3$H$,$G$-$k(B. |
|
\E |
|
\BEG |
|
Like vector objects, matrix objects are also created only by explicit |
|
execution of @code{newmat()} command. Initialization of the matrix |
|
elements are done in a similar manner with that of the vector elements |
|
except that the elements are specified by a list of lists. Each element, |
|
again a list, is used to initialize each row; if the list is too short |
|
to specify all the row elements, unspecified elements are filled with |
|
as many 0's as are required. |
|
Like vectors, any matrix element is designated by indexing, e.g., |
|
@code{[@var{index}][@var{index}]}. |
|
@code{Asir} also allows any type, including vector, matrix and list, |
|
for each respective element of a matrix. |
|
An element designator of a matrix can also be a left value of assignment |
|
statement. This implies that an element designator is treated just like |
|
a simple program variable. |
|
Note that an assignment to the element designator of a matrix has effect |
|
on the whole value of that matrix. |
|
Note also that every row, (not column,) of a matrix can be extracted |
|
and referred to as a vector. |
|
\E |
|
|
@example |
@example |
[0] M=newmat(2,3); |
[0] M=newmat(2,3); |
Line 131 newmat(2,2) newmat(2,3,[[x,y],[z]]) |
|
Line 261 newmat(2,2) newmat(2,3,[[x,y],[z]]) |
|
5 |
5 |
@end example |
@end example |
|
|
@item 7 |
\JP @item 7 @b{$BJ8;zNs(B} |
@b{$BJ8;zNs(B} |
\EG @item 7 @b{string} |
|
|
@example |
@example |
"" "afo" |
"" "afo" |
@end example |
@end example |
|
|
|
\BJP |
$BJ8;zNs$O(B, $B<g$K%U%!%$%kL>$J$I$KMQ$$$i$l$k(B. $BJ8;zNs$KBP$7$F$O2C;;$N$_$,(B |
$BJ8;zNs$O(B, $B<g$K%U%!%$%kL>$J$I$KMQ$$$i$l$k(B. $BJ8;zNs$KBP$7$F$O2C;;$N$_$,(B |
$BDj5A$5$l$F$$$F(B, $B7k2L$O(B 2 $B$D$NJ8;zNs$N7k9g$G$"$k(B. |
$BDj5A$5$l$F$$$F(B, $B7k2L$O(B 2 $B$D$NJ8;zNs$N7k9g$G$"$k(B. |
|
\E |
|
\BEG |
|
Strings are used mainly for naming files. It is also used for giving |
|
comments of the results. Operator symbol @code{+} denote the |
|
concatenation operation of two strings. |
|
\E |
|
|
@example |
@example |
[0] "afo"+"take"; |
[0] "afo"+"take"; |
afotake |
afotake |
@end example |
@end example |
@item 8 |
|
@b{$B9=B$BN(B} |
|
|
|
|
\JP @item 8 @b{$B9=B$BN(B} |
|
\EG @item 8 @b{structure} |
|
|
@example |
@example |
newstruct(afo) |
newstruct(afo) |
@end example |
@end example |
|
|
$B9=B$BN$K4X$7$F$O(B, $B>O$r2~$a$F2r@b$9$kM=Dj$G$"$k(B. |
\BJP |
|
Asir $B$K$*$1$k9=B$BN$O(B, C $B$K$*$1$k9=B$BN$r4J0W2=$7$?$b$N$G$"$k(B. |
|
$B8GDjD9G[Ns$N3F@.J,$rL>A0$G%"%/%;%9$G$-$k%*%V%8%'%/%H$G(B, |
|
$B9=B$BNDj5AKh$KL>A0$r$D$1$k(B. |
|
\E |
|
|
@item 9 |
\BEG |
@b{$BJ,;6I=8=B?9`<0(B} |
The type @b{structure} is a simplified version of that in C language. |
|
It is defined as a fixed length array and each entry of the array |
|
is accessed by its name. A name is associated with each structure. |
|
\E |
|
|
|
\JP @item 9 @b{$BJ,;6I=8=B?9`<0(B} |
|
\EG @item 9 @b{distributed polynomial} |
|
|
@example |
@example |
2*<<0,1,2,3>>-3*<<1,2,3,4>> |
2*<<0,1,2,3>>-3*<<1,2,3,4>> |
@end example |
@end example |
|
|
|
\BJP |
$B$3$l$O(B, $B$[$H$s$I%0%l%V%J4pDl@lMQ$N7?$G(B, $BDL>o$N7W;;$G$3$N7?$,I,MW$H(B |
$B$3$l$O(B, $B$[$H$s$I%0%l%V%J4pDl@lMQ$N7?$G(B, $BDL>o$N7W;;$G$3$N7?$,I,MW$H(B |
$B$J$k$3$H$O$^$:$J$$$,(B, $B%0%l%V%J4pDl7W;;%Q%C%1!<%8<+BN$,%f!<%68@8l(B |
$B$J$k$3$H$O$^$:$J$$$,(B, $B%0%l%V%J4pDl7W;;%Q%C%1!<%8<+BN$,%f!<%68@8l(B |
$B$G=q$+$l$F$$$k$?$a(B, $B%f!<%6$,A`:n$G$-$k$h$&FHN)$7$?7?$H$7$F(B @b{Asir} |
$B$G=q$+$l$F$$$k$?$a(B, $B%f!<%6$,A`:n$G$-$k$h$&FHN)$7$?7?$H$7$F(B @b{Asir} |
$B$G;HMQ$G$-$k$h$&$K$7$F$"$k(B. $B$3$l$K$D$$$F$O(B @xref{$B%0%l%V%J4pDl$N7W;;(B}. |
$B$G;HMQ$G$-$k$h$&$K$7$F$"$k(B. $B$3$l$K$D$$$F$O(B @xref{$B%0%l%V%J4pDl$N7W;;(B}. |
|
\E |
|
\BEG |
|
This is the short for `Distributed representation of polynomials.' |
|
This type is specially devised for computation of Groebner bases. |
|
Though for ordinary users this type may never be needed, it is provided |
|
as a distinguished type that user can operate by @code{Asir}. |
|
This is because the Groebner basis package provided with |
|
@code{Risa/Asir} is written in the @code{Asir} user language. |
|
For details @xref{Groebner basis computation}. |
|
\E |
|
|
@item 10 |
\JP @item 10 @b{$BId9f$J$7%^%7%s(B 32bit $B@0?t(B} |
@b{$BId9f$J$7%^%7%s(B 32bit $B@0?t(B} |
\EG @item 10 @b{32bit unsigned integer} |
|
|
@item 11 |
\JP @item 11 @b{$B%(%i!<%*%V%8%'%/%H(B} |
@b{$B%(%i!<%*%V%8%'%/%H(B} |
\EG @item 11 @b{error object} |
|
@* |
|
\JP $B0J>eFs$D$O(B, Open XM $B$K$*$$$FMQ$$$i$l$kFC<l%*%V%8%'%/%H$G$"$k(B. |
|
\EG These are special objects used for OpenXM. |
|
|
$B0J>eFs$D$O(B, Open XM $B$K$*$$$FMQ$$$i$l$kFC<l%*%V%8%'%/%H$G$"$k(B. |
\JP @item 12 @b{GF(2) $B>e$N9TNs(B} |
|
\EG @item 12 @b{matrix over GF(2)} |
@item 12 |
@* |
@b{GF(2) $B>e$N9TNs(B} |
\BJP |
|
|
$B8=:_(B, $BI8?t(B 2 $B$NM-8BBN$K$*$1$k4pDlJQ49$N$?$a$N%*%V%8%'%/%H$H$7$FMQ$$$i$l(B |
$B8=:_(B, $BI8?t(B 2 $B$NM-8BBN$K$*$1$k4pDlJQ49$N$?$a$N%*%V%8%'%/%H$H$7$FMQ$$$i$l(B |
$B$k(B. |
$B$k(B. |
|
\E |
|
\BEG |
|
This is used for basis conversion in finite fields of characteristic 2. |
|
\E |
|
|
@item 13 |
\JP @item 13 @b{MATHCAP $B%*%V%8%'%/%H(B} |
@b{MATHCAP $B%*%V%8%'%/%H(B} |
\EG @item 13 @b{MATHCAP object} |
|
@* |
|
\JP Open XM $B$K$*$$$F(B, $B<BAu$5$l$F$$$k5!G=$rAw<u?.$9$k$?$a$N%*%V%8%'%/%H$G$"$k(B. |
|
\EG This object is used to express available funcionalities for Open XM. |
|
|
Open XM $B$K$*$$$F(B, $B<BAu$5$l$F$$$k5!G=$rAw<u?.$9$k$?$a$N%*%V%8%'%/%H$G$"$k(B. |
@item 14 @b{first order formula} |
|
@* |
|
\JP quantifier elimination $B$GMQ$$$i$l$k0l3,=R8lO@M}<0(B. |
|
\EG This expresses a first order formula used in quantifier elimination. |
|
|
@item 14 |
@item 15 @b{matrix over GF(@var{p})} |
@b{first order formula} |
@* |
|
\JP $B>.I8?tM-8BBN>e$N9TNs(B. |
|
\EG A matrix over a small finite field. |
|
|
quantifier elimination $B$GMQ$$$i$l$k0l3,=R8lO@M}<0(B. |
@item 16 @b{byte array} |
|
@* |
|
\JP $BId9f$J$7(B byte $B$NG[Ns(B |
|
\EG An array of unsigned bytes. |
|
|
|
\JP @item -1 @b{VOID $B%*%V%8%'%/%H(B} |
|
\EG @item -1 @b{VOID object} |
|
@* |
|
\JP $B7?<1JL;R(B -1 $B$r$b$D%*%V%8%'%/%H$O4X?t$NLa$jCM$J$I$,L58z$G$"$k$3$H$r<($9(B. |
|
\BEG |
|
The object with the object identifier -1 indicates that a return value |
|
of a function is void. |
|
\E |
@end table |
@end table |
|
|
|
\BJP |
@node $B?t$N7?(B,,, $B7?(B |
@node $B?t$N7?(B,,, $B7?(B |
@section $B?t$N7?(B |
@section $B?t$N7?(B |
|
\E |
|
\BEG |
|
@node Types of numbers,,, Data types |
|
@section Types of numbers |
|
\E |
|
|
@table @code |
@table @code |
@item 0 |
@item 0 |
@b{$BM-M}?t(B} |
\JP @b{$BM-M}?t(B} |
|
\EG @b{rational number} |
|
@* |
|
\BJP |
$BM-M}?t$O(B, $BG$0UB?G\D9@0?t(B (@b{bignum}) $B$K$h$j<B8=$5$l$F$$$k(B. $BM-M}?t$O>o$K(B |
$BM-M}?t$O(B, $BG$0UB?G\D9@0?t(B (@b{bignum}) $B$K$h$j<B8=$5$l$F$$$k(B. $BM-M}?t$O>o$K(B |
$B4{LsJ,?t$GI=8=$5$l$k(B. |
$B4{LsJ,?t$GI=8=$5$l$k(B. |
|
\E |
|
\BEG |
|
Rational numbers are implemented by arbitrary precision integers |
|
(@b{bignum}). A rational number is always expressed by a fraction of |
|
lowest terms. |
|
\E |
|
|
@item 1 |
@item 1 |
@b{$BG\@:EYIbF0>.?t(B} |
\JP @b{$BG\@:EYIbF0>.?t(B} |
|
\EG @b{double precision floating point number (double float)} |
|
@* |
|
\BJP |
$B%^%7%s$NDs6!$9$kG\@:EYIbF0>.?t$G$"$k(B. @b{Asir} $B$N5/F0;~$K$O(B, |
$B%^%7%s$NDs6!$9$kG\@:EYIbF0>.?t$G$"$k(B. @b{Asir} $B$N5/F0;~$K$O(B, |
$BDL>o$N7A<0$GF~NO$5$l$?IbF0>.?t$O$3$N7?$KJQ49$5$l$k(B. $B$?$@$7(B, |
$BDL>o$N7A<0$GF~NO$5$l$?IbF0>.?t$O$3$N7?$KJQ49$5$l$k(B. $B$?$@$7(B, |
@code{ctrl()} $B$K$h$j(B @b{bigfloat} $B$,A*Br$5$l$F$$$k>l9g$K$O(B |
@code{ctrl()} $B$K$h$j(B @b{bigfloat} $B$,A*Br$5$l$F$$$k>l9g$K$O(B |
@b{bigfloat} $B$KJQ49$5$l$k(B. |
@b{bigfloat} $B$KJQ49$5$l$k(B. |
|
\E |
|
\BEG |
|
The numbers of this type are numbers provided by the computer hardware. |
|
By default, when @b{Asir} is started, floating point numbers in a |
|
ordinary form are transformed into numbers of this type. However, |
|
they will be transformed into @b{bigfloat} numbers |
|
when the switch @b{bigfloat} is turned on (enabled) by @code{ctrl()} |
|
command. |
|
\E |
|
|
@example |
@example |
[0] 1.2; |
[0] 1.2; |
Line 220 quantifier elimination $B$GMQ$$$i$l$k0l3,=R8lO@M}<0( |
|
Line 430 quantifier elimination $B$GMQ$$$i$l$k0l3,=R8lO@M}<0( |
|
1.20000000000000000513 E-1000 |
1.20000000000000000513 E-1000 |
@end example |
@end example |
|
|
|
\BJP |
$BG\@:EYIbF0>.?t$HM-M}?t$N1i;;$O(B, $BM-M}?t$,IbF0>.?t$KJQ49$5$l$F(B, |
$BG\@:EYIbF0>.?t$HM-M}?t$N1i;;$O(B, $BM-M}?t$,IbF0>.?t$KJQ49$5$l$F(B, |
$BIbF0>.?t$H$7$F1i;;$5$l$k(B. |
$BIbF0>.?t$H$7$F1i;;$5$l$k(B. |
|
\E |
|
\BEG |
|
A rational number shall be converted automatically into a double float |
|
number before the operation with another double float number and the |
|
result shall be computed as a double float number. |
|
\E |
|
|
@item 2 |
@item 2 |
@b{$BBe?tE*?t(B} |
\JP @b{$BBe?tE*?t(B} |
|
\EG @b{algebraic number} |
|
@* |
|
\JP @xref{$BBe?tE*?t$K4X$9$k1i;;(B}. |
|
\EG @xref{Algebraic numbers}. |
|
|
@xref{$BBe?tE*?t$K4X$9$k1i;;(B}. |
|
|
|
@item 3 |
@item 3 |
@b{bigfloat} |
@b{bigfloat} |
|
@* |
@b{bigfloat} $B$O(B, @b{Asir} $B$G$O(B @b{PARI} $B%i%$%V%i%j$K$h$j(B |
\BJP |
$B<B8=$5$l$F$$$k(B. @b{PARI} $B$K$*$$$F$O(B, @b{bigfloat} $B$O(B, $B2>?tIt(B |
@b{bigfloat} $B$O(B, @b{Asir} $B$G$O(B @b{MPFR} $B%i%$%V%i%j$K$h$j(B |
$B$N$_G$0UB?G\D9$G(B, $B;X?tIt$O(B 1 $B%o!<%I0JFb$N@0?t$K8B$i$l$F$$$k(B. |
$B<B8=$5$l$F$$$k(B. @b{MPFR} $B$K$*$$$F$O(B, @b{bigfloat} $B$O(B, $B2>?tIt(B |
|
$B$N$_G$0UB?G\D9$G(B, $B;X?tIt$O(B 64bit $B@0?t$G$"$k(B. |
@code{ctrl()} $B$G(B @b{bigfloat} $B$rA*Br$9$k$3$H$K$h$j(B, $B0J8e$NIbF0>.?t(B |
@code{ctrl()} $B$G(B @b{bigfloat} $B$rA*Br$9$k$3$H$K$h$j(B, $B0J8e$NIbF0>.?t(B |
$B$NF~NO$O(B @b{bigfloat} $B$H$7$F07$o$l$k(B. $B@:EY$O%G%U%)%k%H$G$O(B |
$B$NF~NO$O(B @b{bigfloat} $B$H$7$F07$o$l$k(B. $B@:EY$O%G%U%)%k%H$G$O(B |
10 $B?J(B 9 $B7eDxEY$G$"$k$,(B, @code{setprec()} $B$K$h$j;XDj2DG=$G$"$k(B. |
10 $B?J(B 9 $B7eDxEY$G$"$k$,(B, @code{setprec()}, @code{setbprec()} $B$K$h$j;XDj2DG=$G$"$k(B. |
|
\E |
|
\BEG |
|
The @b{bigfloat} numbers of @b{Asir} is realized by @b{MPFR} library. |
|
A @b{bigfloat} number of @b{MPFR} has an arbitrary precision mantissa |
|
part. However, its exponent part admits only a 64bit integer. |
|
Floating point operations will be performed all in @b{bigfloat} after |
|
activating the @b{bigfloat} switch by @code{ctrl()} command. |
|
The default precision is 53 bits (about 15 digits), which can be specified by |
|
@code{setbprec()} and @code{setprec()} command. |
|
\E |
|
|
@example |
@example |
[0] ctrl("bigfloat",1); |
[0] ctrl("bigfloat",1); |
1 |
1 |
[1] eval(2^(1/2)); |
[1] eval(2^(1/2)); |
1.414213562373095048763788073031 |
1.4142135623731 |
[2] setprec(100); |
[2] setprec(100); |
9 |
15 |
[3] eval(2^(1/2)); |
[3] eval(2^(1/2)); |
1.41421356237309504880168872420969807856967187537694807317654396116148 |
1.41421356237309504880168872420969807856967187537694...764157 |
|
[4] setbprec(100); |
|
332 |
|
[5] 1.41421356237309504880168872421 |
@end example |
@end example |
|
|
|
\BJP |
@code{eval()} $B$O(B, $B0z?t$K4^$^$l$kH!?tCM$r2DG=$J8B$j?tCM2=$9$kH!?t$G$"$k(B. |
@code{eval()} $B$O(B, $B0z?t$K4^$^$l$kH!?tCM$r2DG=$J8B$j?tCM2=$9$kH!?t$G$"$k(B. |
@code{setprec()} $B$G;XDj$5$l$?7e?t$O(B, $B7k2L$N@:EY$rJ]>Z$9$k$b$N$G$O$J$/(B, |
@code{setbprec()} $B$G;XDj$5$l$?(B2 $B?J7e?t$O(B, $B4]$a%b!<%I$K1~$8$?7k2L$N@:EY$rJ]>Z$9$k(B. @code{setprec()} $B$G;XDj$5$l$k(B10$B?J7e?t$O(B 2 $B?J7e?t$KJQ49$5$l$F@_Dj$5$l$k(B. |
@b{PARI} $BFbIt$GMQ$$$i$l$kI=8=$N%5%$%:$r<($9$3$H$KCm0U$9$Y$-$G$"$k(B. |
|
(@ref{eval}, @xref{pari}) |
|
|
|
@item 4 |
\E |
@b{$BJ#AG?t(B} |
\BEG |
|
Function @code{eval()} evaluates numerically its argument as far as |
|
possible. |
|
Notice that the integer given for the argument of @code{setbprec()} |
|
guarantees the accuracy of the result according to the current rounding mode. |
|
The argument of @code{setbprec()} is converted to the corresonding bit length |
|
and set. |
|
\E |
|
(@xref{eval deval}.) |
|
|
|
@item 4 |
|
\JP @b{$BJ#AG?t(B} |
|
\EG @b{complex number} |
|
@* |
|
\BJP |
$BJ#AG?t$O(B, $BM-M}?t(B, $BG\@:EYIbF0>.?t(B, @b{bigfloat} $B$r<BIt(B, $B5uIt$H$7$F(B |
$BJ#AG?t$O(B, $BM-M}?t(B, $BG\@:EYIbF0>.?t(B, @b{bigfloat} $B$r<BIt(B, $B5uIt$H$7$F(B |
@code{a+b*@@i} (@@i $B$O5u?tC10L(B) $B$H$7$FM?$($i$l$k?t$G$"$k(B. $B<BIt(B, $B5uIt$O(B |
@code{a+b*@@i} (@@i $B$O5u?tC10L(B) $B$H$7$FM?$($i$l$k?t$G$"$k(B. $B<BIt(B, $B5uIt$O(B |
$B$=$l$>$l(B @code{real()}, @code{imag()} $B$G<h$j=P$;$k(B. |
$B$=$l$>$l(B @code{real()}, @code{imag()} $B$G<h$j=P$;$k(B. |
|
\E |
|
\BEG |
|
A @b{complex} number of @b{Risa/Asir} is a number with the form |
|
@code{a+b*@@i}, where @@i is the unit of imaginary number, and @code{a} |
|
and @code{b} |
|
are either a @b{rational} number, @b{double float} number or |
|
@b{bigfloat} number, respectively. |
|
The real part and the imaginary part of a @b{complex} number can be |
|
taken out by @code{real()} and @code{imag()} respectively. |
|
\E |
|
|
@item 5 |
@item 5 |
@b{$B>.I8?t$NM-8BAGBN$N85(B} |
\JP @b{$B>.I8?t$NM-8BAGBN$N85(B} |
|
\EG @b{element of a small finite prime field} |
|
@* |
|
\BJP |
$B$3$3$G8@$&>.I8?t$H$O(B, $BI8?t$,(B 2^27 $BL$K~$N$b$N$N$3$H$G$"$k(B. $B$3$N$h$&$JM-8B(B |
$B$3$3$G8@$&>.I8?t$H$O(B, $BI8?t$,(B 2^27 $BL$K~$N$b$N$N$3$H$G$"$k(B. $B$3$N$h$&$JM-8B(B |
$BBN$O(B, $B8=:_$N$H$3$m%0%l%V%J4pDl7W;;$K$*$$$FFbItE*$KMQ$$$i$l(B, $BM-8BBN78?t$N(B |
$BBN$O(B, $B8=:_$N$H$3$m%0%l%V%J4pDl7W;;$K$*$$$FFbItE*$KMQ$$$i$l(B, $BM-8BBN78?t$N(B |
$BJ,;6I=8=B?9`<0$N78?t$r<h$j=P$9$3$H$GF@$i$l$k(B. $B$=$l<+?H$OB0$9$kM-8BBN$K4X(B |
$BJ,;6I=8=B?9`<0$N78?t$r<h$j=P$9$3$H$GF@$i$l$k(B. $B$=$l<+?H$OB0$9$kM-8BBN$K4X(B |
$B$9$k>pJs$O;}$?$:(B, @code{setmod()} $B$G@_Dj$5$l$F$$$kAG?t(B @var{p} $B$rMQ$$$F(B |
$B$9$k>pJs$O;}$?$:(B, @code{setmod()} $B$G@_Dj$5$l$F$$$kAG?t(B @var{p} $B$rMQ$$$F(B |
GF(@var{p}) $B>e$G$N1i;;$,E,MQ$5$l$k(B. |
GF(@var{p}) $B>e$G$N1i;;$,E,MQ$5$l$k(B. |
|
\E |
|
\BEG |
|
Here a small finite fieid means that its characteristic is less than |
|
2^27. |
|
At present small finite fields are used mainly |
|
for groebner basis computation, and elements in such finite fields |
|
can be extracted by taking coefficients of distributed polynomials |
|
whose coefficients are in finite fields. Such an element itself does not |
|
have any information about the field to which the element belongs, and |
|
field operations are executed by using a prime @var{p} which is set by |
|
@code{setmod()}. |
|
\E |
|
|
@item 6 |
@item 6 |
@b{$BBgI8?t$NM-8BAGBN$N85(B} |
\JP @b{$BBgI8?t$NM-8BAGBN$N85(B} |
|
\EG @b{element of large finite prime field} |
|
@* |
|
\BJP |
$BI8?t$H$7$FG$0U$NAG?t$,$H$l$k(B. |
$BI8?t$H$7$FG$0U$NAG?t$,$H$l$k(B. |
$B$3$N7?$N?t$O(B, $B@0?t$KBP$7(B@code{simp_ff} $B$rE,MQ$9$k$3$H$K$h$jF@$i$l$k(B. |
$B$3$N7?$N?t$O(B, $B@0?t$KBP$7(B@code{simp_ff} $B$rE,MQ$9$k$3$H$K$h$jF@$i$l$k(B. |
|
\E |
|
\BEG |
|
This type expresses an element of a finite prime field whose characteristic |
|
is an arbitrary prime. An object of this type is obtained by applying |
|
@code{simp_ff} to an integer. |
|
\E |
|
|
|
|
@item 7 |
@item 7 |
@b{$BI8?t(B 2 $B$NM-8BBN$N85(B} |
\JP @b{$BI8?t(B 2 $B$NM-8BBN$N85(B} |
|
\EG @b{element of a finite field of characteristic 2} |
|
@* |
|
\BJP |
$BI8?t(B 2 $B$NG$0U$NM-8BBN$N85$rI=8=$9$k(B. $BI8?t(B 2 $B$NM-8BBN(B F $B$O(B, $B3HBg<!?t(B |
$BI8?t(B 2 $B$NG$0U$NM-8BBN$N85$rI=8=$9$k(B. $BI8?t(B 2 $B$NM-8BBN(B F $B$O(B, $B3HBg<!?t(B |
[F:GF(2)] $B$r(B n $B$H$9$l$P(B, GF(2) $B>e4{Ls$J(B n $B<!B?9`<0(B f(t) $B$K$h$j(B |
[F:GF(2)] $B$r(B n $B$H$9$l$P(B, GF(2) $B>e4{Ls$J(B n $B<!B?9`<0(B f(t) $B$K$h$j(B |
F=GF(2)[t]/(f(t)) $B$H$"$i$o$5$l$k(B. $B$5$i$K(B, GF(2)[t] $B$N85(B g $B$O(B, f(t) |
F=GF(2)[t]/(f(t)) $B$H$"$i$o$5$l$k(B. $B$5$i$K(B, GF(2)[t] $B$N85(B g $B$O(B, f(t) |
$B$b4^$a$F<+A3$J;EJ}$G%S%C%HNs$H$_$J$5$l$k$?$a(B, $B7A<0>e$O(B, F $B$N85$O(B, |
$B$b4^$a$F<+A3$J;EJ}$G%S%C%HNs$H$_$J$5$l$k$?$a(B, $B7A<0>e$O(B, F $B$N85(B |
g mod f $B$O(B, g, f $B$r$"$i$o$9(B 2 $B$D$N%S%C%HNs$GI=8=$9$k$3$H$,$G$-$k(B. |
g mod f $B$O(B, g, f $B$r$"$i$o$9(B 2 $B$D$N%S%C%HNs$GI=8=$9$k$3$H$,$G$-$k(B. |
|
\E |
|
\BEG |
|
This type expresses an element of a finite field of characteristic 2. |
|
Let @var{F} be a finite field of characteristic 2. If [F:GF(2)] |
|
is equal to @var{n}, then @var{F} is expressed as F=GF(2)[t]/(f(t)), |
|
where f(t) is an irreducible polynomial over GF(2) |
|
of degree @var{n}. |
|
As an element @var{g} of GF(2)[t] can be expressed by a bit string, |
|
An element @var{g mod f} in @var{F} can be expressed by two bit strings |
|
representing @var{g} and @var{f} respectively. |
|
\E |
|
|
F $B$N85$rF~NO$9$k$$$/$D$+$NJ}K!$,MQ0U$5$l$F$$$k(B. |
\JP F $B$N85$rF~NO$9$k$$$/$D$+$NJ}K!$,MQ0U$5$l$F$$$k(B. |
|
\EG Several methods to input an element of @var{F} are provided. |
|
|
@itemize @bullet |
@itemize @bullet |
@item |
@item |
@code{@@} |
@code{@@} |
|
@* |
|
\BJP |
@code{@@} $B$O$=$N8e$m$K?t;z(B, $BJ8;z$rH<$C$F(B, $B%R%9%H%j$dFC<l$J?t$r$"$i$o$9$,(B, |
@code{@@} $B$O$=$N8e$m$K?t;z(B, $BJ8;z$rH<$C$F(B, $B%R%9%H%j$dFC<l$J?t$r$"$i$o$9$,(B, |
$BC1FH$G8=$l$?>l9g$K$O(B, F=GF(2)[t]/(f(t)) $B$K$*$1$k(B t mod f $B$r$"$i$o$9(B. |
$BC1FH$G8=$l$?>l9g$K$O(B, F=GF(2)[t]/(f(t)) $B$K$*$1$k(B t mod f $B$r$"$i$o$9(B. |
$B$h$C$F(B, @@ $B$NB?9`<0$H$7$F(B F $B$N85$rF~NO$G$-$k(B. (@@^10+@@+1 $B$J$I(B) |
$B$h$C$F(B, @@ $B$NB?9`<0$H$7$F(B F $B$N85$rF~NO$G$-$k(B. (@@^10+@@+1 $B$J$I(B) |
|
\E |
|
\BEG |
|
@code{@@} represents @var{t mod f} in F=GF(2)[t](f(t)). |
|
By using @code{@@} one can input an element of @var{F}. For example |
|
@code{@@^10+@@+1} represents an element of @var{F}. |
|
\E |
|
|
@item |
@item |
@code{ptogf2n} |
@code{ptogf2n} |
|
@* |
|
\JP $BG$0UJQ?t$N(B 1 $BJQ?tB?9`<0$r(B, @code{ptogf2n} $B$K$h$jBP1~$9$k(B F $B$N85$KJQ49$9$k(B. |
|
\BEG |
|
@code{ptogf2n} converts a univariate polynomial into an element of @var{F}. |
|
\E |
|
|
$BG$0UJQ?t$N(B 1 $BJQ?tB?9`<0$r(B, @code{ptogf2n} $B$K$h$jBP1~$9$k(B F $B$N85$KJQ49$9$k(B. |
|
|
|
@item |
@item |
@code{ntogf2n} |
@code{ntogf2n} |
|
@* |
|
\BJP |
$BG$0U$N<+A3?t$r(B, $B<+A3$J;EJ}$G(B F $B$N85$H$_$J$9(B. $B<+A3?t$H$7$F$O(B, 10 $B?J(B, |
$BG$0U$N<+A3?t$r(B, $B<+A3$J;EJ}$G(B F $B$N85$H$_$J$9(B. $B<+A3?t$H$7$F$O(B, 10 $B?J(B, |
16 $B?J(B (0x $B$G;O$^$k(B), 2 $B?J(B (0b $B$G;O$^$k(B) $B$GF~NO$,2DG=$G$"$k(B. |
16 $B?J(B (0x $B$G;O$^$k(B), 2 $B?J(B (0b $B$G;O$^$k(B) $B$GF~NO$,2DG=$G$"$k(B. |
|
\E |
|
\BEG |
|
As a bit string, a non-negative integer can be regarded as an element |
|
of @var{F}. Note that one can input a non-negative integer in decimal, |
|
hexadecimal (@code{0x} prefix) and binary (@code{0b} prefix) formats. |
|
\E |
|
|
@item |
@item |
@code{$B$=$NB>(B} |
\JP @code{$B$=$NB>(B} |
|
\EG @code{micellaneous} |
|
@* |
|
\BJP |
$BB?9`<0$N78?t$r4]$4$H(B F $B$N85$KJQ49$9$k$h$&$J>l9g(B, @code{simp_ff} |
$BB?9`<0$N78?t$r4]$4$H(B F $B$N85$KJQ49$9$k$h$&$J>l9g(B, @code{simp_ff} |
$B$K$h$jJQ49$G$-$k(B. |
$B$K$h$jJQ49$G$-$k(B. |
|
\E |
|
\BEG |
|
@code{simp_ff} is available if one wants to convert the whole |
|
coefficients of a polynomial. |
|
\E |
|
|
@end itemize |
@end itemize |
|
|
|
|
|
@item 8 |
|
\JP @b{$B0L?t(B @var{p^n} $B$NM-8BBN$N85(B} |
|
\EG @b{element of a finite field of characteristic @var{p^n}} |
|
|
|
\BJP |
|
$B0L?t$,(B @var{p^n} (@var{p} $B$OG$0U$NAG?t(B, @var{n} $B$O@5@0?t(B) $B$O(B, |
|
$BI8?t(B @var{p} $B$*$h$S(B GF(@var{p}) $B>e4{Ls$J(B @var{n} $B<!B?9`<0(B m(x) |
|
$B$r(B @code{setmod_ff} $B$K$h$j;XDj$9$k$3$H$K$h$j@_Dj$9$k(B. |
|
$B$3$NBN$N85$O(B m(x) $B$rK!$H$9$k(B GF(@var{p}) $B>e$NB?9`<0$H$7$F(B |
|
$BI=8=$5$l$k(B. |
|
\E |
|
\BEG |
|
A finite field of order @var{p^n}, where @var{p} is an arbitrary prime |
|
and @var{n} is a positive integer, is set by @code{setmod_ff} |
|
by specifying its characteristic @var{p} and an irreducible polynomial |
|
of degree @var{n} over GF(@var{p}). An element of this field |
|
is represented by a polynomial over GF(@var{p}) modulo m(x). |
|
\E |
|
|
|
@item 9 |
|
\JP @b{$B0L?t(B @var{p^n} $B$NM-8BBN$N85(B ($B>.0L?t(B)} |
|
\EG @b{element of a finite field of characteristic @var{p^n} (small order)} |
|
|
|
\BJP |
|
$B0L?t$,(B @var{p^n} $B$NM-8BBN(B (@var{p^n} $B$,(B @var{2^29} $B0J2<(B, @var{p} $B$,(B @var{2^14} $B0J>e(B |
|
$B$J$i(B @var{n} $B$O(B 1) $B$O(B, |
|
$BI8?t(B @var{p} $B$*$h$S3HBg<!?t(B @var{n} |
|
$B$r(B @code{setmod_ff} $B$K$h$j;XDj$9$k$3$H$K$h$j@_Dj$9$k(B. |
|
$B$3$NBN$N(B 0 $B$G$J$$85$O(B, @var{p} $B$,(B @var{2^14} $BL$K~$N>l9g(B, |
|
GF(@var{p^n}) $B$N>hK!72$N@8@.85$r8GDj$9$k$3$H(B |
|
$B$K$h$j(B, $B$3$N85$N$Y$-$H$7$FI=$5$l$k(B. $B$3$l$K$h$j(B, $B$3$NBN$N(B 0 $B$G$J$$85(B |
|
$B$O(B, $B$3$N$Y$-;X?t$H$7$FI=8=$5$l$k(B. @var{p} $B$,(B @var{2^14} $B0J>e(B |
|
$B$N>l9g$ODL>o$N>jM>$K$h$kI=8=$H$J$k$,(B, $B6&DL$N%W%m%0%i%`$G(B |
|
$BAPJ}$N>l9g$r07$($k$h$&$K$3$N$h$&$J;EMM$H$J$C$F$$$k(B. |
|
|
|
\E |
|
\BEG |
|
A finite field of order @var{p^n}, where @var{p^n} must be less than |
|
@var{2^29} and @var{n} must be equal to 1 if @var{p} is greater or |
|
equal to @var{2^14}, |
|
is set by @code{setmod_ff} |
|
by specifying its characteristic @var{p} the extension degree |
|
@var{n}. If @var{p} is less than @var{2^14}, each non-zero element |
|
of this field |
|
is a power of a fixed element, which is a generator of the multiplicative |
|
group of the field, and it is represented by its exponent. |
|
Otherwise, each element is represented by the redue modulo @var{p}. |
|
This specification is useful for treating both cases in a single |
|
program. |
|
\E |
|
|
|
@item 10 |
|
\JP @b{$B0L?t(B @var{p^n} $B$N>.0L?tM-8BBN$NBe?t3HBg$N85(B} |
|
\EG @b{element of a finite field which is an algebraic extension of a small finite field of characteristic @var{p^n}} |
|
|
|
\BJP |
|
$BA09`$N(B, $B0L?t$,(B @var{p^n} $B$N>.0L?tM-8BBN$N(B @var{m} $B<!3HBg$N85$G$"$k(B. |
|
$BI8?t(B @var{p} $B$*$h$S3HBg<!?t(B @var{n}, @var{m} |
|
$B$r(B @code{setmod_ff} $B$K$h$j;XDj$9$k$3$H$K$h$j@_Dj$9$k(B. $B4pACBN>e$N(B @var{m} |
|
$B<!4{LsB?9`<0$,<+F0@8@.$5$l(B, $B$=$NBe?t3HBg$N@8@.85$NDj5AB?9`<0$H$7$FMQ$$$i$l$k(B. |
|
$B@8@.85$O(B @code{@@s} $B$G$"$k(B. |
|
|
|
\E |
|
\BEG |
|
An extension field @var{K} of the small finite field @var{F} of order @var{p^n} |
|
is set by @code{setmod_ff} |
|
by specifying its characteristic @var{p} the extension degree |
|
@var{n} and @var{m}=[@var{K}:@var{F}]. An irreducible polynomial of degree @var{m} |
|
over @var{K} is automatically generated and used as the defining polynomial of |
|
the generator of the extension @var{K/F}. The generator is denoted by @code{@@s}. |
|
\E |
|
|
|
@item 11 |
|
\JP @b{$BJ,;6I=8=$NBe?tE*?t(B} |
|
\EG @b{algebraic number represented by a distributed polynomial} |
|
@* |
|
\JP @xref{$BBe?tE*?t$K4X$9$k1i;;(B}. |
|
\EG @xref{Algebraic numbers}. |
|
|
|
\BJP |
|
|
|
\E |
|
\BEG |
|
\E |
@end table |
@end table |
|
|
$BBgI8?tAGBN$NI8?t(B, $BI8?t(B 2 $B$NM-8BBN$NDj5AB?9`<0$O(B, @code{setmod_ff} |
\BJP |
$B$G@_Dj$9$k(B. |
$B>.I8?tM-8BAGBN0J30$NM-8BBN$O(B @code{setmod_ff} $B$G@_Dj$9$k(B. |
$BM-8BBN$N85$I$&$7$N1i;;$G$O(B, @code{setmod_ff} $B$K$h$j@_Dj$5$l$F$$$k(B |
$BM-8BBN$N85$I$&$7$N1i;;$G$O(B, |
modulus $B$G(B, $BB0$9$kBN$,J,$+$j(B, $B$=$NCf$G1i;;$,9T$o$l$k(B. |
|
$B0lJ}$,M-M}?t$N>l9g$K$O(B, $B$=$NM-M}?t$O<+F0E*$K8=:_@_Dj$5$l$F$$$k(B |
$B0lJ}$,M-M}?t$N>l9g$K$O(B, $B$=$NM-M}?t$O<+F0E*$K8=:_@_Dj$5$l$F$$$k(B |
$BM-8BBN$N85$KJQ49$5$l(B, $B1i;;$,9T$o$l$k(B. |
$BM-8BBN$N85$KJQ49$5$l(B, $B1i;;$,9T$o$l$k(B. |
|
\E |
|
\BEG |
|
Finite fields other than small finite prime fields are |
|
set by @code{setmod_ff}. |
|
Elements of finite fields do not have informations about the modulus. |
|
Upon an arithmetic operation, i |
|
f one of the operands is a rational number, it is automatically |
|
converted into an element of the finite field currently set and |
|
the operation is done in the finite field. |
|
\E |
|
|
|
\BJP |
@node $BITDj85$N7?(B,,, $B7?(B |
@node $BITDj85$N7?(B,,, $B7?(B |
@section $BITDj85$N7?(B |
@section $BITDj85$N7?(B |
|
\E |
|
\BEG |
|
@node Types of indeterminates,,, Data types |
|
@section Types of indeterminates |
|
\E |
|
|
@noindent |
@noindent |
|
\BJP |
$BB?9`<0$NJQ?t$H$J$jF@$kBP>]$r(B@b{$BITDj85(B}$B$H$h$V(B. @b{Asir} $B$G$O(B, |
$BB?9`<0$NJQ?t$H$J$jF@$kBP>]$r(B@b{$BITDj85(B}$B$H$h$V(B. @b{Asir} $B$G$O(B, |
$B1Q>.J8;z$G;O$^$j(B, $BG$0U8D$N%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B |
$B1Q>.J8;z$G;O$^$j(B, $BG$0U8D$N%"%k%U%!%Y%C%H(B, $B?t;z(B, @samp{_} $B$+$i$J$kJ8;zNs(B |
$B$rITDj85$H$7$F07$&$,(B, $B$=$NB>$K$b%7%9%F%`$K$h$jITDj85$H$7$F07$o$l$k$b$N(B |
$B$rITDj85$H$7$F07$&$,(B, $B$=$NB>$K$b%7%9%F%`$K$h$jITDj85$H$7$F07$o$l$k$b$N(B |
$B$,$$$/$D$+$"$k(B. @b{Asir} $B$NFbIt7A<0$H$7$F$O(B, $B$3$l$i$OA4$FB?9`<0$H$7$F$N(B |
$B$,$$$/$D$+$"$k(B. @b{Asir} $B$NFbIt7A<0$H$7$F$O(B, $B$3$l$i$OA4$FB?9`<0$H$7$F$N(B |
$B7?$r;}$D$,(B, $B?t$HF1MM(B, $BITDj85$N7?$K$h$j6hJL$5$l$k(B. |
$B7?$r;}$D$,(B, $B?t$HF1MM(B, $BITDj85$N7?$K$h$j6hJL$5$l$k(B. |
|
\E |
|
\BEG |
|
An algebraic object is recognized as an indeterminate when it can be |
|
a (so-called) variable in polynomials. |
|
An ordinary indeterminate is usually denoted by a string that start with |
|
a small alphabetical letter followed by an arbitrary number of |
|
alphabetical letters, digits or @samp{_}. |
|
In addition to such ordinary indeterminates, |
|
there are other kinds of indeterminates in a wider sense in @b{Asir}. |
|
Such indeterminates in the wider sense have type @b{polynomial}, |
|
and further are classified into sub-types of the type @b{indeterminate}. |
|
\E |
|
|
@table @code |
@table @code |
@item 0 |
@item 0 |
@b{$B0lHLITDj85(B} |
\JP @b{$B0lHLITDj85(B} |
|
\EG @b{ordinary indeterminate} |
|
@* |
|
\JP $B1Q>.J8;z$G;O$^$kJ8;zNs(B. $BB?9`<0$NJQ?t$H$7$F:G$bIaDL$KMQ$$$i$l$k(B. |
|
\BEG |
|
An object of this sub-type is denoted by a string that start with |
|
a small alphabetical letter followed by an arbitrary number of |
|
alphabetical letters, digits or @samp{_}. |
|
This kind of indeterminates are most commonly used for variables of |
|
polynomials. |
|
\E |
|
|
$B1Q>.J8;z$G;O$^$kJ8;zNs(B. $BB?9`<0$NJQ?t$H$7$F:G$bIaDL$KMQ$$$i$l$k(B. |
|
|
|
@example |
@example |
[0] [vtype(a),vtype(aA_12)]; |
[0] [vtype(a),vtype(aA_12)]; |
[0,0] |
[0,0] |
@end example |
@end example |
|
|
@item 1 |
@item 1 |
@b{$BL$Dj78?t(B} |
\JP @b{$BL$Dj78?t(B} |
|
\EG @b{undetermined coefficient} |
|
@* |
|
\BJP |
@code{uc()} $B$O(B, @samp{_} $B$G;O$^$kJ8;zNs$rL>A0$H$9$kITDj85$r@8@.$9$k(B. |
@code{uc()} $B$O(B, @samp{_} $B$G;O$^$kJ8;zNs$rL>A0$H$9$kITDj85$r@8@.$9$k(B. |
$B$3$l$i$O(B, $B%f!<%6$,F~NO$G$-$J$$$H$$$&$@$1$G(B, $B0lHLITDj85$HJQ$o$i$J$$$,(B, |
$B$3$l$i$O(B, $B%f!<%6$,F~NO$G$-$J$$$H$$$&$@$1$G(B, $B0lHLITDj85$HJQ$o$i$J$$$,(B, |
$B%f!<%6$,F~NO$7$?ITDj85$H>WFM$7$J$$$H$$$&@-<A$rMxMQ$7$FL$Dj78?t$N(B |
$B%f!<%6$,F~NO$7$?ITDj85$H>WFM$7$J$$$H$$$&@-<A$rMxMQ$7$FL$Dj78?t$N(B |
$B<+F0@8@.$J$I$KMQ$$$k$3$H$,$G$-$k(B. |
$B<+F0@8@.$J$I$KMQ$$$k$3$H$,$G$-$k(B. |
|
\E |
|
\BEG |
|
The function @code{uc()} creates an indeterminate which is denoted by |
|
a string that begins with @samp{_}. Such an indeterminate cannot be |
|
directly input by its name. Other properties are the same as those of |
|
@b{ordinary indeterminate}. Therefore, it has a property that it cannot |
|
cause collision with the name of ordinary indeterminates input by the |
|
user. And this property is conveniently used to create undetermined |
|
coefficients dynamically by programs. |
|
\E |
|
|
@example |
@example |
[1] U=uc(); |
[1] U=uc(); |
|
|
@end example |
@end example |
|
|
@item 2 |
@item 2 |
@b{$BH!?t7A<0(B} |
\JP @b{$BH!?t7A<0(B} |
|
\EG @b{function form} |
|
@* |
|
\BJP |
$BAH$_9~$_H!?t(B, $B%f!<%6H!?t$N8F$S=P$7$O(B, $BI>2A$5$l$F2?$i$+$N(B @b{Asir} $B$N(B |
$BAH$_9~$_H!?t(B, $B%f!<%6H!?t$N8F$S=P$7$O(B, $BI>2A$5$l$F2?$i$+$N(B @b{Asir} $B$N(B |
$BFbIt7A<0$KJQ49$5$l$k$,(B, @code{sin(x)}, @code{cos(x+1)} $B$J$I$O(B, $BI>2A8e(B |
$BFbIt7A<0$KJQ49$5$l$k$,(B, @code{sin(x)}, @code{cos(x+1)} $B$J$I$O(B, $BI>2A8e(B |
$B$b$=$N$^$^$N7A$GB8:_$9$k(B. $B$3$l$OH!?t7A<0$H8F$P$l(B, $B$=$l<+?H$,(B 1 $B$D$N(B |
$B$b$=$N$^$^$N7A$GB8:_$9$k(B. $B$3$l$OH!?t7A<0$H8F$P$l(B, $B$=$l<+?H$,(B 1 $B$D$N(B |
$BITDj85$H$7$F07$o$l$k(B. $B$^$?$d$dFC<l$JNc$H$7$F(B, $B1_<~N((B @code{@@pi} $B$d(B |
$BITDj85$H$7$F07$o$l$k(B. $B$^$?$d$dFC<l$JNc$H$7$F(B, $B1_<~N((B @code{@@pi} $B$d(B |
$B<+A3BP?t$NDl(B @code{@@e} $B$bH!?t7A<0$H$7$F07$o$l$k(B. |
$B<+A3BP?t$NDl(B @code{@@e} $B$bH!?t7A<0$H$7$F07$o$l$k(B. |
|
\E |
|
\BEG |
|
A function call to a built-in function or to an user defined function |
|
is usually evaluated by @b{Asir} and retained in a proper internal form. |
|
Some expressions, however, will remain in the same form after evaluation. |
|
For example, @code{sin(x)} and @code{cos(x+1)} will remain as if they |
|
were not evaluated. These (unevaluated) forms are called |
|
`function forms' and are treated as if they are indeterminates in a |
|
wider sense. Also, special forms such as @code{@@pi} the ratio of |
|
circumference and diameter, and @code{@@e} Napier's number, will be |
|
treated as `function forms.' |
|
\E |
|
|
@example |
@example |
[3] V=sin(x); |
[3] V=sin(x); |
|
|
@end example |
@end example |
|
|
@item 3 |
@item 3 |
@b{$BH!?t;R(B} |
\JP @b{$BH!?t;R(B} |
|
\EG @b{functor} |
$BH!?t8F$S=P$7$O(B, @var{fname(args)} $B$H$$$&7A$G9T$J$o$l$k$,(B, @var{fname} $B$N(B |
@* |
|
\BJP |
|
$BH!?t8F$S=P$7$O(B, @var{fname}(@var{args}) $B$H$$$&7A$G9T$J$o$l$k$,(B, @var{fname} $B$N(B |
$BItJ,$rH!?t;R$H8F$V(B. $BH!?t;R$K$O(B, $BH!?t$N<oN`$K$h$jAH$_9~$_H!?t;R(B, |
$BItJ,$rH!?t;R$H8F$V(B. $BH!?t;R$K$O(B, $BH!?t$N<oN`$K$h$jAH$_9~$_H!?t;R(B, |
$B%f!<%6Dj5AH!?t;R(B, $B=iEyH!?t;R$J$I$,$"$k$,(B, $BH!?t;R$OC1FH$GITDj85$H$7$F(B |
$B%f!<%6Dj5AH!?t;R(B, $B=iEyH!?t;R$J$I$,$"$k$,(B, $BH!?t;R$OC1FH$GITDj85$H$7$F(B |
$B5!G=$9$k(B. |
$B5!G=$9$k(B. |
|
\E |
|
\BEG |
|
A function call (or a function form) has a form @var{fname}(@var{args}). |
|
Here, @var{fname} alone is called a @b{functor}. |
|
There are several kinds of @b{functor}s: built-in functor, user defined |
|
functor and functor for the elementary functions. A functor alone is |
|
treated as an indeterminate in a wider sense. |
|
\E |
|
|
@example |
@example |
[6] vtype(sin); |
[6] vtype(sin); |