File: [local] / OpenXM / src / asir-doc / parts / builtin / type.texi (download)
Revision 1.4, Sun Dec 21 17:36:29 2003 UTC (20 years, 8 months ago) by ohara
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, KNOPPIX_2006, HEAD, DEB_REL_1_2_3-9 Changes since 1.3: +3 -1
lines
Explanations for function forms
|
@comment $OpenXM: OpenXM/src/asir-doc/parts/builtin/type.texi,v 1.4 2003/12/21 17:36:29 ohara Exp $
\BJP
@node $B7?$r5a$a$kH!?t(B,,, $BAH$_9~$_H!?t(B
@section $B7?$r5a$a$kH!?t(B
\E
\BEG
@node Types,,, Built-in Function
@section Types
\E
@menu
* type::
* ntype::
* vtype::
@end menu
\JP @node type,,, $B7?$r5a$a$kH!?t(B
\EG @node type,,, Types
@subsection @code{type}
@findex type
@table @t
@item type(@var{obj})
\JP :: @var{obj} $B$N(B $B7?(B ($B@0?t(B) $B$rJV$9(B.
\EG :: Returns an integer which identifies the type of the object @var{obj} in question.
@end table
@table @var
@item return
\JP $B@0?t(B
\EG integer
@item obj
\JP $BG$0U(B
\EG arbitrary
@end table
@itemize @bullet
\BJP
@item
@var{obj} $B$N(B $B7?$NCM$O<!$NDL$j(B.
@table @t
@item 0
0
@item 1
$B?t(B
@item 2
$BB?9`<0(B ($B?t$G$J$$(B)
@item 3
$BM-M}<0(B ($BB?9`<0$G$J$$(B)
@item 4
$B%j%9%H(B
@item 5
$B%Y%/%H%k(B
@item 6
$B9TNs(B
@item 7
$BJ8;zNs(B
@item 8
$B9=B$BN(B
@item 9
$BJ,;6I=8=B?9`<0(B
@item 10
32bit $BId9f$J$7@0?t(B
@item 11
$B%(%i!<%*%V%8%'%/%H(B
@item 12
GF(2) $B>e$N9TNs(B
@item 13
MATHCAP $B%*%V%8%'%/%H(B
@item 14
$B0l3,=R8lO@M}<0(B
@item -1
VOID $B%*%V%8%'%/%H(B
@end table
@item
$B?t$N7?$r5a$a$k$K$O(B, @code{ntype} $B$rMQ$$$k(B.
$BITDj85$N7?$r5a$a$k$K$O(B, @code{vtype} $B$rMQ$$$k(B.
\E
\BEG
@item
Current assignment of integers for object types is listed below.
@table @t
@item 0
0
@item 1
number
@item 2
polynomial (not number)
@item 3
rational expression (not polynomial)
@item 4
list
@item 5
vector
@item 6
matrix
@item 7
string
@item 8
structure
@item 9
distributed polynomial
@item 10
32bit unsigned integer
@item 11
error object
@item 12
matrix over GF(2)
@item 13
MATHCAP object
@item 14
first order formula
@item -1
VOID object
@end table
@item
For further classification of @var{number}, use @code{ntype()}.
For further classification of @var{variable}, use @code{vtype()}.
\E
@end itemize
@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{ntype}, @fref{vtype}.
@end table
\JP @node ntype,,, $B7?$r5a$a$kH!?t(B
\EG @node ntype,,, Types
@subsection @code{ntype}
@findex ntype
@table @t
@item ntype(@var{num})
\JP :: @var{num} ($B?t(B) $B$N(B $B7?(B ($B@0?t(B) $B$rJV$9(B.
\EG :: Classifier of type @var{num}. Returns a sub-type number, an integer, for @var{obj}.
@end table
@table @var
@item return
\JP $B<+A3?t(B
\EG integer
@item obj
\JP $B?t(B
\EG number
@end table
@itemize @bullet
\BJP
@item
$B?t$N7?$NCM$O<!$NDL$j(B.
@table @t
@item 0
$BM-M}?t(B
@item 1
$BG\@:EYIbF0>.?t(B
@item 2
$BBe?tE*?t(B
@item 3
$BG$0U@:EYIbF0>.?t(B (@b{bigfloat})
@item 4
$BJ#AG?t(B
@item 5
$BM-8BBN$N85(B
@item 6
$BBgI8?tAGBN$N85(B
@item 7
$BI8?t(B 2 $B$NM-8BBN$N85(B
@end table
@item
@code{newalg(x^2+1)} $B$G@8@.$7$??t$H(B, $B5u?tC10L(B @code{@@i} $B$O(B,
$B0[$J$k$b$N$H$7$F07$o$l$k(B.
@item
$BBe?tE*?t$K4X$7$F$O(B, @xref{$BBe?tE*?t$K4X$9$k1i;;(B}.
\E
\BEG
@item
Sub-types for type number are listed below.
@table @t
@item 0
rational number
@item 1
floating double (double precision floating point number)
@item 2
algebraic number over rational number field
@item 3
arbitrary precision floating point number (@b{bigfloat})
@item 4
complex number
@item 5
element of a finite field
@item 6
element of a large finite prime field
@item 7
element of a finite field of characteristic 2
@end table
@item
When arithmetic operations for numbers are performed,
type coercion will be taken if their number sub-types are different
so that the object having smaller sub-type number will be transformed
to match the other object, except for algebraic numbers.
@item
A number object created by @code{newalg(x^2+1)} and the unit of
imaginary number @code{@@i} have different number sub-types, and
it is treated independently.
@item
See @ref{Algebraic numbers} for algebraic numbers.
\E
@end itemize
@example
[0] [10/37,ntype(10/37)];
[10/37,0]
[1] [10.0/37.0,ntype(10.0/37.0)];
[0.27027,1]
[2] [newalg(x^2+1)+1,ntype(newalg(x^2+1)+1)];
[(#0+1),2]
[3] [eval(sin(@@pi/6)),ntype(eval(sin(@@pi/6)))];
[0.49999999999999999991,3]
[4] [@@i+1,ntype(@@i+1)];
[(1+1*@@i),4]
@end example
@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{type}.
@end table
\JP @node vtype,,, $B7?$r5a$a$kH!?t(B
\EG @node vtype,,, Types
@subsection @code{vtype}
@findex vtype
@table @t
@item vtype(@var{var})
\JP :: @var{var} ($BITDj85(B) $B$N(B $B7?(B ($B@0?t(B) $B$rJV$9(B.
\EG :: Type of indetarminates @var{var}.
@end table
@table @var
@item return
\JP $B@0?t(B
\EG integer
@item var
\JP $BITDj85(B
\EG indeterminate
@end table
@itemize @bullet
\BJP
@item
@var{var} ($BITDj85(B) $B$N7?$NCM$O<!$NDL$j(B. $B>\:Y$O(B @xref{$BITDj85$N7?(B}.
@table @t
@item 0
$B0lHLITDj85(B (a,b,x,afo,bfo,...,etc)
@item 1
@code{uc()} $B$G@8@.$5$l$?ITDj85(B (@code{_0}, @code{_1}, @code{_2}, ... etc)
@item 2
$BH!?t7A<0(B (@code{sin(x)}, @code{log(a+1)}, @code{acosh(1)}, @code{@@pi}, @code{@@e}, ... etc)
@item 3
$BH!?t;R(B ($BAH$_9~$_H!?t;R(B, $B%f!<%6Dj5AH!?t;R(B, $B=iEyH!?t;R(B : @code{sin}, @code{log}, ... etc)
@end table
@item
@code{a();} $B$r<B9T(B($BDL>o$G$O%(%i!<(B)$B$7$?$@$1$G$b(B @code{ntype(a)} $B$O(B 3 $B$H$J$k(B.
$B$9$J$o$A(B @code{a} $B$O%f!<%6Dj5AH!?t;R$H$_$J$5$l$k(B.
@item
$B%f!<%6$,H!?t7A<0$rDj5A$9$k$?$a$K$O%-!<%o!<%I(B @code{function} $B$rMQ$$$k(B.
@item
@code{@@pi}, @code{@@e} $B$OITDj85$H$7$F07$o$l$k$,(B, @code{eval()}, @code{pari()}
$B$K$*$$$F$O?t$H$7$F07$o$l$k(B.
\E
\BEG
@item
Classify indeterminates into sub-types by giving an integer value as follows.
For details @xref{Types of indeterminates}.
@table @t
@item 0
ordinary indeterminate, which can be directly typed in on a keyboard
(a,b,x,afo,bfo,...,etc.)
@item 1
Special indeterminate, created by @code{uc()}
(@code{_0}, @code{_1}, @code{_2}, ... etc.)
@item 2
function form (@code{sin(x)}, @code{log(a+1)}, @code{acosh(1)}, @code{@@pi}, @code{@@e}, ... etc.)
@item 3
functor (built-in functor name, user defined functor, functor for
the elementary functions)
: @code{sin}, @code{log}, ... etc)
@end table
@item
Note: An input `@code{a();}' will cause an error, but it changes
the system database for identifiers. After this error, you will find
`@code{vtype(a)}' will result 3. (Identifier @code{a} is registered as
a user defined functor).
@item
Usually @code{@@pi} and @code{@@e} are treated as indeterminates,
whereas they are treated as numbers within functions @code{eval()} and
@code{pari()}.
\E
@end itemize
@table @t
\JP @item $B;2>H(B
\EG @item References
@fref{type}, @fref{ntype}, @fref{uc}.
@end table