[BACK]Return to exp-ja.texi CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-doc / exp

Annotation of OpenXM/src/asir-doc/exp/exp-ja.texi, Revision 1.61

1.61    ! takayama    1: %% $OpenXM: OpenXM/src/asir-doc/exp/exp-ja.texi,v 1.60 2021/01/19 23:52:34 takayama Exp $
1.54      takayama    2: \input texinfo-ja
1.1       takayama    3: @iftex
                      4: @catcode`@#=6
                      5: @def@fref#1{@xrefX[#1,,@code{#1},,,]}
1.58      noro        6: @def@b#1{{@bf #1}}
1.1       takayama    7: @catcode`@#=@other
                      8: @end iftex
                      9: @overfullrule=0pt
                     10: @c -*-texinfo-*-
                     11: @comment %**start of header
1.59      noro       12: @comment --- おまじない終り ---
1.1       takayama   13:
1.59      noro       14: @comment --- GNU info ファイルの名前 ---
1.58      noro       15: @setfilename exp
                     16: @documentlanguage ja
1.1       takayama   17:
1.59      noro       18: @comment --- タイトル ---
                     19: @settitle 実験的仕様の関数
1.1       takayama   20:
                     21: @comment %**end of header
                     22: @comment %@setchapternewpage odd
                     23:
1.59      noro       24: @comment --- おまじない ---
1.1       takayama   25: @ifinfo
                     26: @macro fref{name}
                     27: @ref{\name\,,@code{\name\}}
                     28: @end macro
                     29: @end ifinfo
                     30:
                     31: @iftex
                     32: @comment @finalout
                     33: @end iftex
                     34:
                     35: @titlepage
1.59      noro       36: @comment --- おまじない終り ---
1.1       takayama   37:
1.59      noro       38: @comment --- タイトル, バージョン, 著者名, 著作権表示 ---
                     39: @title 実験的仕様の関数
                     40: @subtitle Risa/Asir 実験的仕様関数説明書
                     41: @subtitle 1.0 版
                     42: @subtitle 2018 年 3 月
1.1       takayama   43:
1.16      ohara      44: @author  by Risa/Asir committers
1.1       takayama   45: @page
                     46: @vskip 0pt plus 1filll
                     47: Copyright @copyright{} Risa/Asir committers
1.56      takayama   48: 2004--2018. All rights reserved.
1.1       takayama   49: @end titlepage
                     50:
1.59      noro       51: @comment --- おまじない ---
1.1       takayama   52: @synindex vr fn
1.59      noro       53: @comment --- おまじない終り ---
1.1       takayama   54:
1.59      noro       55: @comment --- @node は GNU info, HTML 用 ---
                     56: @comment --- @node  の引数は node-name,  next,  previous,  up ---
1.1       takayama   57: @node Top,, (dir), (dir)
                     58:
1.59      noro       59: @comment --- @menu は GNU info, HTML 用 ---
                     60: @comment --- chapter 名を正確に並べる ---
                     61: @comment --- この文書では chapter XYZ, Chapter Index がある.
                     62: @comment ---  Chapter XYZ には section XYZについて, section XYZに関する関数がある.
1.1       takayama   63: @menu
1.59      noro       64: * 実験的仕様の関数説明書について::
                     65: * 実験的仕様の関数::
1.1       takayama   66: * Index::
                     67: @end menu
                     68:
1.59      noro       69: @comment --- chapter の開始 ---
                     70: @comment --- 親 chapter 名を正確に. 親がない場合は Top ---
                     71: @node 実験的仕様の関数説明書について,,, Top
                     72: @chapter 実験的仕様の関数説明書について
                     73:
                     74: この説明書では
                     75: @b{Asir} に導入された実験的仕様の関数について説明する.
                     76: 正式な関数として導入されたものの記述は Risa/Asir マニュアル
                     77: に移動される.
                     78: ChangeLog の項目は www.openxm.org の cvsweb で
                     79: ソースコードを読む時の助けになる情報が書かれている.
1.1       takayama   80:
1.59      noro       81: @node 実験的仕様の関数,,, Top
                     82: @chapter 実験的仕様の関数
1.1       takayama   83:
1.59      noro       84: @comment --- section ``実験的関数'' の subsection xyz_abc
                     85: @comment --- subsection xyz_pqr xyz_stu がある.
1.1       takayama   86: @menu
1.55      takayama   87: * asir-port.sh asir-install.sh::
                     88: * asirgui.hnd::
                     89: * chdir pwd::
1.3       takayama   90: * copyright::
1.55      takayama   91: * dcurrenttime::
1.3       takayama   92: * dp_gr_main::
1.6       takayama   93: * dp_initial_term::
                     94: * dp_order::
                     95: * dp_weyl_gr_main::
1.55      takayama   96: * eval_quote::
                     97: * f_res::
1.57      takayama   98: * fj_simplify.simplify::
1.55      takayama   99: * flatten_quote::
1.56      takayama  100: * function::
1.55      takayama  101: * get_struct_name get_element_names get_element_at put_element_at::
                    102: * getpid::
                    103: * initialize_static_variable::
1.8       takayama  104: * list::
                    105: * mapat::
1.59      noro      106: * nd_sba nd_sba_f4::
1.55      takayama  107: * nd_gr nd_gr_trace nd_weyl_gr nd_weyl_gr_trace (module)::
                    108: * nd_gr nd_gr_trace nd_weyl_gr nd_weyl_gr_trace (option)::
                    109: * noro_matrix.rr::
                    110: * nqt_comp::
1.23      takayama  111: * nqt_match::
                    112: * nqt_match_rewrite::
1.55      takayama  113: * objtoquote::
                    114: * ot_hgm_ahg.cbase::
                    115: * ot_hgm_ahg.get_mat2::
                    116: * ot_hgm_ahg.hgm_ahg_contiguity::
                    117: * pari setbprec setround todouble mpfr_gamma mpfr_floor mpfr_round::
                    118: * printf fprintf sprintf::
                    119: * qt_is_var qt_is_coef::
1.23      takayama  120: * qt_normalize::
1.55      takayama  121: * qt_rewrite::
1.23      takayama  122: * qt_set_coef::
                    123: * qt_set_ord::
                    124: * qt_set_weight::
1.55      takayama  125: * quote_to_funargs funargs_to_quote remove_paren get_function_name::
                    126: * quotetotex quotetotex_env::
                    127: * set_print_function::
                    128: * set_secure_flag set_secure_mode::
                    129: * small_jacobi::
                    130: * string_to_tb tb_to_string write_to_tb::
                    131: * tk_fd.abc2ahg::
                    132: * tk_fd.ahvec_abc::
                    133: * tk_hgpoly.hgpoly::
                    134: * tk_hgpoly.optip::
                    135: * tk_jack.zonal::
                    136: * tk_pfn.graph::
1.41      takayama  137: * tk_pfn.rkn::
                    138: * tk_rk.runge_kutta_4::
                    139: * tk_rk.runge_kutta_4_linear::
1.34      ohara     140: @end menu
1.23      takayama  141:
1.59      noro      142: @node クオート,,, 実験的仕様の関数
                    143: @section クオート
1.1       takayama  144:
1.59      noro      145: @comment --- ◯◯◯◯  関数 quotetotex, quotetotex_env の説明 ◯◯◯◯
                    146: @comment --- 個々の関数の説明の開始 ---
                    147: @comment --- section 名を正確に ---
                    148: @node quotetotex quotetotex_env,,, クオート
1.2       takayama  149: @subsection @code{quotetotex}, @code{quotetotex_env}
1.59      noro      150: @comment --- 索引用キーワード
1.2       takayama  151: @findex quotetotex
                    152: @findex quotetotex_env
1.1       takayama  153:
1.59      noro      154: @comment --- 関数の簡単な説明 ---
1.1       takayama  155: @table @t
1.34      ohara     156: @item quotetotex(@var{q})
1.59      noro      157: :: @var{q} を latex 形式で表現した文字列に変換する.
1.2       takayama  158: @item quotetotex_env(@var{key},@var{value})
1.59      noro      159: :: quotetotex の動作を制御するパラメータを変更する.
1.2       takayama  160: @item quotetotex_env()
1.59      noro      161: :: quotetotex の動作を制御するパラメータの現在値を戻す.
1.2       takayama  162: @item quotetotex_env(0)
1.59      noro      163: :: quotetotex の動作を制御するパラメータをデフォールト値に戻す.
1.1       takayama  164: @end table
                    165:
1.59      noro      166: @comment --- 引数の簡単な説明 ---
1.1       takayama  167: @table @var
                    168: @item return
1.59      noro      169: 文字列(quotetotex) または リストまたはオブジェクト(quotetotex_env)
1.2       takayama  170: @item q
                    171: quote
                    172: @item key
1.59      noro      173: 文字列
1.2       takayama  174: @item value
1.59      noro      175: オブジェクト
1.1       takayama  176: @end table
                    177:
1.59      noro      178: @comment --- ここで関数の詳しい説明 ---
                    179: @comment --- @itemize〜@end itemize は箇条書き ---
                    180: @comment --- @bullet は黒点付き ---
1.1       takayama  181: @itemize @bullet
                    182: @item
1.59      noro      183: quotetotex は @var{q} を latex 形式で表現した文字列に変換する.
1.34      ohara     184: @item
1.59      noro      185: 以下 quotetotex_env のパラメータの意味を説明する.
1.34      ohara     186: @item
1.59      noro      187: conv_rule: 3 ビットを用いて変換ルールを指定する.
                    188: 0ビット目は symbol_table による変換を行うか,
                    189: 1ビット目は添字変換を行うか,
                    190: 2ビット目は d から始まる変数名を微分作用素とみなして処理するか,
                    191: を意味する.
                    192: たとえば conv_rule として 3 を指定すると,
                    193: 0ビット目, 1 ビット目が 1 となるので
                    194: symbol_table による変換を行い, 添字変換をおこなう.
                    195: 添字変換は数字と英字の境目および _ 記号を区切りとする.
                    196: symbol_table による変換が最初に適用される.
                    197: alpha, beta, 等は自動的をギリシャ文字に変換するテーブルは
                    198: 内蔵ずみ.
1.34      ohara     199: @item
1.59      noro      200:   dp_vars_prefix: 分散表現多項式は
1.34      ohara     201:   @iftex
                    202:   @tex
1.5       takayama  203:   $x_0, x_1, \cdots$
1.34      ohara     204:   @end tex
                    205:   @end iftex
                    206:   @ifinfo
                    207:   x0, x1, ...
                    208:   @end ifinfo
1.59      noro      209:   の多項式として latex 形式に変換されるがこの
                    210:   x の部分を変更する.
1.34      ohara     211: @item
1.59      noro      212:   dp_vars_origin: インデックスの始まりの値を指定する.
                    213:   デフォールトは 0.
1.1       takayama  214: @item
1.59      noro      215: dp_vars_hweyl: 分散表現多項式をワイル代数の元とみなして
                    216: latex 形式に変換する.
                    217: 偶数個変数があるときは 最初の半分を
1.34      ohara     218: @iftex
                    219: @tex
1.2       takayama  220: $x_0, x_1, \cdots$
1.34      ohara     221: @end tex
1.59      noro      222: に後半の半分を
1.34      ohara     223: @tex
1.2       takayama  224: $\partial_0, \partial_1, \cdots$
1.34      ohara     225: @end tex
                    226: @end iftex
                    227: @ifinfo
1.59      noro      228: x0, x1, ... に後半の半分を dx0, dx1, ...
1.34      ohara     229: @end ifinfo
1.59      noro      230: に変換する.
                    231: 奇数個の場合は最後の変数が同時化変数として h で表示される.
1.5       takayama  232: @item
1.59      noro      233:   dp_dvars_prefix: dp_vars_hweyl が 1 の時に後半部分の prefix を指定する.
                    234:   デフォールトは @tex $\partial$ @end tex
1.5       takayama  235: @item
1.59      noro      236:   dp_dvars_origin: dp_vars_hweyl が 1 の時のインデックスの始まりの値.
1.34      ohara     237: @item
1.59      noro      238: conv_func: ユーザ定義の変換関数をよぶ.
1.1       takayama  239: @end itemize
                    240:
1.59      noro      241: @comment --- @example〜@end example は実行例の表示 ---
1.1       takayama  242: @example
1.2       takayama  243: [3] quotetotex(quote(1/(x+1)));
                    244: \frac@{ 1@} @{ (  @{x@}+ 1)@}
                    245: [4]  quotetotex(objtoquote(diff(x^x,x)));
                    246:    @{x@}^@{  @{x@}- 1@}   @{x@}+  \log( @{x@})   @{x@}^@{ @{x@}@}
                    247: [5] quotetotex_env("conv_rule",3);
                    248: [6] quotetotex(objtoquote( (alpha2beta+x_i_j)^2));
                    249:   @{\alpha@}_@{2,\beta@}^@{ 2@} +   2  @{x@}_@{i,j@}  @{\alpha@}_@{2,\beta@}+  @{x@}_@{i,j@}^@{ 2@}
1.1       takayama  250: @end example
                    251:
1.59      noro      252: @comment --- 参照(リンク)を書く ---
1.1       takayama  253: @table @t
1.59      noro      254: @item 参照
1.2       takayama  255: @ref{objtoquote}
1.3       takayama  256: print_tex_form(contrib)
1.1       takayama  257: @end table
                    258:
1.59      noro      259: @comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.1       takayama  260: @noindent
                    261: ChangeLog
                    262: @itemize @bullet
1.34      ohara     263: @item
1.59      noro      264:  この関数は 2004年2月末から3月にかけて asir を
                    265:  knoppix 版 texmacs に対応させるために書かれた.
                    266:  Asir-contrib の print_tex_form がその原型であり, それを効率化しまた
                    267:  出力形式を改善した.
                    268:  OpenXM/src/kxx/ox_texmacs.c, OpenXM/src/texmacs も参照.
1.34      ohara     269: @item
                    270:  OpenXM/src/asir-contrib/packages/src/noro_print.rr 1.1--1.8,
1.59      noro      271:  noro_print_default.rr 1.1--1.3 も参照.
1.34      ohara     272: @item
1.59      noro      273:  変更を受けたファイルは OpenXM_contrib2/asir2000 の下の次のファイル.
1.3       takayama  274:   builtin/strobj.c 1.14--1.43,
                    275:   include/ca.h 1.46, io/cexpr.c 1.18, io/pexpr.c 1.32, io.sexpr.c 1.29,
                    276:   parse/arith.c 1.12, parse/parse.h 1.28--1.29,
                    277:   parse/quote.c 1.7--1.8, 1.12.
1.34      ohara     278: @item
1.59      noro      279:   knoppix/math は 福岡大学の濱田さんが中心となり開発されている.
1.34      ohara     280: @item
1.59      noro      281:   dp_dvars_prefix, *_origin は builtin/strobj.c 1.46 で導入された.
1.5       takayama  282: @item
1.59      noro      283:   Todo: quotetoterminalform (分散表現多項式の見易い出力).
1.3       takayama  284: @end itemize
                    285:
                    286:
                    287:
1.59      noro      288: @comment --- ◯◯◯◯  関数 objtoquote の説明 ◯◯◯◯
                    289: @node objtoquote,,, クオート
1.3       takayama  290: @subsection @code{objtoquote}
                    291: @findex objtoquote
                    292:
1.59      noro      293: @comment --- 関数の簡単な説明 ---
1.3       takayama  294: @table @t
                    295: @item objtoquote(@var{ob})
1.59      noro      296: :: オブジェクトと quote 型のデータに変換する.
1.3       takayama  297: @end table
                    298:
                    299: @table @var
                    300: @item return
                    301: quote
                    302: @item ob
1.59      noro      303: オブジェクト
1.3       takayama  304: @end table
                    305:
                    306: @itemize @bullet
                    307: @item
1.59      noro      308: @code{objtoquote(ob)} は, @var{ob} を quote 型のデータに変換する.
1.3       takayama  309: @end itemize
                    310:
                    311: @example
                    312: [1150] quotetolist(quote(1+2));
                    313: [b_op,+,[internal,1],[internal,2]]
                    314: [1151] quotetolist(objtoquote(1+x));
                    315: [b_op,+,[internal,x],[internal,1]]3
                    316: @end example
                    317:
                    318: @table @t
1.59      noro      319: @item 参照
1.3       takayama  320: @ref{quotetotex} @ref{quotetolist}
                    321: @end table
                    322:
1.59      noro      323: @comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.3       takayama  324: @noindent
                    325: ChangeLog
                    326: @itemize @bullet
1.59      noro      327: @item この関数は quotetotex の前処理をするために書かれた.
                    328: @item asir-contrib の関数 quote_to_quote も参照.
1.3       takayama  329: @item OpenXM_contrib2/asir2000/builtin/print.c 1.16.
                    330: @end itemize
                    331:
                    332:
1.59      noro      333: @node flatten_quote,,, クオート
1.34      ohara     334: @subsection @code{flatten_quote}
                    335: @findex flatten_quote
1.3       takayama  336:
1.59      noro      337: @comment --- 関数の簡単な説明 ---
1.3       takayama  338: @table @t
1.34      ohara     339: @item flatten_quote(@var{q},@var{op})
1.59      noro      340: :: quote の括弧をとりさる.
1.3       takayama  341: @end table
                    342:
                    343: @table @var
                    344: @item return
1.34      ohara     345: Quote
                    346: @item q
                    347: Quote
                    348: @item op
1.59      noro      349: 演算子を表す文字列.
1.3       takayama  350: @end table
                    351:
                    352: @itemize @bullet
                    353: @item
1.59      noro      354: Quote 型のデータは木構造をしている
                    355: ( quotetolist 参照 ).
                    356: @code{quote_flatten()} は, @var{q} の中にあられる演算子 @var{op}
                    357: の子供ノードを平等にする.
                    358: つまり演算子 @var{op} に関する括弧づけがあった場合それをすべてとりさる.
                    359: たとえば (1+2)+(3+4) という表現を 1+2+3+4 に変換する.
1.34      ohara     360: @item
1.59      noro      361:  現在の実装では n-ary の演算子は定義されていないので,
                    362:  1+2+3 は実は 1+(2+3) と表現されている.
                    363:  つまり + 演算子は右結合的である.
                    364: @item  R=0; for (I=0; I<N; I++) R = R+ P[I]; なる足し算を繰り返すと,
                    365:   + は左結合的になる. 右結合的に変換するには flatten_quote を呼ぶ.
                    366: @item 名前は quote_flatten でなく flatten_quote である.
1.3       takayama  367: @end itemize
                    368:
                    369: @example
1.34      ohara     370: [1288] flatten_quote(quote((1+2)+(3+4*(x+3))),"+");
                    371: quote(1+2+3+4*(x+3))
                    372: [1289] flatten_quote(quote( (x*y)*(p*3)-(x*y)*z),"*");
                    373: quote(x*y*p*3-x*y*z)
                    374: [1290] quotetolist(quote(1+2+3));
                    375: [b_op,+,[b_op,+,[internal,1],[internal,2]],[internal,3]]
1.3       takayama  376: @end example
                    377:
1.34      ohara     378: @table @t
1.59      noro      379: @item 参照
1.34      ohara     380: @ref{quotetolist}, @ref{print_tex_form}(contrib)
                    381: @end table
                    382:
1.59      noro      383: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.3       takayama  384: @noindent
                    385: ChangeLog
                    386: @itemize @bullet
1.34      ohara     387: @item
1.59      noro      388:  この関数は 2004-7-7 から 2004-7-8 にかけて
                    389:  quote に関する操作を研究するために実験的に書かれた.
                    390:  OpenXM/fb で蓄積された公式の不要な括弧をとりはずし, tex 形式に変換するのに
                    391:  応用.
1.34      ohara     392: @item
1.59      noro      393:  変更をうけたソースコードは
1.34      ohara     394:  builtin/strobj.c 1.47,
                    395:  parse/eval.c 1.35,
                    396:  parse/parse.h 1.31,
                    397:  parse/quote.c 1.14--1.16.
1.3       takayama  398: @end itemize
                    399:
                    400:
1.59      noro      401: @node quote_to_funargs funargs_to_quote remove_paren get_function_name,,, クオート
1.55      takayama  402: @subsection @code{quote_to_funargs}, @code{funargs_to_quote}, @code{remove_paren}, @code{get_function_name}
1.34      ohara     403: @findex quote_to_funargs
                    404: @findex funargs_to_quote
                    405: @findex remove_paren
1.55      takayama  406: @findex get_function_name
1.3       takayama  407:
                    408: @table @t
1.34      ohara     409: @item quote_to_funargs(@var{q})
1.59      noro      410: ::  quote を funarg 形式(リスト) へ.
1.34      ohara     411: @item funargs_to_quote(@var{f})
1.59      noro      412: ::  funarg 形式を quote へ.
1.34      ohara     413: @item get_function_name(@var{f})
1.59      noro      414: ::  funarg 形式の op を文字列へ.
1.34      ohara     415: @item remove_paren(@var{q})
1.59      noro      416: ::  上の関数を用いて書かれた余分な括弧を取り去る simplifier (asir-contrib マニュアルへ: todo)
1.3       takayama  417: @end table
                    418:
                    419: @table @var
                    420: @item return
1.59      noro      421: quote(funargs_to_quote, remove_paren) か リスト(quote_to_funargs)
1.34      ohara     422: @item q
                    423: quote
                    424: @item f
1.59      noro      425: リスト
1.3       takayama  426: @end table
                    427:
                    428: @itemize @bullet
                    429: @item
1.59      noro      430:  @code{quote_to_funargs} は quote 型のデータ (内部的には FNODE) を
                    431: quote への復元可能な形でリストへ変換する.
                    432: @code{quotetolist} は quote をリストへ変換するが, 一部の情報を捨てるため
                    433: もとの quote の復元はできない.
1.34      ohara     434: @item
1.59      noro      435:  @code{quote_to_funargs} の戻り値は [fid, op, arg1, arg2, ...]
                    436: なる形式をしている.
                    437: ここで op は node の名前であり,
                    438: 関数 @code{get_function_name} を用いて人間が読める形式
                    439: で取りだせる.
                    440: たとえば @code{get_function_name(quote_to_funargs(quote(1+2))[1])}
                    441: は "+" を戻す.
1.3       takayama  442: @item
1.59      noro      443:  名前@code{get_function_name} はそのうち変更されるだろう.
1.3       takayama  444: @item
1.59      noro      445:  下の例で
1.34      ohara     446:  quote_to_funargs(FA[2]);
                    447: [34,[b_op,+,[internal,x],[internal,1]]]
1.59      noro      448: となる.
                    449: 34 は @code{I_PAREN} を意味する.
                    450: 数と意味の対応表は @code{OpenXM/src/asir-contrib/packages/src/noro_simplify.rr}
                    451: または @code{OpenXM_contrib2/asir2000/parse/parse.h} を見よ.
                    452: 以下の fid が 0, 1, 2, ... に対応づけられている.
1.34      ohara     453:         I_BOP, I_COP, I_AND, I_OR, I_NOT, I_CE,
                    454:         I_PRESELF, I_POSTSELF,
                    455:         I_FUNC, I_FUNC_OPT, I_IFUNC, I_MAP, I_RECMAP, I_PFDERIV,
                    456:         I_ANS, I_PVAR, I_ASSPVAR,
                    457:         I_FORMULA, I_LIST, I_STR, I_NEWCOMP, I_CAR, I_CDR, I_CAST,
                    458:         I_INDEX, I_EV, I_TIMER, I_GF2NGEN, I_GFPNGEN, I_GFSNGEN,
                    459:         I_LOP, I_OPT, I_GETOPT, I_POINT, I_PAREN, I_MINUS,
                    460:         I_NARYOP
1.3       takayama  461: @end itemize
                    462:
1.59      noro      463: 次の例では (x+1)+(x+2) の括弧をはずして x+1+x+2 に変換している.
1.34      ohara     464: @example
                    465: [0] ctrl("print_quote",1) $
                    466:
                    467: [1] Q=quote((x+1)+(x+2));
                    468: [b_op,+,[u_op,(),[b_op,+,[internal,x],[internal,1]]],
                    469:         [u_op,(),[b_op,+,[internal,x],[internal,2]]]]
                    470:
                    471: [2] FA=quote_to_funargs(Q);
                    472: [0,<...quoted...>,
                    473:   [u_op,(),[b_op,+,[internal,x],[internal,1]]],
                    474:   [u_op,(),[b_op,+,[internal,x],[internal,2]]]]
                    475:
                    476: [3] FA2=quote_to_funargs(FA[2])[1];
                    477: [b_op,+,[internal,x],[internal,1]]
                    478:
                    479: [4] FA3=quote_to_funargs(FA[3])[1];
                    480: [b_op,+,[internal,x],[internal,2]]
                    481:
                    482: [5] funargs_to_quote([FA[0],FA[1],FA2,FA3]);
                    483: [b_op,+,[b_op,+,[internal,x],[internal,1]],
                    484:         [b_op,+,[internal,x],[internal,2]]]
                    485: @end example
                    486:
1.59      noro      487: 次の例は OpenXM/asir-contrib 版の asir で実行.
1.34      ohara     488: @example
                    489: [1287] load("noro_simplify.rr");
                    490: 1
                    491: [1293] noro_simplify.remove_paren(quote( f(1-(x))));
                    492: quote(f(1-x))
                    493: @end example
1.3       takayama  494:
1.59      noro      495: funargs_to_quote を用いて既存の quote の子供を置き換えて
                    496: 新しい quote をつくり出せる.
1.34      ohara     497: @example
                    498: [1184] R=quote_to_funargs(quote(a+(b+c)));
                    499: [0,<...quoted...>,<...quoted...>,<...quoted...>]
                    500: [1185] T=quote_to_funargs(quote(1+2));
                    501: [0,<...quoted...>,<...quoted...>,<...quoted...>]
                    502: [1186] funargs_to_quote([0,R[1],R[2],T[2]]);
                    503: quote(a+1)
1.3       takayama  504: @end example
                    505:
1.34      ohara     506: @table @t
1.59      noro      507: @item 参照
1.34      ohara     508: @ref{quotetolist}
                    509: @end table
                    510:
1.3       takayama  511:
                    512: @noindent
                    513: ChangeLog
                    514: @itemize @bullet
1.34      ohara     515: @item
1.59      noro      516:  これらの関数は 2004-7-8 から開発のはじまっている quote の simplification 関連
                    517:  の実験的関数である.
                    518:  変更をうけたソースコードは多岐にわたるのでまだ書かない.
1.34      ohara     519: @item
1.59      noro      520:  括弧を取り去る問題は OpenXM/fb が蓄えている公式を tex で綺麗に表示するのが動機の一つ.
1.34      ohara     521: @item
1.59      noro      522:  2004-6-26 の計算代数セミナーにおいて, 中川さんが simplifier についていろいろ問題提起
                    523: をした (計算代数セミナービデオ参照).
                    524: @item parse/quote.c の strcut fid_spec fid_spec_tab[]
                    525: の部分に書いてある形式に @code{funargs_to_quote} は変換する.
1.3       takayama  526: @end itemize
                    527:
                    528:
1.59      noro      529: @node eval_quote,,, クオート
1.34      ohara     530: @subsection @code{eval_quote}
                    531: @findex eval_quote
1.3       takayama  532:
1.59      noro      533: @comment --- 関数の簡単な説明 ---
                    534: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.3       takayama  535: @table @t
1.34      ohara     536: @item eval_quote(@var{Q});
1.59      noro      537: :: quote 型データ @var{Q} を asir のオブジェクトに変換する.
1.3       takayama  538: @end table
                    539:
                    540: @table @var
                    541: @item return
1.59      noro      542: オブジェクト
1.34      ohara     543: @item Q
1.59      noro      544: quote型
1.34      ohara     545: @end table
                    546:
                    547: @itemize @bullet
1.59      noro      548: @item quote 型データ @var{Q} を asir のオブジェクトに変換する.
                    549: @item 逆関数は @code{objtoquote}
1.34      ohara     550: @end itemize
                    551:
                    552: @example
                    553: ctrl("print_quote",2);
                    554: A=quote((x-1)^2+(x-1)+3);
1.59      noro      555:      出力: ((((x)-(1))^(2))+((x)-(1)))+(3)
1.34      ohara     556: eval_quote(A);
1.59      noro      557:      出力: x^2-x+3
1.34      ohara     558: print_input_form(A);     /* asir-contrib */
1.59      noro      559:      出力: quote((x-1)^2+(x-1)+3)
1.11      ohara     560: @end example
1.3       takayama  561:
1.34      ohara     562: @table @t
1.59      noro      563: @item 参照
1.34      ohara     564: @ref{objtoquote}, @ref{quotetolist}, @ref{eval_string},
                    565: @ref{quote_to_funargs}, @ref{funargs_to_quote}
                    566: @end table
1.3       takayama  567:
1.59      noro      568: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    569: @comment --- openxm の外部からの寄与も述べる. Credit.
1.3       takayama  570: @noindent
                    571: ChangeLog
                    572: @itemize @bullet
1.59      noro      573: @item  -----まだ書いてない.
1.1       takayama  574: @end itemize
                    575:
1.34      ohara     576:
1.59      noro      577: @node nqt_match,,, クオート
1.34      ohara     578: @subsection @code{nqt_match}
                    579: @findex nqt_match
1.1       takayama  580:
1.59      noro      581: @comment --- 関数の簡単な説明 ---
                    582: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.1       takayama  583: @table @t
1.34      ohara     584: @item nqt_match(@var{Expr},@var{Pattern}[,@var{Mode}])
1.59      noro      585: :: @var{Expr} が @var{Pattern} にマッチ(適合)すると 1 を戻す. しないと 0 を戻す.
1.3       takayama  586: @end table
                    587:
1.34      ohara     588: @table @var
                    589: @item return
1.59      noro      590: 整数
1.34      ohara     591: @item Expr
1.59      noro      592: quote型
1.34      ohara     593: @item Pattern
1.59      noro      594: quote型
1.34      ohara     595: @item Mode
1.59      noro      596: 整数
1.34      ohara     597: @end table
1.3       takayama  598:
                    599: @itemize @bullet
1.59      noro      600: @item  @var{Expr} が @var{Pattern} にマッチ(適合)すると 1 を戻す. しないと 0 を戻す.
                    601: @item 適合した場合, 副作用として, @var{Pattern} に含まれるプログラム変数(大文字ではじまる変数)に適合した値が代入される.
                    602: @item nqt は normalized quote の略であり fnode標準形に変換してから適合検査をする.  fnode標準形については @ref{qt_normalize} を見よ.
                    603: @item @var{Mode} により展開方法を指定し, その展開方法により得られた @var{Expr} の
                    604: fnode標準形と @var{Pattern} を比較する.
1.3       takayama  605: @end itemize
                    606:
1.34      ohara     607: @example
                    608: ctrl("print_quote",2);
                    609: A=quote((x-y)*(x+y));
                    610: nqt_match(A,quote(P*Q));
                    611: [P,Q]
1.59      noro      612:     出力:  [x-y, x+y]
1.34      ohara     613: nqt_match(A,quote(P*Q),1);
1.59      noro      614:     マッチしない.
1.34      ohara     615: nqt_match(A,quote(P*Q),2);
1.59      noro      616:     マッチしない.
1.34      ohara     617: qt_normalize(A,1);
1.59      noro      618:     出力:  ((x)^(2))+((x)*(y))+((-1)*((y)^(2)))+((-1)*(y)*(x))
1.34      ohara     619: qt_normalize(A,2);
1.59      noro      620:     出力:  ((x)*(x))+((x)*(y))+((-1)*(y)*(x))+((-1)*(y)*(y))
1.34      ohara     621: @end example
                    622:
                    623: @table @t
1.59      noro      624: @item 参照
1.34      ohara     625: @ref{nqt_match_rewrite},
                    626: @ref{qt_rewrite}
                    627: @end table
1.3       takayama  628:
1.59      noro      629: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    630: @comment --- openxm の外部からの寄与も述べる. Credit.
1.3       takayama  631: @noindent
                    632: ChangeLog
                    633: @itemize @bullet
1.59      noro      634: @item  ----- まだ書いてない.
1.3       takayama  635: @end itemize
                    636:
1.4       takayama  637:
1.59      noro      638: @node nqt_match_rewrite,,, クオート
1.34      ohara     639: @subsection @code{nqt_match_rewrite}
                    640: @findex nqt_match_rewrite
1.4       takayama  641:
1.59      noro      642: @comment --- 関数の簡単な説明 ---
                    643: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.4       takayama  644: @table @t
1.34      ohara     645: @item nqt_match_rewrite(@var{Expr},@var{Rule},@var{Mode})
1.59      noro      646: :: @var{Expr} を @var{Rule} に従い書き換える.
1.4       takayama  647: @end table
                    648:
                    649: @table @var
                    650: @item return
1.59      noro      651: quote型
1.34      ohara     652: @item Expr
1.59      noro      653: quote型
1.34      ohara     654: @item Rule
1.59      noro      655: [@var{Pattern},@var{Action}] かまたは
1.34      ohara     656: [@var{Pattern},@var{Condition},@var{Action}].
1.59      noro      657: これらの要素はすべて quote型.
1.34      ohara     658: @item Mode
1.59      noro      659: 整数
1.4       takayama  660: @end table
                    661:
                    662: @itemize @bullet
1.59      noro      663: @item @var{Expr} を @var{Rule} に従い書き換える. @var{Pattern} に適合しない場合は
                    664: @var{Exprt} 自体を戻す.
                    665: @item nqt は normalized quote の略であり fnode標準形に変換してから適合検査をする.  fnode標準形については @ref{qt_normalize} を見よ.
1.4       takayama  666: @end itemize
                    667:
1.34      ohara     668: @comment %%Doc: cfep/tests/2006-03-12-qt.rr
1.4       takayama  669: @example
1.34      ohara     670: ctrl("print_quote",2);
                    671: nqt_match_rewrite(`x*y*z,[`X*Y,`X+Y],1);
1.59      noro      672:    出力: (x)+((y)*(z))
1.34      ohara     673: A=`x*x;
                    674: nqt_match_rewrite(A,[`X*Y,`X+Y],1);
1.59      noro      675:    出力: x^2   (マッチしていない)
1.34      ohara     676: nqt_match_rewrite(A,[`X*Y,`X+Y],2);
1.59      noro      677:    出力: 2*x
1.34      ohara     678:
1.59      noro      679: 適合についてのモードの違いを理解するために次の例および fnode標準形(qt_normalize) を参照.
1.34      ohara     680: quotetolist(qt_normalize(`x*x,0));
1.59      noro      681:     出力:  [b_op,^,[internal,x],[internal,2]]
1.34      ohara     682: quotetolist(qt_normalize(`x*x,1));
1.59      noro      683:     出力:  [b_op,^,[internal,x],[internal,2]]
1.34      ohara     684: quotetolist(qt_normalize(`x*x,2));
1.59      noro      685:     出力:  [n_op,*,[internal,x],[internal,x]]
1.4       takayama  686: @end example
                    687:
                    688: @table @t
1.59      noro      689: @item 参照
1.34      ohara     690: @ref{nqt_match},
                    691: @ref{qt_rewrite},
                    692: @ref{qt_normalize}
1.4       takayama  693: @end table
                    694:
1.59      noro      695: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    696: @comment --- openxm の外部からの寄与も述べる. Credit.
1.4       takayama  697: @noindent
                    698: ChangeLog
                    699: @itemize @bullet
1.59      noro      700: @item   -----まだ書いてない.
1.4       takayama  701: @end itemize
                    702:
1.34      ohara     703:
                    704:
1.59      noro      705: @node qt_normalize,,, クオート
1.34      ohara     706: @subsection @code{qt_normalize}
                    707: @findex qt_normalize
1.6       takayama  708:
1.59      noro      709: @comment --- 関数の簡単な説明 ---
                    710: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.6       takayama  711: @table @t
1.34      ohara     712: @item qt_normalize(@var{Expr}[,@var{Mode}])
1.59      noro      713: :: @var{Expr} を fnode標準形に変換する. @var{Mode}により標準形への展開アルゴリズムを指定できる.
1.6       takayama  714: @end table
                    715:
                    716: @table @var
                    717: @item return
1.59      noro      718: quote型
1.34      ohara     719: @item Expr
1.59      noro      720: quote型
1.34      ohara     721: @item Mode
1.59      noro      722: 整数
1.6       takayama  723: @end table
                    724:
1.59      noro      725: fnodeは quote型の実体である.
                    726: fnode は木であり, 型 id および子供からなる.
                    727: 型および子供を取り出す関数が funargs_to_quote である.
                    728: また fnode をリストに変換する関数が quotetolist である.
1.34      ohara     729:
1.59      noro      730: fnode の標準形はパターンマッチング, 書き換えを容易におこなうために導入された.
                    731: fnode の標準形を fn と書くとき, 標準形の BNF風表現での定義は以下のとおり.
1.34      ohara     732: @example
                    733:  fn           = formula | functor(nf [,...]) | sum_of_monom
1.59      noro      734:      fnode の標準形.  functor は関数よびだしみたいなもの.
1.34      ohara     735:  sum_of_monom = monom [+ ...]
1.59      noro      736:      モノミアルの和
1.34      ohara     737:  monom        = [formula *] nfpow [* ...]
1.59      noro      738:      モノミアル
1.34      ohara     739:  nfpow        = nf | nf^(nf)
1.59      noro      740:      冪乗部分の標準形
1.34      ohara     741:  formula      = Risa object
                    742: @end example
                    743:
                    744:
1.6       takayama  745: @itemize @bullet
1.59      noro      746: @item  @var{Expr} を fnode標準形に変換する. @var{Mode}により標準形への展開アルゴリズムを指定できる.
                    747: @item 展開は再帰的である.
                    748: @item 入力が fnode に変換された初期状態では + や * は子供が2人の binary operator
                    749: (b_op) であるが, qt_normalize を作用させることにより, + や * は任意人数の
                    750: 子供を持てる n-ary operator に変換される.
                    751: @item n-ary operator を基礎とした fnode標準形を用いることにより, パターンマッチ用のパターンの数を減らせることが経験的にわかっている.
                    752: @item @var{Mode}=0. 展開しない. これが既定の動作.
                    753: @item @var{Mode}=1. 展開する. ただし x*x 等を x^2 等に変換
                    754: @item @var{Mode}=2. 展開する. ただし x*x 等を x^2 等に変換しない.
1.6       takayama  755: @end itemize
                    756:
1.59      noro      757: @var{Mode} の違いについては以下の例も参考に.
1.34      ohara     758: @comment %%cfep/tests/2006-03-12-qt.rr
1.6       takayama  759: @example
1.34      ohara     760: ctrl("print_quote",2);
                    761: A=quote((x-y)*(x+y));
1.59      noro      762:    出力:  ((x)-(y))*((x)+(y))
1.34      ohara     763: B=qt_normalize(A,0);
1.59      noro      764:    出力: ((x)+((-1)*(y)))*((x)+(y))  Mode=0. 展開はされない. +, * は n_op (nary-op) へ.
1.34      ohara     765: quotetolist(B);
1.59      noro      766:    出力: [n_op,*,[n_op,+,[internal,x],[n_op,*,[internal,-1],[internal,y]]],[n_op,+,[internal,x],[internal,y]]]
1.6       takayama  767:
1.34      ohara     768: B=qt_normalize(A,1);
1.59      noro      769:    出力: ((x)^(2))+((x)*(y))+((-1)*((y)^(2)))+((-1)*(y)*(x))
                    770:            Mode=1. 展開する. +, * は n_op (nary-op) へ. 巾をまとめる.
1.34      ohara     771: quotetolist(B);
1.59      noro      772:    出力: [n_op,+,[b_op,^,[internal,x],[internal,2]],[n_op,*,[internal,x],[internal,y]],[n_op,*,[internal,-1],[b_op,^,[internal,y],[internal,2]]],[n_op,*,[internal,-1],[internal,y],[internal,x]]]
1.6       takayama  773:
1.34      ohara     774: qt_normalize(A,2);
1.59      noro      775:    出力: ((x)*(x))+((x)*(y))+((-1)*(y)*(x))+((-1)*(y)*(y))
                    776:            Mode=2. 展開する. +, * は n_op (nary-op) へ. 巾は使わない.
1.34      ohara     777: quotetolist(B);
1.59      noro      778:    出力: [n_op,+,[b_op,^,[internal,x],[internal,2]],[n_op,*,[internal,x],[internal,y]],[n_op,*,[internal,-1],[b_op,^,[internal,y],[internal,2]]],[n_op,*,[internal,-1],[internal,y],[internal,x]]]
1.6       takayama  779:
1.34      ohara     780: qt_normalize(`x^2,2);
1.59      noro      781:    出力: (x)*(x)
                    782:        Mode=2. 巾は使わない. n-ary の * へ.
1.6       takayama  783: @end example
                    784:
                    785: @table @t
1.59      noro      786: @item 参照
1.34      ohara     787: @ref{nqt_match},
                    788: @ref{nqt_match_rewrite},
                    789: @ref{quotetolist},
                    790: @ref{quote_to_funargs}
1.6       takayama  791: @end table
                    792:
1.59      noro      793: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    794: @comment --- openxm の外部からの寄与も述べる. Credit.
1.6       takayama  795: @noindent
                    796: ChangeLog
                    797: @itemize @bullet
1.59      noro      798: @item -----まだ書いてない.
1.6       takayama  799: @end itemize
                    800:
1.34      ohara     801:
1.59      noro      802: @node qt_set_coef,,, クオート
1.34      ohara     803: @subsection @code{qt_set_coef}
                    804: @findex qt_set_coef
1.6       takayama  805:
1.59      noro      806: @comment --- 関数の簡単な説明 ---
                    807: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.6       takayama  808: @table @t
1.34      ohara     809: @item qt_set_coef(@var{ParamList})
1.59      noro      810: :: 以下 @var{ParamList} に現れる多項式変数を変数とする有理関数体を係数とする
                    811: 非可換多項式を扱う.
1.6       takayama  812: @end table
                    813:
                    814: @table @var
                    815: @item return
1.59      noro      816: リスト
1.34      ohara     817: @item  ParamList
1.59      noro      818: リスト
1.6       takayama  819: @end table
                    820:
                    821: @itemize @bullet
1.59      noro      822: @item 以下 @var{ParamList} に現れる多項式変数を変数とする有理関数体を係数とする
                    823: 非可換多項式を扱う.
                    824: @item この宣言をしないと係数体を数とする非可換多項式として計算する.
                    825: @item qt_normalize およびその機能を用いる関数がこの機能の影響を受ける.
                    826: @item qt_comp 関数がこの機能の影響を受ける.
1.6       takayama  827: @end itemize
                    828:
                    829: @example
1.34      ohara     830: ctrl("print_quote",2);
                    831: qt_set_coef([a]);
                    832: B=qt_normalize(quote((a*x+a)^2),2);
1.59      noro      833:      出力: ((a^2)*(x)*(x))+((2*a^2)*(x))+(a^2)
1.34      ohara     834: qt_normalize(B+B,2);
1.59      noro      835:      出力: ((2*a^2)*(x)*(x))+((4*a^2)*(x))+(2*a^2)
1.6       takayama  836: @end example
                    837:
                    838: @table @t
1.59      noro      839: @item 参照
1.34      ohara     840: @ref{qt_normalize}
1.6       takayama  841: @end table
                    842:
1.59      noro      843: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    844: @comment --- openxm の外部からの寄与も述べる. Credit.
1.6       takayama  845: @noindent
                    846: ChangeLog
                    847: @itemize @bullet
1.59      noro      848: @item -----まだ書いてない.
1.6       takayama  849: @end itemize
                    850:
1.34      ohara     851:
1.59      noro      852: @node qt_set_ord,,, クオート
1.34      ohara     853: @subsection @code{qt_set_ord}
                    854: @findex qt_set_ord
1.6       takayama  855:
1.59      noro      856: @comment --- 関数の簡単な説明 ---
                    857: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.6       takayama  858: @table @t
1.34      ohara     859: @item qt_set_ord(@var{VarList})
1.59      noro      860: :: @var{VarList} を変数順序とする.
1.6       takayama  861: @end table
                    862:
                    863: @table @var
                    864: @item return
1.59      noro      865: リスト
1.34      ohara     866: @item VarList
1.59      noro      867: リスト
1.6       takayama  868: @end table
                    869:
                    870: @itemize @bullet
1.59      noro      871: @item @var{VarList} を辞書式に用いた変数順序を以下使用する.
                    872: @item この宣言をしないとある不定元についての既定の辞書式順序-----まだ書いてない---を用いて項を比較する.
                    873: @var{VarList} に現れない変数についてはこの順序が適用される.
                    874: @item qt_normalize およびその機能を用いる関数がこの機能の影響を受ける.
                    875: @item qt_comp 関数がこの機能の影響を受ける.
1.6       takayama  876: @end itemize
                    877:
                    878: @example
1.34      ohara     879: ctrl("print_quote",2);
                    880: qt_normalize(quote(x+y),2);
1.59      noro      881:      出力: (x)+(y)
1.34      ohara     882: qt_set_ord([y,x]);
1.59      noro      883:      出力: [y,x,z,u,v,w,p,q,r,s,t,a,b,c,d,e,f,g, 以下省略 ]
1.34      ohara     884: qt_normalize(quote(x+y),2);
1.59      noro      885:      出力: (y)+(x)
1.6       takayama  886: @end example
                    887:
                    888: @table @t
1.59      noro      889: @item 参照
1.34      ohara     890: @ref{qt_normalize},
                    891: @ref{nqt_comp}
1.6       takayama  892: @end table
                    893:
1.59      noro      894: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    895: @comment --- openxm の外部からの寄与も述べる. Credit.
1.6       takayama  896: @noindent
                    897: ChangeLog
                    898: @itemize @bullet
1.59      noro      899: @item -----まだ書いてない.
1.6       takayama  900: @end itemize
                    901:
1.8       takayama  902:
1.59      noro      903: @node qt_set_weight,,, クオート
1.34      ohara     904: @subsection @code{qt_set_weight}
                    905: @findex qt_set_weight
1.8       takayama  906:
1.59      noro      907: @comment --- 関数の簡単な説明 ---
                    908: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.8       takayama  909: @table @t
1.34      ohara     910: @item qt_set_weight(@var{WeightVector})
1.59      noro      911: :: 変数について weight ベクトルを設定する.
1.8       takayama  912: @end table
                    913:
                    914: @table @var
                    915: @item return
1.59      noro      916: リスト
1.34      ohara     917: @item WeightVector
1.59      noro      918: リスト
1.8       takayama  919: @end table
                    920:
1.59      noro      921: fnode f の weight w(f) は次の式で計算する.
1.34      ohara     922: @example
1.59      noro      923:  f が葉の場合は原則 0. qt_weight_vector で weight が与えられている不定元に
                    924:  ついてはその値.
1.34      ohara     925:
1.59      noro      926:  f がnodeの場合は次の規則で再帰的にきめる.
1.34      ohara     927:    w(f+g) = max(w(f),w(g))
                    928:    w(f g) = w(f) + w(g)
                    929:    w(f^n) = n w(f)
1.59      noro      930:    関数については? -----まだ書いてない.
1.34      ohara     931: @end example
                    932:
1.8       takayama  933: @itemize @bullet
1.59      noro      934: @item @var{WeightVector} でまず順序の比較をして, それから qt_set_order による順序, 最後に既定の順序で比較する.
                    935: @var{WeightVector} に現れない変数についての weight は 0 となる.
                    936: @item qt_normalize およびその機能を用いる関数がこの機能の影響を受ける.
                    937: qt_normalize での展開では, この順序を用いて項がソートされる.
                    938: @item qt_comp およびその機能を用いる関数がこの機能の影響を受ける.
                    939: @item weight ベクトルによる順序比較についてはグレブナ基底の節@ref{dp_gr_main}も参照.
1.8       takayama  940: @end itemize
                    941:
                    942: @example
1.34      ohara     943: ctrl("print_quote",2);
                    944: qt_set_weight([[x,-1],[y,-1]]);
1.59      noro      945:      結果: [[x,-1],[y,-1]]
1.34      ohara     946: qt_normalize(quote( 1+(x+y)+(x+y)^2),1);
1.59      noro      947:      結果: (1)+(y)+(x)+((y)^(2))+((y)*(x))+((x)^(2))+((x)*(y))
1.8       takayama  948: @end example
                    949:
                    950: @table @t
1.59      noro      951: @item 参照
1.34      ohara     952: @ref{qt_normalize},
                    953: @ref{qt_set_ord},
                    954: @ref{qt_set_weight},
                    955: @ref{dp_gr_main}
1.8       takayama  956: @end table
                    957:
1.59      noro      958: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                    959: @comment --- openxm の外部からの寄与も述べる. Credit.
1.8       takayama  960: @noindent
                    961: ChangeLog
                    962: @itemize @bullet
1.59      noro      963: @item -----まだ書いてない.
1.8       takayama  964: @end itemize
                    965:
                    966:
1.59      noro      967: @node nqt_comp,,, クオート
1.34      ohara     968: @subsection @code{nqt_comp}
                    969: @findex nqt_comp
                    970:
1.59      noro      971: @comment --- 関数の簡単な説明 ---
                    972: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.8       takayama  973: @table @t
1.34      ohara     974: @item nqt_cmp(@var{Expr1},@var{Exprt2})
1.59      noro      975: :: @var{Expr1} と @var{Expr2} の順序を比較する.
1.8       takayama  976: @end table
                    977:
                    978: @table @var
                    979: @item return
1.59      noro      980: 整数
1.34      ohara     981: @item Expr1, Expr2
1.59      noro      982: quote型
1.8       takayama  983: @end table
                    984:
                    985: @itemize @bullet
1.59      noro      986: @item @var{Expr1} と @var{Expr2} の順序を比較する.
                    987: @item @var{Expr1} > @var{Exprt2} なら 1.
                    988: @item @var{Expr1} < @var{Exprt2} なら -1.
                    989: @item @var{Expr1} = @var{Exprt2} (おなじ順序) なら 0.
1.8       takayama  990: @end itemize
                    991:
                    992: @example
1.34      ohara     993: ctrl("print_quote",2);
                    994: qt_set_ord([y,x]); qt_set_weight([[x,-1],[y,-1]]);
                    995: [nqt_comp(`x,`y), nqt_comp(`y,`x), nqt_comp(`x,`x)];
1.59      noro      996:      出力: [-1,1,0]
1.8       takayama  997: @end example
                    998:
                    999: @table @t
1.59      noro     1000: @item 参照
1.34      ohara    1001: @ref{qt_normalize},
                   1002: @ref{qt_set_ord},
                   1003: @ref{qt_set_weight}
1.8       takayama 1004: @end table
                   1005:
1.59      noro     1006: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   1007: @comment --- openxm の外部からの寄与も述べる. Credit.
1.8       takayama 1008: @noindent
                   1009: ChangeLog
                   1010: @itemize @bullet
1.59      noro     1011: @item まだ書いてない.
1.8       takayama 1012: @end itemize
1.34      ohara    1013: @comment ****************************************************************
1.8       takayama 1014:
1.59      noro     1015: @node qt_is_var qt_is_coef,,, クオート
1.34      ohara    1016: @subsection @code{qt_is_var}, @code{qt_is_coef}
                   1017: @findex qt_is_var
                   1018: @findex qt_is_coef
1.9       takayama 1019:
1.59      noro     1020: @comment --- 関数の簡単な説明 ---
                   1021: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.9       takayama 1022: @table @t
1.34      ohara    1023: @item qt_is_var(@var{Expr})
1.59      noro     1024: :: @var{Expr} が不定元に対応する quote なら 1 を戻す.
1.34      ohara    1025: @item qt_is_coef(@var{Expr})
1.59      noro     1026: :: @var{Expr} が係数の有理関数体に属するとき 1 を戻す.
1.9       takayama 1027: @end table
                   1028:
                   1029: @table @var
                   1030: @item return
1.59      noro     1031: 整数
1.34      ohara    1032: @item Expr
1.59      noro     1033: quote型
1.9       takayama 1034: @end table
                   1035:
                   1036: @itemize @bullet
1.59      noro     1037: @item  @var{Expr} が不定元に対応する quote なら 1 を戻す.
                   1038: そうでないとき 0 を戻す.
1.9       takayama 1039: @end itemize
                   1040:
                   1041: @example
1.34      ohara    1042: [qt_is_var(quote(x)), qt_is_var(quote(3/2))];
1.59      noro     1043:      出力: [1,0]
1.9       takayama 1044: @end example
                   1045:
                   1046: @table @t
1.59      noro     1047: @item 参照
1.34      ohara    1048: @ref{qt_rewrite},
                   1049: @ref{nqt_match_rewrite}
1.9       takayama 1050: @end table
                   1051:
1.59      noro     1052: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   1053: @comment --- openxm の外部からの寄与も述べる. Credit.
1.9       takayama 1054: @noindent
                   1055: ChangeLog
                   1056: @itemize @bullet
1.59      noro     1057: @item -----まだ書いてない.
1.9       takayama 1058: @end itemize
1.34      ohara    1059: @comment ****************************************************************
1.8       takayama 1060:
1.59      noro     1061: @node qt_rewrite,,, クオート
1.34      ohara    1062: @subsection @code{qt_rewrite}
                   1063: @findex qt_rewrite
1.12      takayama 1064:
1.59      noro     1065: @comment --- 関数の簡単な説明 ---
                   1066: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.12      takayama 1067: @table @t
1.34      ohara    1068: @item qt_rewrite(@var{Expr},@var{Rules},@var{Mode})
1.59      noro     1069: :: @var{Expr} を規則集合 @var{Rules} を用いて書き換える.
1.12      takayama 1070: @end table
                   1071:
                   1072: @table @var
                   1073: @item return
1.59      noro     1074: quote型
1.34      ohara    1075: @item Expr
1.59      noro     1076: quote型
1.34      ohara    1077: @item Rules
1.59      noro     1078: リスト
1.34      ohara    1079: @item Mode
1.59      noro     1080: 整数
1.12      takayama 1081: @end table
                   1082:
                   1083: @itemize @bullet
1.59      noro     1084: @item ユーザ言語を用いて定義された関数.
                   1085: @code{import("noro_rewrite.rr")}  しておくこと.
                   1086: (noro_rewrite.rr が OpenXM/lib/asir-contrib に存在しない場合
                   1087: ソースの OpenXM/src/asir-contrib/testing/noro/new_rewrite.rr をコピー)
                   1088: @item @var{Expr} を規則集合 @var{Rules} を用いて書き換える.
                   1089: @item 規則の適用は fnode木に対して再帰的である.
                   1090:  一方 @code{nqt_match_rewrite} ではトップレベルのみに規則が適用される.
                   1091: @item 規則集合 @var{Rules} の各要素の書き方は @code{nqt_match()} の
                   1092: @var{Pattern} と同じ書き方.
                   1093: つまり [パターン, 書き換え結果] または
                   1094: [パターン, 条件, 書き換え結果].
                   1095: @item @var{Mode} の意味は @ref{qt_normalize} の @var{Mode} と同様.
                   1096: パターンマッチ, 書き換えは @var{Mode} で @code{qt_normalize()}
                   1097: されてから遂行される.
                   1098: @end itemize
                   1099:
                   1100: 注意: 数学的には X*Y=Y*X が可換性を与える規則だが, これをそのまま規則として
                   1101:            与えると書き換えが停止しない. 次の例では, 上の例のように順序比較し, たとえば,
                   1102:            順序が大きくなる場合のみに書き換えるべきである.
1.34      ohara    1103: @example
                   1104: import("noro_rewrite.rr");
                   1105: R=[[`X*Y,`nqt_comp(Y*X,X*Y)>0, `Y*X]];
                   1106: qt_rewrite(`(x-y)^2,R,2);
1.59      noro     1107:      出力: quote(x*x+-2*x*y+y*y)
1.34      ohara    1108: @end example
                   1109:
1.59      noro     1110: 外積代数の計算 (asir-contrib をロードした状態).
1.34      ohara    1111: @example
                   1112: import("noro_rewrite.rr");
                   1113: Rext0=[quote(X*Y),quote(qt_is_var(X) && qt_is_var(Y) && nqt_comp(Y,X)>0),
                   1114:                   quote(-Y*X)];
                   1115: Rext1=[quote(X^N),quote(eval_quote(N)>=2),quote(0)];
                   1116: Rext2=[quote(X*X),quote(0)];
                   1117: Rext=[Rext0,Rext1,Rext2];
                   1118: qt_rewrite(quote( (x+2*y)*(x+4*y) ), Rext,1);
1.59      noro     1119:      出力: 2*x*y
1.34      ohara    1120:
                   1121: qt_set_coef([a,b,c,d]);
                   1122: qt_rewrite(quote((a*x+b*y)*(c*x+d*y)), Rext,1);
1.59      noro     1123:      出力: (d*a-c*b)*x*y
1.34      ohara    1124:
                   1125: @end example
                   1126:
1.59      noro     1127: 微分の計算 (asir-contrib をロードした状態).
1.12      takayama 1128: @example
1.34      ohara    1129: import("noro_rewrite.rr");
                   1130: qt_set_coef([a,b]);
                   1131: Rd1=[`d(X+Y), `d(X)+d(Y)];
                   1132: Rd2=[`d(X*Y),`d(X)*Y+X*d(Y)];
                   1133: Rd3=[`d(N), `qt_is_coef(N), `0];
                   1134: Rd4=[`d(x),`1];
                   1135: Rd=[Rd1,Rd2,Rd3,Rd4];
                   1136: B=qt_rewrite( `d( (a*x+b)^3),Rd,2);
1.59      noro     1137:      出力: quote(3*a^3*x*x+6*b*a^2*x+3*b^2*a)
1.34      ohara    1138: fctr(eval_quote(B));
1.59      noro     1139:      出力: [[3,1],[a,1],[a*x+b,2]]
1.12      takayama 1140: @end example
                   1141:
                   1142: @table @t
1.59      noro     1143: @item 参照
1.34      ohara    1144: @ref{nqt_match},
                   1145: @ref{nqt_match_rewrite},
                   1146: @ref{qt_normalize}
1.12      takayama 1147: @end table
                   1148:
1.59      noro     1149: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   1150: @comment --- openxm の外部からの寄与も述べる. Credit.
1.12      takayama 1151: @noindent
                   1152: ChangeLog
                   1153: @itemize @bullet
1.59      noro     1154: @item qt 系の関数の原型は OpenXM/src/asir-contrib/testing/tr.rr である.
                   1155: このユーザ言語による開発が 2005年の春まで行われ, そのあと組み込み関数主体の
                   1156: qt 系の関数が開発された.
                   1157: @item qt 系の関数についてのその他の参考文献:
                   1158:   OpenXM/doc/Papers/2005-rims-noro.tex および
                   1159:   OpenXM/doc/Papers/2005-rims-noro.tm (TeXmacsの記事).
                   1160: @item Todo: qt 系の関数を用いたおもしろい計算を Risa/Asir ジャーナルの記事として書く.
1.13      takayama 1161: @end itemize
                   1162:
1.34      ohara    1163: @comment ****************************************************************
                   1164:
1.59      noro     1165: @node 文字列処理,,, 実験的仕様の関数
                   1166: @section 文字列処理
1.13      takayama 1167:
1.59      noro     1168: @comment --- ◯◯◯◯  関数 copyright の説明 ◯◯◯◯
                   1169: @node copyright,,, 文字列処理
1.34      ohara    1170: @subsection @code{copyright}
                   1171: @findex copyright
1.13      takayama 1172:
1.59      noro     1173: @comment --- 関数の簡単な説明 ---
1.13      takayama 1174: @table @t
1.34      ohara    1175: @item copyright()
1.59      noro     1176: :: Risa/Asir の copyright 表示を文字列として戻す.
1.13      takayama 1177: @end table
                   1178:
                   1179: @table @var
                   1180: @item return
1.59      noro     1181: 文字列
1.13      takayama 1182: @end table
                   1183:
                   1184: @itemize @bullet
                   1185: @item
1.59      noro     1186: Risa/Asir の copyright 表示を文字列として戻す.
1.13      takayama 1187: @end itemize
                   1188:
                   1189: @example
1.34      ohara    1190: [1150] copyright();
                   1191: This is Risa/Asir, Version 20040312 (Kobe Distribution).
                   1192: Copyright (C) 1994-2000, all rights reserved, FUJITSU LABORATORIES LIMITED.
                   1193: Copyright 2000-2003, Risa/Asir committers, http://www.openxm.org/.
                   1194: GC 6.2(alpha6) copyright 1988-2003, H-J. Boehm, A. J. Demers, Xerox, SGI, HP.
                   1195: PARI 2.0.17, copyright 1989-1999, C. Batut, K. Belabas, D. Bernardi,
                   1196:    H. Cohen and M. Olivier.
1.13      takayama 1197: @end example
                   1198:
1.59      noro     1199: @comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.13      takayama 1200: @noindent
                   1201: ChangeLog
                   1202: @itemize @bullet
1.59      noro     1203: @item この関数は texmacs 用に書かれた (2004-03).
                   1204: @item OpenXM_contrib2/asir2000 の下の以下のファイルをみよ. builtin/miscf.c 1.21,
1.34      ohara    1205:       parse/glob.c 1.47.
                   1206: @end itemize
                   1207:
                   1208:
                   1209:
1.59      noro     1210: @comment --- ◯◯◯◯  関数 string_to_tb, ... の説明 ◯◯◯◯
                   1211: @comment --- 複数の関数をまとめて説明する例 ---
                   1212: @node string_to_tb tb_to_string write_to_tb,,, 文字列処理
1.34      ohara    1213: @subsection @code{string_to_tb}, @code{tb_to_string}, @code{write_to_tb}
                   1214: @findex string_to_tb
                   1215: @findex tb_to_string
                   1216: @findex write_to_tb
                   1217:
1.59      noro     1218: @comment --- 関数の簡単な説明 ---
                   1219: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.34      ohara    1220: @table @t
                   1221: @item string_to_tb(@var{s})
                   1222: @itemx tb_to_string(@var{tb})
                   1223: @itemx write_to_tb(@var{s},@var{tb})
1.59      noro     1224: :: 文字列可変長配列型(text buffer)のデータの処理
1.34      ohara    1225: @end table
                   1226:
                   1227: @table @var
                   1228: @item return
1.59      noro     1229: 文字列可変長配列型(string_to_tb), 文字列型(tb_to_string)
1.34      ohara    1230: @item s
1.59      noro     1231: 文字列
1.34      ohara    1232: @item tb
1.59      noro     1233: 文字列可変長配列型
1.34      ohara    1234: @end table
                   1235:
                   1236: @itemize @bullet
                   1237: @item
1.59      noro     1238: @code{string_to_tb(@var{s})} は, 文字列 @var{s} をはじめの要素とする
                   1239: 文字列可変長配列型オブジェクトを生成する.
1.34      ohara    1240: @item
1.59      noro     1241: @code{tb_to_string_(@var{tb})} は,
                   1242: 文字列可変長配列型オブジェクト @var{tb} から通常の文字列オブジェクトを生成する.
1.34      ohara    1243: @item
1.59      noro     1244: @code{write_to_tb(@var{s},@var{tb})} は, 文字列 @var{s} を
                   1245: 文字列可変長配列型オブジェクト @var{tb} へ書き出す.
                   1246: @item @var{SS} を文字列変数とするとき,
                   1247: @var{SS} += "文字列" で @var{SS} へ文字列を書き足していくことができるが,
                   1248: 無駄なメモリを大量に消費する.
                   1249: 代りに関数 @code{write_to_tb} を用いるべきである.
                   1250: 文字列可変長配列型オブジェクトは文字列の可変長の配列でありメモリ管理に優しい
                   1251: データ構造である.
1.34      ohara    1252: @end itemize
                   1253:
                   1254: @example
                   1255: [219] T=string_to_tb("");
                   1256:
                   1257: [220] write_to_tb("Hello",T);
                   1258: 0
                   1259: [221] write_to_tb(" world!",T);
                   1260: 0
                   1261: [222] tb_to_string(T);
                   1262: Hello world!
                   1263: @end example
                   1264:
                   1265:
1.59      noro     1266: @comment --- ChangeLog を書く. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.34      ohara    1267: @noindent
                   1268: ChangeLog
                   1269: @itemize @bullet
                   1270: @item
1.59      noro     1271:  この関数は 2004-3 に print_tex_form を効率化するために書かれた.
1.34      ohara    1272: @item
1.59      noro     1273:  OpenXM_contrib2/asir2000 の下の以下のファイルを見よ.
1.34      ohara    1274: io/ox_asir.c 1.52, builtin/strobj.c 1.12--1.13, 1.16,
                   1275: engine/str.c 1.5, parse/quote.c 1.9.
1.13      takayama 1276: @item
1.59      noro     1277:  rtostr が text buffer 型のデータに関しておそかった. 速度の改善は
1.34      ohara    1278:  asir2000/io/pexpr_body.c 1.2, asir2000/parse/lex.c 1.32.
1.14      takayama 1279: @end itemize
                   1280:
1.34      ohara    1281:
1.59      noro     1282: @node set_print_function,,, 文字列処理
1.34      ohara    1283: @subsection @code{set_print_function}
                   1284: @findex set_print_function
1.14      takayama 1285:
1.59      noro     1286: @comment --- 関数の簡単な説明 ---
1.14      takayama 1287: @table @t
1.34      ohara    1288: @item set_print_function([@var{fname}])
1.59      noro     1289: :: 画面表示用の関数を登録
1.14      takayama 1290: @end table
                   1291:
                   1292: @table @var
                   1293: @item return
1.59      noro     1294: 整数
1.34      ohara    1295: @item fname
1.59      noro     1296: 文字列
1.14      takayama 1297: @end table
                   1298:
                   1299: @itemize @bullet
1.34      ohara    1300: @item
1.59      noro     1301: @code{set_print_function} は @code{fname(F)} を通常の画面表示関数の代わりによぶ.
                   1302: @code 引数がない場合は画面表示関数をデフォールトへ戻す.
                   1303: @code Asir-contrib はこの関数を用いて出力関数を Asir-contrib 用に変更している.
1.14      takayama 1304: @end itemize
                   1305:
                   1306: @example
1.34      ohara    1307: [219] def my_output(F) @{
                   1308:            print("Out: ",0); print(rtostr(F));
                   1309:       @}
                   1310: [220] set_print_function("my_output");
                   1311: Out: 0
                   1312: [221]  1+2;
                   1313: Out: 3
1.14      takayama 1314: @end example
                   1315:
                   1316: @table @t
1.59      noro     1317: @item 参照
1.34      ohara    1318: @ref{rtostr}
1.14      takayama 1319: @end table
                   1320:
                   1321: @noindent
                   1322: ChangeLog
                   1323: @itemize @bullet
1.59      noro     1324: @item この関数は 2001-9-4 に asir-contrib のために導入された.
                   1325:  変更をうけたソースコードは builtin/print.c 1.11 である.
1.12      takayama 1326: @end itemize
1.13      takayama 1327:
1.15      takayama 1328:
1.59      noro     1329: @node printf fprintf sprintf,,, 文字列処理
1.28      ohara    1330: @subsection @code{printf}, @code{fprintf}, @code{sprintf}
1.55      takayama 1331: @findex printf
                   1332: @findex fprintf
1.15      takayama 1333: @findex sprintf
                   1334:
                   1335: @table @t
1.27      ohara    1336: @item printf(@var{format}[,@var{args}])
1.28      ohara    1337: @item fprintf(@var{fd},@var{format}[,@var{args}])
1.15      takayama 1338: @item sprintf(@var{format}[,@var{args}])
1.59      noro     1339: :: C に似たプリント関数
1.15      takayama 1340: @end table
                   1341:
                   1342: @table @var
                   1343: @item return
1.59      noro     1344: 整数(printf,fprintf), 文字列(sprintf)
1.15      takayama 1345: @item format
1.59      noro     1346: 文字列
1.28      ohara    1347: @item fd
1.59      noro     1348: 非負整数(ファイル記述子)
1.15      takayama 1349: @item args
1.59      noro     1350: オブジェクト
1.15      takayama 1351: @end table
                   1352:
                   1353: @itemize @bullet
                   1354: @item
1.59      noro     1355: @code{printf} は書式文字列 @var{format } にしたがい, オブジェクト @var{args} を標準出力に書き出す.
1.15      takayama 1356: @item
1.59      noro     1357: @code{fprintf} は結果を, ファイル記述子 @var{fd} の指すファイルに書き出す.
1.28      ohara    1358: @item
1.59      noro     1359: @code{sprintf} は結果を文字列で返し, 標準出力には書き出さない.
1.27      ohara    1360: @item
1.59      noro     1361: 書式文字列の中で @code{%a} (any) が利用可能.
                   1362: @var{args} の個数は書式文字列の中の @code{%a} の個数に等しくすること.
1.28      ohara    1363: @item
1.59      noro     1364: ファイル記述子は, @code{open_file} 関数を用いて得ること.
1.15      takayama 1365: @end itemize
                   1366:
                   1367: @example
1.27      ohara    1368: [0] printf("%a: rat = %a\n",10,x^2-1)$
                   1369: 10: rat = x^2-1
                   1370: [1] S=sprintf("%a: rat = %a",20,x^2-1)$
                   1371: [2] S;
                   1372: 20: rat = x^2-1
1.28      ohara    1373: [3] Fd=open_file("hoge.txt","w");
                   1374: 0
                   1375: [4] fprintf(Fd,"Poly=%a\n",(x-1)^3)$
                   1376: [5] close_file(Fd)$
                   1377: [6] quit;
                   1378:
                   1379: $ cat hoge.txt
                   1380: Poly=x^3-3*x^2+3*x-1
1.15      takayama 1381: @end example
                   1382:
                   1383: @table @t
1.59      noro     1384: @item 参照
1.28      ohara    1385: @ref{rtostr},@ref{open_file},@ref{close_file}
1.15      takayama 1386: @end table
                   1387:
1.59      noro     1388: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   1389: @comment --- openxm の外部からの寄与も述べる. Credit.
1.15      takayama 1390: @noindent
                   1391: ChangeLog
                   1392: @itemize @bullet
1.34      ohara    1393: @item
1.59      noro     1394:  関数 sprintfは 2004-7-13 にコミットされた.
                   1395:  変更をうけたソースコードは builtin/strobj (1.50) である.
1.34      ohara    1396: @item
1.59      noro     1397:  関数 printfは 2007-11-8 にコミットされた.
                   1398:  変更をうけたソースコードは builtin/print.c (1.23) である.
1.34      ohara    1399: @item
1.59      noro     1400:  関数 fprintfは 2008-11-18 にコミットされた.
                   1401:  変更をうけたソースコードは builtin/file.c (1.25) である.
1.34      ohara    1402: @item
1.59      noro     1403:  @code{%a} は Maple の sprintf の真似か.
1.15      takayama 1404: @end itemize
                   1405:
                   1406:
1.59      noro     1407: @node グレブナー基底,,, 実験的仕様の関数
                   1408: @section グレブナー基底
1.34      ohara    1409:
1.59      noro     1410: @comment --- ◯◯◯◯  関数 dp_gr_main の説明 ◯◯◯◯
                   1411: @comment --- 複数の関数をまとめて説明する例 ---
                   1412: @node dp_gr_main,,, グレブナー基底
1.34      ohara    1413: @subsection @code{dp_gr_main}
                   1414: @findex dp_gr_main
1.15      takayama 1415:
1.59      noro     1416: @comment --- 関数の簡単な説明 ---
                   1417: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.15      takayama 1418: @table @t
1.34      ohara    1419: @item dp_gr_main(@var{f} | v=@var{vv}, order=@var{oo}, homo=@var{n}, matrix=@var{m}, block=@var{b}, sugarweight=@var{sw})
1.59      noro     1420: :: dp_gr_main の新しいインタフェース.
1.15      takayama 1421: @end table
                   1422:
                   1423: @table @var
                   1424: @item return
1.59      noro     1425: リスト (グレブナ基底. 再帰表現多項式か分散表現多項式のリスト)
1.15      takayama 1426: @item f
1.59      noro     1427: リスト  (入力多項式系. 再帰表現多項式か分散表現多項式のリスト)
1.34      ohara    1428: @item vv
1.59      noro     1429: リスト  (変数のリスト)
1.34      ohara    1430: @item oo
1.59      noro     1431: リスト  (順序をあらわすリスト)
1.34      ohara    1432: @item n
1.59      noro     1433: 0 か1 (homogenization をするか)
1.34      ohara    1434: @item m
1.59      noro     1435: 順序を matrix で表現する場合 (cf. dp_ord).
1.34      ohara    1436: @item b
                   1437: ???
                   1438: @item sw
1.59      noro     1439: Sugar strategy を適用するときの weight vector. 全ての要素は非負.
1.15      takayama 1440: @end table
                   1441:
                   1442: @itemize @bullet
                   1443: @item
1.59      noro     1444:  @code{dp_gr_main(@var{f})} は, @var{f} のグレブナ基底を計算する.
                   1445:  グレブナ基底は順序を変えるとその形が変わる.   asir ではいままで順序の指定方法が
                   1446:  系統だっていなかった.
                   1447:  dp_gr_main の新しいインタフェースでは順序をある文法に従い指定する.
1.34      ohara    1448: @comment  ~taka/this03/misc-2003/A2/dp
1.59      noro     1449: @item 順序 order は次の文法で定義する.  @{, @} は 0 回以上の繰り返しを意味する.
1.34      ohara    1450: @example
                   1451:   order         : '[' orderElement @{ ',' orderElement @} ']'
                   1452:   orderElement   :  weightVec | builtinOrder
                   1453:   weightVec     : '[' weightElement @{ ',' weightElement @} ']'
                   1454:   builtiniOrder : '[' orderName  ',' setOfVariables ']'
                   1455:   weightElement :   NUMBER | setOfVariables ',' NUMBER
                   1456:   setOfVariables:  V | range(V,V)
                   1457:   orderName    : @@grlex | @@glex | @@lex
                   1458: @end example
1.59      noro     1459: ここで @code{V} は 変数名, @code{NUMBER} は整数をあわらす.
                   1460: 例1:  @code{v=[x,y,z,u,v], order=[[x,10,y,5,z,1],[@@grlex,range(x,v)]]}
                   1461: は @code{x},@code{y},@code{z} がそれぞれ weight 10, 5, 1 をもつ
                   1462: 順序で比較したあと, @code{[x,y,z,u,v]} についての
                   1463: graded reverse lexicographic order を tie-breaker として用いることを意味する.
                   1464: 参考書: B.Sturmfels: Gr\"obner Bases and Convex Polytopes (1995).
1.34      ohara    1465: M.Saito, B.Sturmfels, N.Takayama:
                   1466: Gr\"obner Deformations of Hypergeometric Differential Equations (2000).
                   1467: @item
1.59      noro     1468:   順序要素 (orderElement) の指定方法は
                   1469:  (1) 変数名または rangeで指定された変数の集合と重みの値の繰り返し
                   1470:  (2) 重みの値を変数リストの順番に並べる方法
                   1471:  (3) 変数名または rangeで指定された変数の集合と順序名の組
                   1472:  の三通りの基礎的方法がある.
                   1473:  似た指定方法が Macaulay, Singular, CoCoA, Kan/sm1 等の環論システムで
                   1474:  使用されていた. Risa/Asir の指定方法はこれらのシステムの指定方法を参考に
                   1475:  さらに改良を加えたもので柔軟性が高い.
1.34      ohara    1476: @item
1.59      noro     1477:   order の tie-breaker は grlex がデフォールト.
1.15      takayama 1478: @item
1.59      noro     1479:   分散表現多項式を引数としたときは結果も分散表現多項式として戻る.
                   1480:   order 指定にもちいるデフォールトの変数名はこのとき x0, x1, x2, ... となる.
1.15      takayama 1481: @item
1.59      noro     1482:   オプションの値は option_list キーワードを用いてリストで与えてもよい.
                   1483:   下の例を参照.
1.15      takayama 1484: @end itemize
                   1485:
                   1486: @example
1.34      ohara    1487: [218] load("cyclic");
                   1488: [219] V=vars(cyclic(4));
                   1489: [c0,c1,c2,c3]
                   1490: [220]dp_gr_main(cyclic(4) | v=V, order=[[c0,10,c1,1],[c2,5],[@@grlex,range(c0,c3)]]);
                   1491: [ 10 1 0 0 ]
                   1492: [ 0 0 5 0 ]
                   1493: [ R R R R ]
                   1494: [(-c3^6+c3^2)*c2^2+c3^4-1,c3^2*c2^3+c3^3*c2^2-c2-c3,
                   1495:  (c3^4-1)*c1+c3^5-c3,(c2-c3)*c1+c3^4*c2^2+c3*c2-2*c3^2,-c1^2-2*c3*c1-c3^2,
                   1496:  c0+c1+c2+c3]
1.15      takayama 1497:
1.34      ohara    1498: [1151]  F=map(dp_ptod,katsura(4), vars(katsura(4)));
                   1499: [(1)*<<1,0,0,0,0>>+(2)*<<0,1,0,0,0>>+ ... ]
                   1500: [1152] dp_gr_main(F | order=[[range(x0,x3),1]]);
                   1501: [ 1 1 1 1 0 ]
                   1502: [ R R R R R ]
                   1503: [(47774098944)*<<0,0,0,0,13>>+ ... ]
1.15      takayama 1504:
1.34      ohara    1505: [1153] Opt=[["v",[x,y]], ["order",[[x,5,y,1]]]];
                   1506: [[v,[x,y]],[order,[[x,5,y,1]]]]
                   1507: [1154]  dp_gr_main([x^2+y^2-1,x*y-1] | option_list=Opt);
                   1508: [ 5 1 ]
                   1509: [ R R ]
                   1510: [-y^4+y^2-1,x+y^3-y]
                   1511: @end example
1.15      takayama 1512:
1.59      noro     1513: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.34      ohara    1514: @noindent
                   1515: ChangeLog
                   1516: @itemize @bullet
1.59      noro     1517: @item この関数は 2003-12 から 2004-2 の始めに大きな修正が行われた.
1.34      ohara    1518: @item
1.59      noro     1519:  @code{setOfVariables}の表現のために range オブジェクトが導入された.
1.34      ohara    1520: @item
1.59      noro     1521:   グレブナ基底は順序を変えるとその形が変わる.   asir ではいままで順序の指定方法が
                   1522:   系統だっていなかった.
                   1523:   dp_gr_main の新しいインタフェースでは順序をある文法に従い指定する.
1.34      ohara    1524: @item
1.59      noro     1525:   OpenXM_contrib2/asir2000 の下の次の各ファイルが修正をうけた.
1.34      ohara    1526: builtin/gr.c 1.56--1.57,
                   1527: builtin/dp-supp.c 1.27--1.31 (create_composite_order_spec),
                   1528: builtin/dp.c 1.46--1.48 (parse_gr_option),
                   1529: engine/Fgfs.c 1.20,
                   1530: engine/dist.c 1.27--1.28
                   1531: engine/nd.c 1.89,
                   1532: include/ca.h 1.42--1.43,
                   1533: io/pexpr.c 1.28,
                   1534: io/sexpr.c 1.26,
                   1535: parse/arith.c 1.11,
                   1536: parse/glob.c 1.44-1.45,
                   1537: parse/lex.c 1.29,
                   1538: parse/parse.h 1.23--1.26
                   1539: @item
1.59      noro     1540:  Todo: return キーワードで戻り値のデータを quote のリストにできるように.
                   1541:   attribute, ring 構造体.
1.34      ohara    1542: @end itemize
                   1543:
1.59      noro     1544: @comment --- ◯◯◯◯  関数 dp_gr_main の説明 ◯◯◯◯
                   1545: @node dp_weyl_gr_main,,, グレブナー基底
1.34      ohara    1546: @subsection @code{dp_weyl_gr_main}
                   1547: @findex dp_weyl_gr_main
                   1548:
1.59      noro     1549: @comment --- 関数の簡単な説明 ---
                   1550: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.34      ohara    1551: @table @t
                   1552: @item dp_weyl_gr_main(@var{f} | v=@var{vv}, order=@var{oo}, homo=@var{n}, matrix=@var{m}, block=@var{b}, sugarweight=@var{sw})
1.59      noro     1553: :: dp_weyl_gr_main の新しいインタフェース.  dp_gr_main と同じ形式である.
1.34      ohara    1554: @end table
1.15      takayama 1555:
1.34      ohara    1556: @table @var
                   1557: @item return
1.59      noro     1558: リスト (グレブナ基底. 再帰表現多項式か分散表現多項式のリスト)
1.34      ohara    1559: @item f
1.59      noro     1560: リスト  (入力多項式系. 再帰表現多項式か分散表現多項式のリスト)
1.34      ohara    1561: @item vv
1.59      noro     1562: リスト  (変数のリスト)
1.34      ohara    1563: @item oo
1.59      noro     1564: リスト  (順序をあらわすリスト)
1.34      ohara    1565: @item n
1.59      noro     1566: 0 か1 (homogenization をするか). [テストまだ]
1.34      ohara    1567: @item m
1.59      noro     1568: 順序を matrix で表現する場合 (cf. dp_ord). [テストまだ]
1.34      ohara    1569: @item b
                   1570: ???
                   1571: @item sw
1.59      noro     1572: Sugar strategy を適用するときの weight vector. 全ての要素は非負. [テストまだ]
1.34      ohara    1573: @end table
1.15      takayama 1574:
1.34      ohara    1575: @itemize @bullet
                   1576: @item
1.59      noro     1577:  @code{dp_weyl_gr_main(@var{f})} は, @var{f} のグレブナ基底を計算する.
                   1578:  グレブナ基底は順序を変えるとその形が変わる.   asir ではいままで順序の指定方法が
                   1579:  系統だっていなかった.
                   1580:  dp_weyl_gr_main の新しいインタフェースでは順序をある文法に従い指定する.
                   1581:  指定方法については dp_gr_main のマニュアルを参照.
1.34      ohara    1582: @item
1.59      noro     1583:  分散表現多項式の各モノミアルの長さが偶数のときはワイル代数
1.34      ohara    1584:  K[x_1, ..., x_n, d_1, ..., d_n]
1.59      noro     1585: で計算がおこなわれる. ワイル代数では x_i と d_i は非可換な掛け算規則
                   1586:  d_i x_i = x_i d_i +1 をみたし, x_i と x_j や d_i と d_j は可換である.
                   1587:  また i と j が異なる場合は x_i と d_j も可換である.
1.34      ohara    1588: @item
1.59      noro     1589:  分散表現多項式の各モノミアルの長さが奇数のときは同次化ワイル代数
1.34      ohara    1590:  K[x_1, ..., x_n, d_1, ..., d_n, h]
1.59      noro     1591: で計算がおこなわれる. 同次化ワイル代数では x_i と d_i は非可換な掛け算規則
1.34      ohara    1592:  d_i x_i = x_i d_i + h^2
1.59      noro     1593: をみたし, h は任意の元と可換, その他の変数もワイル代数と同様な可換性の規則をみたす.
                   1594:  詳しくは dp_gr_main で参照した Saito, Sturmfels, Takayama の教科書をみよ.
1.34      ohara    1595: @end itemize
1.15      takayama 1596:
                   1597: @example
1.34      ohara    1598: [1220] F=sm1.gkz([ [[1,1,1,1],[0,1,3,4]], [0,0]]);  /* Command in asir-contrib*/
                   1599: [[x4*dx4+x3*dx3+x2*dx2+x1*dx1,4*x4*dx4+3*x3*dx3+x2*dx2,-dx1*dx4+dx2*dx3,-dx2^2*dx4+dx1*dx3^2,dx1^2*dx3-dx2^3,-dx2*dx4^2+dx3^3],[x1,x2,x3,x4]]
                   1600: [1221] V=[x1,x2,x3,x4,dx1,dx2,dx3,dx4]$
                   1601: [1222] dp_weyl_gr_main(F[0] | v=V, order=[[dx1,1,dx2,1,dx3,1,dx4,1]]);
                   1602: ...
                   1603: [1238] FF=map(dp_ptod,F[0],V);
                   1604: [(1)*<<1,0,0,0,1,0,0,0>>+(1)*<<0,1,0,0,0,1,0,0>>+(1)*<<0,0,1,0,0,0,1,0>>+(1)*<<0,0,0,1,0,0,0,1>>,(1)*<<0,1,0,0,0,1,0,0>>+(3)*<<0,0,1,0,0,0,1,0>>+(4)*<<0,0,0,1,0,0,0,1>>,0,0,0,0]
                   1605:
                   1606: [1244] FF=map(dp_ptod,F[0],V);
                   1607: [(1)*<<1,0,0,0,1,0,0,0>>+(1)*<<0,1,0,0,0,1,0,0>>+(1)*<<0,0,1,0,0,0,1,0>>+(1)*<<0,0,0,1,0,0,0,1>>,(1)*<<0,1,0,0,0,1,0,0>>+(3)*<<0,0,1,0,0,0,1,0>>+(4)*<<0,0,0,1,0,0,0,1>>,(1)*<<0,0,0,0,0,1,1,0>>+(-1)*<<0,0,0,0,1,0,0,1>>,(1)*<<0,0,0,0,1,0,2,0>>+(-1)*<<0,0,0,0,0,2,0,1>>,(-1)*<<0,0,0,0,0,3,0,0>>+(1)*<<0,0,0,0,2,0,1,0>>,(1)*<<0,0,0,0,0,0,3,0>>+(-1)*<<0,0,0,0,0,1,0,2>>]
                   1608:
                   1609: dp_weyl_gr_main(FF | v=V, order=[[0,0,0,0,1,1,1,1]]);
                   1610:
                   1611: [1246] dp_weyl_gr_main(FF | v=V, order=[[dx1,1,dx2,1,dx3,1,dx4,1]]);
                   1612: [ 0 0 0 0 1 1 1 1 ]
                   1613: [ R R R R R R R R ]
                   1614:  ...
                   1615:
1.15      takayama 1616: @end example
                   1617:
1.34      ohara    1618: @table @t
1.59      noro     1619: @item 参照
1.34      ohara    1620: @ref{dp_gr_main}
                   1621: @end table
                   1622:
1.59      noro     1623: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.34      ohara    1624: @noindent
                   1625: ChangeLog
                   1626: @itemize @bullet
1.59      noro     1627: @item dp_gr_main のインタフェースが dp_weyl_gr_main へも導入された.
1.34      ohara    1628: @item
1.59      noro     1629:   OpenXM_contrib2/asir2000 の下の次の各ファイルが修正をうけた.
1.34      ohara    1630: builtin/dp-supp.c 1.32--1.33
                   1631: builtin/dp.c 1.49--1.50
                   1632: @end itemize
                   1633:
1.59      noro     1634: @comment --- ◯◯◯◯  関数 dp_initial_term の説明 ◯◯◯◯
                   1635: @node dp_initial_term,,, グレブナー基底
1.34      ohara    1636: @subsection @code{dp_initial_term}
                   1637: @findex dp_initial_term
                   1638:
1.59      noro     1639: @comment --- 関数の簡単な説明 ---
1.34      ohara    1640: @table @t
                   1641: @item dp_initial_term(@var{f} | v=@var{vv}, order=@var{oo})
1.59      noro     1642: :: dp_initial_term は与えられた weight に対する先頭項の和を戻す.
1.34      ohara    1643: @end table
                   1644:
                   1645: @table @var
                   1646: @item return
1.59      noro     1647: 分散表現多項式または分散表現多項式のリスト.
1.34      ohara    1648: @item f
1.59      noro     1649: 分散表現多項式か分散表現多項式のリスト.
1.34      ohara    1650: @item vv
1.59      noro     1651: リスト  (変数のリスト)
1.34      ohara    1652: @item oo
1.59      noro     1653: リスト  (順序をあらわすリスト)
1.34      ohara    1654: @end table
                   1655:
                   1656: @itemize @bullet
                   1657: @item
1.59      noro     1658:  dp_initial_term は与えられた weight w に対する先頭項の和を戻す.
                   1659:  これは多くの教科書で @tex ${\rm in}_w(f)$ @end tex
                   1660:  と書かれている.
1.34      ohara    1661: @item
1.59      noro     1662:  順序を表すリストは dp_gr_main で定義した文法に従う.
                   1663:  このリストの先頭が weight vector で無い場合はエラーとなる.
                   1664:  たとえば order=[[@@lex,...]] はエラーとなる.
1.34      ohara    1665: @item
1.59      noro     1666:  結果は与えられた順序に関してソートされてるわけではない.
1.34      ohara    1667: @end itemize
                   1668:
1.19      takayama 1669: @example
1.34      ohara    1670: [1220] F=<<2,0,0>>+<<1,1,0>>+<<0,0,1>>;
                   1671: (1)*<<2,0,0>>+(1)*<<1,1,0>>+(1)*<<0,0,1>>
                   1672: [1220] dp_initial_term(F | order=[[1,1,1]]);
                   1673: [ 1 1 1 ]
                   1674: [ R R R ]
                   1675: (1)*<<2,0,0>>+(1)*<<1,1,0>>
                   1676: [1221] dp_initial_term(F | v=[x,y,z], order=[[x,1]]);
                   1677: [ 1 0 0 ]
                   1678: [ R R R ]
                   1679: (1)*<<2,0,0>>
1.19      takayama 1680: @end example
                   1681:
1.15      takayama 1682: @table @t
1.59      noro     1683: @item 参照
1.34      ohara    1684: @ref{dp_gr_main}, @ref{dp_weyl_gr_main}, @ref{dp_order}, @ref{dp_hm}
1.15      takayama 1685: @end table
                   1686:
1.59      noro     1687: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.15      takayama 1688: @noindent
                   1689: ChangeLog
                   1690: @itemize @bullet
1.34      ohara    1691: @item
1.59      noro     1692:   OpenXM_contrib2/asir2000 の下の次の各ファイルが修正をうけた.
1.34      ohara    1693: builtin/dp-supp.c 1.32
                   1694: builtin/dp.c 1.49
1.17      takayama 1695: @end itemize
                   1696:
1.59      noro     1697: @comment --- ◯◯◯◯  関数 dp_order の説明 ◯◯◯◯
                   1698: @node dp_order,,, グレブナー基底
1.34      ohara    1699: @subsection @code{dp_order}
                   1700: @findex dp_order
1.17      takayama 1701:
1.59      noro     1702: @comment --- 関数の簡単な説明 ---
1.17      takayama 1703: @table @t
1.34      ohara    1704: @item dp_order(@var{f} | v=@var{vv}, order=@var{oo})
1.59      noro     1705: :: dp_order は与えられた weight に対する次数の最大値を戻す.
1.17      takayama 1706: @end table
                   1707:
                   1708: @table @var
                   1709: @item return
1.59      noro     1710: 数か数のリスト
1.34      ohara    1711: @item f
1.59      noro     1712: 分散表現多項式か分散表現多項式のリスト.
1.34      ohara    1713: @item vv
1.59      noro     1714: リスト  (変数のリスト)
1.34      ohara    1715: @item oo
1.59      noro     1716: リスト  (順序をあらわすリスト)
1.17      takayama 1717: @end table
                   1718:
                   1719: @itemize @bullet
                   1720: @item
1.59      noro     1721:  順序を表すリストは dp_gr_main で定義した文法に従う.
                   1722:  このリストの先頭が weight vector で無い場合はエラーとなる.
                   1723:  たとえば order=[[@@lex,...]] はエラーとなる.
1.34      ohara    1724: @item
1.59      noro     1725:  dp_order は与えられた weight w に対する次数の最大値を戻す.
                   1726:  これを @tex ${\rm ord}_w(f)$ @end tex
                   1727:  と書く論文や教科書もある.
1.17      takayama 1728: @item
1.59      noro     1729:  引数がリストの場合各要素の次数が計算される.
1.17      takayama 1730: @end itemize
                   1731:
                   1732: @example
1.34      ohara    1733: [1220] F=<<2,0,0>>+<<1,1,0>>+<<0,0,1>>;
                   1734: (1)*<<2,0,0>>+(1)*<<1,1,0>>+(1)*<<0,0,1>>
                   1735: [1222] dp_order(F | order=[[1,1,1]]);
                   1736: [ 1 1 1 ]
                   1737: [ R R R ]
                   1738: 2
                   1739: [1223] dp_order(F | v=[x,y,z], order=[[x,1]]);
                   1740: [ 1 0 0 ]
                   1741: [ R R R ]
1.17      takayama 1742: @end example
                   1743:
                   1744: @table @t
1.59      noro     1745: @item 参照
1.34      ohara    1746: @ref{dp_gr_main}, @ref{dp_weyl_gr_main}, @ref{dp_initial_term}, @ref{dp_hm}
1.17      takayama 1747: @end table
                   1748:
1.59      noro     1749: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.17      takayama 1750: @noindent
                   1751: ChangeLog
                   1752: @itemize @bullet
                   1753: @item
1.59      noro     1754:   OpenXM_contrib2/asir2000 の下の次の各ファイルが修正をうけた.
1.34      ohara    1755: builtin/dp-supp.c 1.32
                   1756: builtin/dp.c 1.49
1.15      takayama 1757: @end itemize
1.21      takayama 1758:
1.59      noro     1759: @node nd_sba nd_sba_f4,,, グレブナー基底
                   1760: @subsection @code{nd_sba}, @code{nd_sba_f4}
                   1761: @findex nd_sba
                   1762: @findex nd_sba_f4
                   1763:
                   1764: @comment --- SBA アルゴリズムの実験的実装 ---
                   1765: @table @t
                   1766: @item  nd_sba(@var{gen},@var{vars},@var{char},@var{ord})
                   1767: @itemx  nd_sba_f4(@var{gen},@var{vars},@var{char},@var{ord})
                   1768: :: signature based algorithm によるグレブナー基底の計算
                   1769: @end table
                   1770:
                   1771: @table @var
                   1772: @item gen
                   1773: 多項式リスト
                   1774: @item ord
                   1775: 項順序型
                   1776: @item var
                   1777: 変数リスト
                   1778: @item return
                   1779: 多項式リスト
                   1780: @end table
                   1781:
                   1782: @itemize @bullet
                   1783: @item
                   1784: signature based algorithm (SBA) によるグレブナー基底計算の実験的実装である.
                   1785: @item
                   1786: signature based algorithm とは, イデアルの各元に, その元をもとの生成系から生成する
                   1787: 係数ベクトル (加群の元) の先頭項 (signature) を付随させ, 単項式除算を, signature が
                   1788: 真に小さいものによる除算に限定して Buchberger algorithm 類似の手続きを実行する.
                   1789: @item
                   1790: Buchberger algorithm における useless pair elimination criteria の代わりに,
                   1791: syzygy を用いた criterion や, 同一 signature の S-ペアを 1 つに絞るなどの
                   1792: S-ペア消去手法により, Buchberger algorithm より効率よくグレブナー基底を計算できる場合がある.
                   1793: @item
                   1794: @code{nd_sba} は signature 付き Buchberger algorithm を実行する.
                   1795: 引数, オプション, @code{dp_gr_flags()} で設定されるスイッチは @code{nd_gr} と同一である.
                   1796: @item
                   1797: @code{nd_sba_f4} は @code{nd_sba} において, 複数のS-ペアをまとめて簡約できるような
                   1798: reducer を symbolic preprocessing で集め, 行列上で簡約操作を行う実装である.
                   1799: しかし, 通常の F4 と異なり, SBA の実行は S-ペアを選ぶ順序に鋭敏であり,
                   1800: どのような基準で複数のS-ペアを選ぶかについて実験中である.
                   1801: @end itemize
                   1802:
                   1803: @example
                   1804: [0] load("katsura")$
                   1805: [4] F=katsura(10)$
                   1806: [5] V=[u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10]$
                   1807: [6] cputime(1)$
                   1808: 1.7e-05sec(1.502e-05sec)
                   1809: [7] G=nd_gr(F,V,31991,0)$
                   1810: 83.04sec(83.2sec)
                   1811: [8] Gs=nd_sba(F,V,31991,0)$
                   1812: 12.9sec(12.92sec)
                   1813: [9] G4=nd_f4(F,V,31991,0)$
                   1814: 12.56sec(12.58sec)
                   1815: [10] G4s=nd_sba_f4(F,V,31991,0)$
                   1816: 5.534sec(5.538sec)
                   1817: @end example
                   1818:
                   1819: @table @t
                   1820: @item 参照
                   1821: Risa/Asir ユーザーズマニュアルの「グレブナ基底の計算」
                   1822: @end table
                   1823:
1.21      takayama 1824:
1.59      noro     1825: @node nd_gr nd_gr_trace nd_weyl_gr nd_weyl_gr_trace (module),,, グレブナー基底
                   1826: @subsection @code{nd_gr}, @code{nd_gr_trace} (加群)
1.34      ohara    1827: @findex nd_gr (module)
                   1828: @findex nd_gr_trace (module)
                   1829: @findex nd_weyl_gr (module)
                   1830: @findex nd_weyl_gr_trace (module)
1.21      takayama 1831:
1.59      noro     1832: @comment --- nd_gr, nd_gr_trace における加群のグレブナー基底計算 ---
1.21      takayama 1833: @table @t
1.34      ohara    1834: @item  nd_gr(@var{gen},@var{vars},@var{char},@var{ord})
                   1835: @itemx  nd_gr_trace(@var{gen},@var{vars},@var{homo},@var{char},@var{ord})
                   1836: @item  nd_weyl_gr(@var{gen},@var{vars},@var{char},@var{ord})
                   1837: @itemx  nd_weyl_gr_trace(@var{gen},@var{vars},@var{homo},@var{char},@var{ord})
1.59      noro     1838: :: 部分加群のグレブナー基底の計算
1.21      takayama 1839: @end table
                   1840:
1.34      ohara    1841: @table @var
                   1842: @item gen
1.59      noro     1843: リストのリスト
1.34      ohara    1844: @item ord
1.59      noro     1845: @var{[IsPOT,Ord]} なるリスト
1.34      ohara    1846: @item return
1.59      noro     1847: リストのリスト
1.34      ohara    1848: @end table
1.21      takayama 1849:
                   1850: @itemize @bullet
1.59      noro     1851: @item 多項式環あるいはワイル代数上の自由加群の部分加群のグレブナー基底
                   1852: を計算する. 結果はリストのリストである. 各要素リストは, 自由加群の
                   1853: 元であるベクトルとみなす.
                   1854: @item @var{ord} として @var{[IsPOT,Ord]} という2要素リストが指定された
                   1855: 場合, 加群のグレブナー基底計算を実行する. この場合, @var{gen} は, 多項式
                   1856: のリストのリストとして与える必要がある.
                   1857: @item @var{IsPOT} が 1 の場合, POT (position over term), 0 の
                   1858: 場合 TOP (term over position) で比較する. 基礎環での項比較は @var{Ord}
                   1859: で行う.
                   1860: @item 説明されていない引数は, イデアルの場合の解説を参照のこと.
1.21      takayama 1861: @end itemize
                   1862:
1.34      ohara    1863: @example
                   1864: [0] Gen=[[x,y,z],[y^2+x,x^2,z],[y^2,z^3+x,x+z]];
                   1865: [[x,y,z],[x+y^2,x^2,z],[y^2,x+z^3,x+z]]
                   1866: [1]  nd_gr(Gen,[x,y,z],0,[0,0]);
                   1867: [[x,y,z],[y^2,x^2-y,0],[y^2,x+z^3,x+z],[y^3+z^3*y^2,y^3*x-y^3,
                   1868: -x^3-z*x^2+(z*y^2+y)*x-z*y^2+z*y],[0,0,x^4+z*x^3+(-z*y^2-y)*x^2
                   1869: +(-y^3+z*y^2-z*y)*x+z^4*y^2]]
                   1870: @end example
                   1871:
                   1872: @table @t
1.59      noro     1873: @item 参照
1.34      ohara    1874: @ref{nd_gr}, @ref{nd_gr_trace}
                   1875: @end table
                   1876:
1.59      noro     1877: @node nd_gr nd_gr_trace nd_weyl_gr nd_weyl_gr_trace (option),,, グレブナー基底
1.34      ohara    1878: @subsection @code{nd_gr}, @code{nd_gr_trace} (option)
                   1879: @findex nd_gr (option)
                   1880: @findex nd_gr_trace (option)
                   1881: @findex nd_weyl_gr (option)
                   1882: @findex nd_weyl_gr_trace (option)
                   1883:
1.59      noro     1884: @comment --- nd_gr, nd_gr_trace のオプション ---
1.34      ohara    1885:
                   1886: @table @t
                   1887: @item  nd_gr(@var{...}[|@var{opt},@var{opt},@dots{}])
                   1888: @itemx  nd_gr_trace(@var{...}[|@var{opt},@var{opt},@dots{}])
                   1889: @itemx  nd_weyl_gr(@var{...}[|@var{opt},@var{opt},@dots{}])
                   1890: @itemx  nd_weyl_gr_trace(@var{...}[|@var{opt},@var{opt},@dots{}])
1.59      noro     1891: :: グレブナー基底計算に関する種々のオプションの説明
1.34      ohara    1892: @end table
                   1893:
                   1894: @table @var
                   1895: @item opt
1.59      noro     1896: @var{key=value} なるオプション設定
1.34      ohara    1897: @item return
1.59      noro     1898: オプションにより異なる
1.34      ohara    1899: @end table
                   1900:
                   1901: @itemize @bullet
1.59      noro     1902: @item グレブナー基底計算をオプションにより制御する.
                   1903: @item 現状では次の 3 つのオプションを受け付ける.
1.34      ohara    1904:
                   1905: @table @var
                   1906: @item gentrace
1.59      noro     1907: @var{value} が 0 でないとき, グレブナー基底の計算経過情報を出力する.
1.45      takayama 1908: @item gensyz
1.59      noro     1909: @var{value} が 0 でないとき, 計算されたグレブナー基底に対する syzygy の生成系を出力する.
1.34      ohara    1910: @item nora
1.59      noro     1911: @var{value} が 0 でないとき, 最終ステップで相互簡約を行わない.
1.34      ohara    1912: @end table
                   1913:
1.59      noro     1914: @item @var{gentrace} が指定された場合, 出力は,
                   1915: @var{[GB,Homo,Trace,IntRed,Ind,InputRed,SpairTrace]} なるリストである. 各要素の意味は
                   1916: 次の通りである.
1.34      ohara    1917: @table @var
                   1918: @item GB
1.59      noro     1919: グレブナー基底
1.34      ohara    1920: @item Homo
1.59      noro     1921: 中間基底が斉次化されている場合 1, そうでない場合 0.
1.34      ohara    1922: @item Trace
1.59      noro     1923: 全中間基底に対する計算経過情報
1.34      ohara    1924: @item IntRed
1.59      noro     1925: 相互簡約に対する計算経過情報
1.34      ohara    1926: @item Ind
1.59      noro     1927: 簡約グレブナー基底の各要素の, 全中間基底のにおけるインデックス
1.34      ohara    1928: @item InputRed
1.59      noro     1929: 各入力多項式をグレブナー基底で簡約して剰余 0 を得るまでの計算経過情報
                   1930: (@var{gensyz} が指定された場合)
1.34      ohara    1931: @item SpairTrace
1.59      noro     1932: 簡約グレブナー基底に対する S 多項式を簡約して剰余 0 を得るまでの計算経過情報
                   1933: (syzygy 加群の生成系の要素のみ; @var{gensyz} が指定された場合)
1.34      ohara    1934: @end table
1.59      noro     1935: @item 詳細は, 入力多項式集合とグレブナー基底の相互変換行列, および syzygy 計算
                   1936: 関数の項で説明する予定.
1.34      ohara    1937: @end itemize
1.21      takayama 1938:
                   1939: @example
1.34      ohara    1940: [0] C=[c3*c2*c1*c0-1,((c2+c3)*c1+c3*c2)*c0+c3*c2*c1,...]
                   1941: [1] D=nd_gr_trace(C,[c0,c1,c2,c3,c4],0,1,0|gentrace=1,gensyz=1)$
                   1942: [2] D[0];
                   1943: [c0+c1+c2+c3,-c1^2-2*c3*c1-c3^2,...]
                   1944: [3] D[2];
                   1945: [[[0,0,1],[1,1,1],[2,2,1],[3,3,1]],[4,[[1,2,(1)*<<0,0,0,0>>,1],...]
                   1946: [4] D[6];
                   1947: [[-1,[[1,0,(1)*<<0,0,2,4>>,1],[1,6,(-1)*<<1,0,0,0>>,1],...]
                   1948: @end example
1.21      takayama 1949:
1.34      ohara    1950: @table @t
1.59      noro     1951: @item 参照
1.34      ohara    1952: @ref{nd_gr}, @ref{nd_gr_trace}
                   1953: @end table
1.21      takayama 1954:
                   1955:
1.59      noro     1956: @node システム,,, 実験的仕様の関数
                   1957: @section システム
1.21      takayama 1958:
1.59      noro     1959: @comment --- ◯◯◯◯  関数 syz_pqr, xyz_stu の説明 ◯◯◯◯
                   1960: @comment --- 複数の関数をまとめて説明する例 ---
                   1961: @node asir-port.sh asir-install.sh,,, システム
1.34      ohara    1962: @subsection @code{asir-port.sh}, @code{asir-install.sh}
                   1963: @findex asir-port.sh
                   1964: @findex asir-install.sh
1.23      takayama 1965:
1.59      noro     1966: @comment --- 関数の簡単な説明 ---
                   1967: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.23      takayama 1968: @table @t
1.34      ohara    1969: @item asir-install.sh
                   1970: @itemx asir-port.sh
1.59      noro     1971: :: これは asir の内部コマンドではない. asir をネットワークからダウンロードかつ実行するシェルスクリプト
1.23      takayama 1972: @end table
                   1973:
                   1974:
                   1975: @itemize @bullet
1.34      ohara    1976: @item
1.59      noro     1977: asir-port.sh は knoppix 専用である.
                   1978: このコマンドは asir のバイナリおよび FLL で配布できない部分を
                   1979:  ftp.math.kobe-u.ac.jp よりダウンロードして
                   1980: /home/knoppix/.asir-tmp へセーブして, 実行する.
                   1981: .asirrc および .TeXmacs/plugins/ox/progs/init-ox.scm もダウンロードする.
1.34      ohara    1982: @item
1.59      noro     1983: asir-install.sh は Debian GNU Linux / openxm-binary*.deb 専用である.
                   1984: asir-install.sh は asir をダウンロードして /usr/local/OpenXM/bin および
                   1985: /usr/local/OpenXM/lib/asir へインストールする.
1.23      takayama 1986: @end itemize
                   1987:
                   1988:
1.59      noro     1989: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.23      takayama 1990: @noindent
                   1991: ChangeLog
                   1992: @itemize @bullet
1.34      ohara    1993: @item
1.59      noro     1994:  これらのシェルスクリプトは knoppix/math のために 2004/2, 3 月に書かれた.
1.34      ohara    1995: @item
1.59      noro     1996:   knoppix/math は福岡大学の濱田さんが中心となり開発されている.
1.34      ohara    1997: @item
1.59      noro     1998:   OpenXM/misc/packages/Linux/Debian の下の全てのファイル (2004-2-22 から
                   1999:   2004-3 の末まで). ( ~taka/this03/misc-2003/A3/knoppix-03-05 (プライベートファイル) も見よ.)
                   2000:   OpenXM/src/asir-port の下の次の各ファイル.
1.34      ohara    2001:   Makefile 1.1--1.8, asir-install.sh 1.1--1.2, asir-port.sh 1.1--1.6.
1.23      takayama 2002: @end itemize
                   2003:
                   2004:
1.59      noro     2005: @node asirgui.hnd,,, システム
1.34      ohara    2006: @subsection @code{asirgui.hnd}
                   2007: @findex asirgui.hnd
1.23      takayama 2008:
1.59      noro     2009: @comment --- 関数の簡単な説明 ---
                   2010: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.23      takayama 2011: @table @t
1.34      ohara    2012: @item asirguid.hnd
1.59      noro     2013: :: asirgui の main window のハンドル番号を保持するファイル
1.23      takayama 2014: @end table
                   2015:
1.34      ohara    2016: @comment ****************************************************************
1.23      takayama 2017:
                   2018: @itemize @bullet
1.59      noro     2019: @item asirgui (Windows 版) を起動すると 環境変数 TEMP で指定されたフォルダにこのファイルが作成される.
                   2020: @item 中身は10進整数で, asirgui の main window のハンドルである. このハンドルあてに PostMessage をすれば, asuirgui にキーボードから入力したのと同様な効果が得られる.
                   2021: @item text editor で作成, 保存したファイルを text editor 側から asirgui に読み込ませたりするために利用可能.
                   2022: @item http://www.math.kobe-u.ac.jp/Asir/Add-ons にて winfep.exe を配布している. winfep ではあらかじめファイルに入力スクリプトを書いておいて, asirgui で一行づつ実行させることができる. winfep はプレゼンテーション用のソフトウエアである. これは asirgui.hnd を利用している.
1.23      takayama 2023: @end itemize
                   2024:
                   2025: @example
1.34      ohara    2026: // cl test.c user32.lib
                   2027:
                   2028: #include <windows.h>
                   2029: #include <stdlib.h>
                   2030: #include <stdio.h>
                   2031: #include <process.h>
                   2032:
                   2033: int main()
                   2034: @{
                   2035:
                   2036:        HWND hnd;
                   2037:        FILE *fp = fopen("c:/Program Files/asir/bin/asirgui.hnd","r");
                   2038:        fscanf(fp,"%d",&hnd);
                   2039:        fclose(fp);
                   2040:        while (1) @{
                   2041:                int c;
                   2042:                c = getchar();
                   2043:                if ( c == '#' ) break;
                   2044:                PostMessage(hnd,WM_CHAR,c,1);
                   2045:        @}
                   2046:        return 0;
                   2047: @}
1.23      takayama 2048: @end example
                   2049:
                   2050: @table @t
1.59      noro     2051: @item 参照
1.34      ohara    2052: @ref{xyz_abc}
1.23      takayama 2053: @end table
                   2054:
1.59      noro     2055: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2056: @comment --- openxm の外部からの寄与も述べる. Credit.
1.23      takayama 2057: @noindent
                   2058: ChangeLog
                   2059: @itemize @bullet
1.59      noro     2060: @item この機能は 2006-12-5, 2007-02-13 に加えられた.
1.34      ohara    2061: @item @code{OpenXM_contrib2/windows/asir32gui/asir32gui.clw} 1.11
                   2062: @item @code{OpenXM_contrib2/windows/asir32gui/asir32guiview.cpp}  1.15, 1.1.6
1.59      noro     2063: @item winfep は 2010-01-20 頃に第一版が commit された.
1.37      takayama 2064: @item @code{OpenXM_contrib2/windows/winfep}  1.1
1.23      takayama 2065: @end itemize
                   2066:
                   2067:
1.34      ohara    2068: @comment ****************************************************************
                   2069:
1.59      noro     2070: @node chdir pwd,,, システム
1.34      ohara    2071: @subsection @code{chdir}, @code{pwd}
                   2072: @findex chdir
                   2073: @findex pwd
1.23      takayama 2074:
1.59      noro     2075: @comment --- ディレクトリ操作 ---
1.23      takayama 2076: @table @t
1.34      ohara    2077: @item chdir(@var{directory})
                   2078: @item  pwd()
1.59      noro     2079: :: シェルコマンド cd と pwd に対応する操作.
1.23      takayama 2080: @end table
                   2081:
                   2082: @table @var
                   2083: @item return
1.59      noro     2084: 文字列(@code{pwd}), 整数(@code{chdir})
1.34      ohara    2085: @item dirctory
1.59      noro     2086: 文字列
1.23      takayama 2087: @end table
                   2088:
                   2089: @itemize @bullet
1.34      ohara    2090: @item
1.59      noro     2091: @code{pwd} はカレントディレクトリを文字列で返す.
1.34      ohara    2092: @item
1.59      noro     2093: @code{chdir} はカレントディレクトリを @var{directory} に変更する.  成功すれば 0 を失敗すれば -1 を返す.
1.23      takayama 2094: @end itemize
                   2095:
                   2096: @example
1.34      ohara    2097: [0] S=pwd();
                   2098: /home/ohara
                   2099: [1] chdir(".../taka");
                   2100: -1
                   2101: [2] chdir("/usr/bin");
                   2102: 0
1.23      takayama 2103: @end example
                   2104:
1.59      noro     2105: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2106: @comment --- openxm の外部からの寄与も述べる. Credit.
1.23      takayama 2107: @noindent
                   2108: ChangeLog
                   2109: @itemize @bullet
1.34      ohara    2110: @item
1.59      noro     2111: これらの関数は 2008-8-27 にコミットされた.
                   2112: 変更をうけたソースコードは builtin/miscf.c (1.27) である.
1.23      takayama 2113: @end itemize
                   2114:
                   2115:
1.59      noro     2116: @node dcurrenttime,,, システム
1.34      ohara    2117: @subsection @code{dcurrenttime}
                   2118: @findex dcurrenttime
1.23      takayama 2119:
1.59      noro     2120: @comment --- 現在時刻を取得 ---
1.23      takayama 2121: @table @t
1.34      ohara    2122: @item  dcurrenttime()
1.59      noro     2123: :: 現在時刻を取得.
1.23      takayama 2124: @end table
                   2125:
1.34      ohara    2126: @table @var
                   2127: @item return
1.59      noro     2128: 浮動小数点数
1.34      ohara    2129: @end table
1.23      takayama 2130:
                   2131: @itemize @bullet
1.34      ohara    2132: @item
1.59      noro     2133: 返り値は1970年1月1日0時0分0秒からの経過秒数である.
1.23      takayama 2134: @end itemize
                   2135:
                   2136: @example
1.34      ohara    2137: [0] ctrl("real_digit", 16);
                   2138: 16
                   2139: [1] dcurrenttime();
                   2140: 1226390851.34476
                   2141: [2] currenttime();
                   2142: 1226390854
1.23      takayama 2143: @end example
                   2144:
                   2145: @table @t
1.59      noro     2146: @item 参照
1.34      ohara    2147: @ref{currenttime}
1.23      takayama 2148: @end table
                   2149:
1.59      noro     2150: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2151: @comment --- openxm の外部からの寄与も述べる. Credit.
1.23      takayama 2152: @noindent
                   2153: ChangeLog
                   2154: @itemize @bullet
1.34      ohara    2155: @item
1.59      noro     2156: この関数は 2008-9-12 にコミットされた.
                   2157: 変更をうけたソースコードは builtin/time.c (1.6) である.
1.23      takayama 2158: @end itemize
                   2159:
                   2160:
1.59      noro     2161: @node getpid,,, システム
1.47      takayama 2162: @subsection @code{getpid}
                   2163: @findex getpid
                   2164:
1.59      noro     2165: @comment --- 関数の簡単な説明 ---
                   2166: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.47      takayama 2167: @table @t
                   2168: @item getpid()
                   2169: @end table
                   2170:
                   2171: @table @var
                   2172: @item return
1.59      noro     2173: 整数
1.47      takayama 2174: @end table
                   2175:
                   2176: @itemize @bullet
1.59      noro     2177: @item asir のプロセス番号を戻す.
                   2178: @item プロセス番号は asir, ox_asir 等で独立したプロセスに対してシステム内で一意である.
1.47      takayama 2179: @end itemize
                   2180:
                   2181: @example
1.48      ohara    2182: [219] getpid();
1.47      takayama 2183: 3214
                   2184: @end example
                   2185:
                   2186:
1.59      noro     2187: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2188: @comment --- openxm の外部からの寄与も述べる. Credit.
1.47      takayama 2189: @noindent
                   2190: ChangeLog
                   2191: @itemize @bullet
1.59      noro     2192: @item この関数は ox_work_dir() 関数が一意な作業ファイル名を得るために使われている.
1.47      takayama 2193: src/asir-contrib/packages/src/misc/rr 1.3,
                   2194: asir2000/builtin/file.c 1.28, rat.c 1.5,
1.59      noro     2195: asir2000/parse/puref.c 1.9 を参照 (2013/02/15, 18).
1.47      takayama 2196: @end itemize
                   2197:
                   2198:
1.59      noro     2199: @node loadpath,,, システム
1.48      ohara    2200: @subsection @code{loadpath}
                   2201: @findex loadpath
                   2202:
1.59      noro     2203: @comment --- 関数の簡単な説明 ---
                   2204: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.48      ohara    2205: @table @t
                   2206: @item ctrl(``loadpath''[,list])
                   2207: @end table
                   2208:
                   2209: @table @var
                   2210: @item list
1.59      noro     2211: 文字列(パス)のリスト
1.48      ohara    2212: @item return
1.59      noro     2213: 文字列(パス)のリスト, または数(listが与えられたとき)
1.48      ohara    2214: @end table
                   2215:
                   2216: @itemize @bullet
1.59      noro     2217: @item asir の組み込み関数 ctrl のスイッチのひとつである.
                   2218: @item asir のロードパスの出力または設定を行う.
1.48      ohara    2219: @end itemize
                   2220:
                   2221: @example
                   2222: [0] L=ctrl("loadpath");
                   2223: [/home/you/OpenXM/lib/asir-contrib,/home/you/OpenXM/lib/asir,.]
                   2224: [1] ctrl("loadpath", cons(getenv("HOME")+"/lib",L));
                   2225: 0
                   2226: @end example
                   2227:
                   2228:
1.59      noro     2229: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2230: @comment --- openxm の外部からの寄与も述べる. Credit.
1.48      ohara    2231: @noindent
                   2232: ChangeLog
                   2233: @itemize @bullet
1.59      noro     2234: @item この関数は 2014-5-12 にコミットされた.
                   2235: 変更をうけたソースコードは builtin/ctrl.c (1.41) である.
1.48      ohara    2236: @end itemize
                   2237:
                   2238:
1.59      noro     2239: @node sysinfo,,, システム
1.48      ohara    2240: @subsection @code{sysinfo}
                   2241: @findex sysinfo
                   2242:
1.59      noro     2243: @comment --- 関数の簡単な説明 ---
                   2244: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.48      ohara    2245: @table @t
                   2246: @item sysinfo()
                   2247: @end table
                   2248:
                   2249: @table @var
                   2250: @item return
1.59      noro     2251: 文字列のリスト
1.48      ohara    2252: @end table
                   2253:
                   2254: @itemize @bullet
1.59      noro     2255: @item asir の動作しているオペレーティングシステムの情報を返す.
                   2256: @item リストの各成分は, OSタイプ, カーネル名, OS名, CPUタイプ, OSバージョン, 完全な情報, ロケールである.
                   2257: @item OSタイプは unix, macosx, windows のいずれかである.
                   2258: @item unix および macosx においては, システムコールおよび uname コマンドにより情報を取得している.
                   2259: windows では, GetVersionEx() などの Win32 API が用いられている.
1.48      ohara    2260: @end itemize
                   2261:
                   2262: @example
                   2263: [0] sysinfo();
                   2264: [windows,WindowsNT,Windows7,x86_64,6.1.7601,WindowsNT 6.1.7601 Windows7 Service Pack 1 x86_64,ja]
                   2265: @end example
                   2266:
                   2267:
1.59      noro     2268: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2269: @comment --- openxm の外部からの寄与も述べる. Credit.
1.48      ohara    2270: @noindent
                   2271: ChangeLog
                   2272: @itemize @bullet
1.59      noro     2273: @item この関数は 2014-5-14 にコミットされた.
                   2274: 変更をうけたソースコードは builtin/ctrl.c (1.42) である.
1.48      ohara    2275: @end itemize
                   2276:
                   2277:
1.34      ohara    2278: @comment ****************************************************************
                   2279:
                   2280:
1.59      noro     2281: @node 言語,,, 実験的仕様の関数
                   2282: @section 言語
1.34      ohara    2283:
1.59      noro     2284: @node get_struct_name get_element_names get_element_at put_element_at,,, 言語
1.34      ohara    2285: @subsection @code{get_struct_name}, @code{get_element_names}, @code{get_element_at}, @code{put_element_at}
                   2286: @findex get_struct_name
                   2287: @findex get_element_names
                   2288: @findex get_element_at
                   2289: @findex put_element_at
1.23      takayama 2290:
1.59      noro     2291: @comment --- 関数の簡単な説明 ---
                   2292: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.23      takayama 2293: @table @t
1.34      ohara    2294: @item get_struct_name(@var{s})
                   2295: @itemx get_element_names(@var{s})
                   2296: @itemx get_element_at(@var{s},@var{key})
                   2297: @itemx put_element_at(@var{s},@var{key},@var{obj})
1.59      noro     2298: :: 構造体 @var{s} に対する操作
1.23      takayama 2299: @end table
                   2300:
                   2301: @table @var
                   2302: @item return
1.59      noro     2303: 文字列 (get_struct_name),
                   2304: 文字列のリスト (get_element_names),
                   2305: オブジェクト (get_element_at),
                   2306: オブジェクト (put_element_at)
1.34      ohara    2307: @item s
1.59      noro     2308: 構造体
1.34      ohara    2309: @item key
1.59      noro     2310: 文字列
1.34      ohara    2311: @item obj
1.59      noro     2312: オブジェクト
1.23      takayama 2313: @end table
                   2314:
                   2315: @itemize @bullet
1.34      ohara    2316: @item
1.59      noro     2317:  @code{get_struct_name(s)} は, 構造体 @var{s} の名前を戻す.
1.34      ohara    2318: @item
1.59      noro     2319:  @code{get_element_names(s)} は, 構造体のメンバーの名前のリストを戻す.
1.34      ohara    2320: @item
1.59      noro     2321:  @code{get_element_at(s,key)} は構造体 s のメンバー key の値を戻す.
1.34      ohara    2322: @item
1.59      noro     2323:  @code{put_element_at(s,key,obj)} は構造体 s のメンバー key の値を obj に設定する.
1.23      takayama 2324: @end itemize
                   2325:
                   2326: @example
1.34      ohara    2327: [219]  struct point @{ x, y, color@};
                   2328: [220]  P = newstruct(point);
                   2329: @{0,0,0@}
                   2330: [221]  P->x = 10$ P->y=5$ P->color="red"$
                   2331: [222]  get_element_names(P);
                   2332: [x,y,color]
                   2333: [223] put_element_at(P,"color","blue");
                   2334: blue
                   2335: [224] P->color;
                   2336: bule
1.23      takayama 2337: @end example
                   2338:
                   2339: @table @t
1.59      noro     2340: @item 参照
1.34      ohara    2341: @ref{newstruct}, @ref{struct}
1.23      takayama 2342: @end table
                   2343:
1.59      noro     2344: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2345: @comment --- openxm の外部からの寄与も述べる. Credit.
1.23      takayama 2346: @noindent
                   2347: ChangeLog
                   2348: @itemize @bullet
1.59      noro     2349: @item  構造体の定義を知らずに構造体を扱うユーザ関数を書くときに便利.
                   2350:        asir-contrib の noro_print.rr を見よ.
1.34      ohara    2351: @item  OpenXM_contrib2/asir2000/builtin/compobj.c 1.8.
1.23      takayama 2352: @end itemize
                   2353:
                   2354:
1.34      ohara    2355: @comment  mapat
1.59      noro     2356: @node mapat,,, 言語
1.34      ohara    2357: @subsection @code{mapat}
                   2358: @findex mapat
1.23      takayama 2359:
                   2360: @table @t
1.34      ohara    2361: @item mapat(@var{fname},@var{pos}[,@var{arg0}, @var{arg1}, ...])
1.59      noro     2362: :: @var{pos} に対する map 関数
1.23      takayama 2363: @end table
                   2364:
                   2365: @table @var
                   2366: @item return
1.59      noro     2367: オブジェクト
1.34      ohara    2368: @item pos
1.59      noro     2369: 整数
1.34      ohara    2370: @item arg0, arg1, arg2, ...
1.59      noro     2371: オブジェクト
1.23      takayama 2372: @end table
                   2373:
                   2374: @itemize @bullet
1.34      ohara    2375: @item
1.59      noro     2376: @code{map} 関数は 0 番目の引数に対してしか動作しないが, @code{mapat}
                   2377: 関数は指定した番号の引数に対して @code{map} 関数を実行する.
1.34      ohara    2378: @item
1.59      noro     2379: @code{mapat(fname,0,A0,A1,...)} は
                   2380: @code{map(fname,A0,A1,...)} に等価である.
1.34      ohara    2381: @item
1.59      noro     2382: 次の副作用がある. まだ書いてない.
1.23      takayama 2383: @end itemize
                   2384:
                   2385: @example
1.34      ohara    2386: [219] mapat(deg,1,x^2+y^3+x+y,[x,y]);
                   2387: [2,3]
                   2388: [220] mapat(subst,1,x+y+z,[x,y,z],2);
                   2389: [y+z+2,x+z+2,x+y+2]
1.23      takayama 2390: @end example
                   2391:
                   2392: @table @t
1.59      noro     2393: @item 参照
1.34      ohara    2394: @ref{map}
1.23      takayama 2395: @end table
                   2396:
1.59      noro     2397: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2398: @comment --- openxm の外部からの寄与も述べる. Credit.
1.23      takayama 2399: @noindent
                   2400: ChangeLog
                   2401: @itemize @bullet
1.59      noro     2402: @item この関数は 2004-6-22 にコミットされた.
                   2403:  変更をうけたソースコードは builtin/pf.c, subst.c である.
1.23      takayama 2404: @end itemize
                   2405:
1.34      ohara    2406: @comment  list
1.59      noro     2407: @node list,,, 言語
1.34      ohara    2408: @subsection @code{list}
                   2409: @findex list
1.23      takayama 2410:
                   2411: @table @t
1.34      ohara    2412: @item list([@var{arg0}, @var{arg1}, ...])
1.59      noro     2413: :: list を生成する.
1.23      takayama 2414: @end table
                   2415:
                   2416: @table @var
                   2417: @item return
1.59      noro     2418: リスト
1.34      ohara    2419: @item arg0, arg1, arg2, ...
1.59      noro     2420: オブジェクト
1.23      takayama 2421: @end table
                   2422:
1.34      ohara    2423: @itemize @bullet
                   2424: @item
1.59      noro     2425: @var{arg0}, @var{arg1}, ... を要素とするリストを生成する.
1.23      takayama 2426: @end itemize
                   2427:
                   2428: @example
1.34      ohara    2429: [219] list(1,2,3);
                   2430: [1,2,3]
                   2431: [220] list(1,2,[3,4]);
                   2432: [1,2,[3,4]]
1.23      takayama 2433: @end example
                   2434:
                   2435: @table @t
1.59      noro     2436: @item 参照
1.34      ohara    2437: @ref{cons}
1.23      takayama 2438: @end table
                   2439:
1.59      noro     2440: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2441: @comment --- openxm の外部からの寄与も述べる. Credit.
1.23      takayama 2442: @noindent
                   2443: ChangeLog
                   2444: @itemize @bullet
1.59      noro     2445: @item この関数は 2004-6-22 にコミットされた.
                   2446:  変更をうけたソースコードは builtin/list.c である.
1.23      takayama 2447: @end itemize
                   2448:
                   2449:
1.59      noro     2450: @node assoc,,, 言語
1.34      ohara    2451: @subsection @code{assoc}
                   2452: @findex assoc
1.23      takayama 2453:
1.59      noro     2454: @comment --- 関数の簡単な説明 ---
1.23      takayama 2455: @table @t
1.34      ohara    2456: @item assoc(@var{a},@var{b})
1.59      noro     2457: :: 連想リストをつくる
1.23      takayama 2458: @end table
                   2459:
                   2460: @table @var
                   2461: @item return
1.34      ohara    2462: List
                   2463: @item a
                   2464: List
                   2465: @item b
                   2466: List
1.23      takayama 2467: @end table
                   2468:
                   2469: @itemize @bullet
1.59      noro     2470: @item リスト @var{a}, @var{b} より
1.34      ohara    2471: [[@var{a}[0],@var{b}[0]], [@var{a}[1],@var{b}[1]], ...]
1.59      noro     2472: なる新しいリストを生成する.
1.23      takayama 2473: @end itemize
                   2474:
1.59      noro     2475: 下の例では @code{A} に動物の名前が,
                   2476: @code{B} に足の本数が入っている.
                   2477: @code{assoc(A,B)} で動物と足の本数をペアにしたリストを生成する.
1.34      ohara    2478:
1.23      takayama 2479: @example
1.34      ohara    2480: [1192]  A=["dog","cat","snake"];
                   2481: [dog,cat,snake]
                   2482: [1193] B=[4,4,0];
                   2483: [4,4,0]
                   2484: [1194] assoc(A,B);
                   2485: [[dog,4],[cat,4],[snake,0]]
1.23      takayama 2486: @end example
                   2487:
                   2488: @table @t
1.59      noro     2489: @item 参照
1.34      ohara    2490: @ref{cons}, @ref{append}
1.23      takayama 2491: @end table
                   2492:
1.59      noro     2493: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.23      takayama 2494: @noindent
                   2495: ChangeLog
                   2496: @itemize @bullet
1.34      ohara    2497: @item
1.59      noro     2498:  この関数は 2004-6-28 に書かれた.
                   2499:  変更をうけたソースコードは
1.34      ohara    2500:  builtin/list.c 1.9
                   2501:  parse/eval.c 1.35,
                   2502:  parse/parse.h 1.31,
                   2503:  parse/quote.c 1.14--1.16.
1.23      takayama 2504: @end itemize
                   2505:
1.34      ohara    2506:
1.59      noro     2507: @node set_secure_flag set_secure_mode,,, 言語
1.34      ohara    2508: @subsection @code{set_secure_flag}, @code{set_secure_mode}
                   2509: @findex set_secure_flag
                   2510: @findex set_secure_mode
1.23      takayama 2511:
1.59      noro     2512: @comment --- 関数の簡単な説明 ---
                   2513: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.23      takayama 2514: @table @t
1.34      ohara    2515: @item set_secure_flag(@var{fname},@var{m})
                   2516: @itemx set_secure_mode(@var{m})
1.59      noro     2517: :: 関数の実行権限を設定する.  (web サービス用)
1.23      takayama 2518: @end table
                   2519:
                   2520: @table @var
                   2521: @item return
1.59      noro     2522: 整数
1.34      ohara    2523: @item fname
1.59      noro     2524: 文字列
1.34      ohara    2525: @item m
1.59      noro     2526: 整数
1.23      takayama 2527: @end table
                   2528:
                   2529: @itemize @bullet
1.59      noro     2530: @item @code{set_secure_flag}, @code{set_secure_mode} は
                   2531: asir を web サーバ等で公開するために加えられた関数.
                   2532: @code{set_secure_flag} で公開する関数を指定する.
                   2533: @code{secure_mode} が 1 の場合は @code{set_secure_flag} で指定された
                   2534: 関数しか実行できない.
                   2535: 関数の実行途中では @code{secure_mode} が 0 となっているので,
                   2536: 任意の関数を実行できる.
                   2537: またエラーの時等は, @code{secure_mode} は 1 に自動的に復帰する.
                   2538: ただし @code{def} は実行できない.
                   2539: 公開する関数では, その処理中は任意の関数が実行できるので,
                   2540: security に十分注意した実装をする必要がある.
                   2541: @item
                   2542: @code{set_secure_flag} は, @var{fname} の secure flag を @var{m}
                   2543: にする.
                   2544: 公開する命令は 1 に設定する.
                   2545: @item
                   2546: @var{set_secure_mode(1)} で @code{secure_mode} が 1 となり,
                   2547: 公開された関数しか実行できなくなる.
                   2548: quit 等も実行できないので注意.
                   2549: @item  @code{ timer } の引数として secure_flag を設定していない関数を
                   2550: 指定して実行してもエラーが表示されない.
                   2551: このときは, @code{ ctrl("error_in_timer",1) } を実行しておく.
1.23      takayama 2552: @end itemize
                   2553:
                   2554: @example
1.34      ohara    2555: [1194] set_secure_flag("print_input_form_",1);
                   2556: 1
                   2557: [1195] set_secure_flag("fctr",1);
                   2558: 1
                   2559: [220] set_secure_mode(1);
                   2560: 1
                   2561: [1197] fctr((x-1)^3);
                   2562: [[1,1],[x-1,3]]
                   2563: [1198] fctr(shell("ls"));
                   2564: evalf : shell not permitted
                   2565: return to toplevel
1.23      takayama 2566: @end example
                   2567:
                   2568: @table @t
1.59      noro     2569: @item 参照
1.34      ohara    2570: @ref{timer}
1.23      takayama 2571: @end table
                   2572:
                   2573: @noindent
                   2574: ChangeLog
                   2575: @itemize @bullet
1.59      noro     2576: @item @code{set_secure_flag}, @code{set_secure_mode} は asir を
                   2577: web サーバ等で公開するために加えられた関数.
                   2578: sm1 の同様な関数 RestrictedMode で採用された方法を用いている.
                   2579: つまり, @code{set_secure_flag} で公開する関数を指定する.
                   2580: @code{secure_mode} が 1 の場合は @code{set_secure_flag} で指定された
                   2581: 関数しか実行できない.
                   2582: v関数の実行途中では @code{secure_mode} が 0 となっているので,
                   2583: 任意の関数を実行できる.
                   2584: @item この関数は 2004-10-27 から 2004-11-22 にかけて開発された.
                   2585: @item cgiasir.sm1, cgi-asir.sh と組み合わせて cgi サービスを提供するために
                   2586: 利用する.
                   2587: cgi-asir.sh では
                   2588: @code{CGI_ASIR_ALLOW} 環境変数で公開するコマンドを指定する.
1.34      ohara    2589: @item
                   2590:   1.24--1.25      OpenXM_contrib2/asir2000/builtin/miscf.c
                   2591: @item
                   2592:   1.36--1.38      OpenXM_contrib2/asir2000/parse/eval.c
                   2593: @item
                   2594:   1.6--1.7       OpenXM_contrib2/asir2000/parse/function.c
                   2595: @item
                   2596:   1.33      OpenXM_contrib2/asir2000/parse/parse.h
1.23      takayama 2597: @end itemize
                   2598:
1.59      noro     2599: @node initialize_static_variable,,, 言語
1.34      ohara    2600: @subsection @code{initialize_static_variable}
                   2601: @findex initialize_static_variable
                   2602:
1.23      takayama 2603:
1.59      noro     2604: @comment --- 説明 ---
1.23      takayama 2605: @table @t
1.59      noro     2606: @item static 変数の初期化の問題点. 初期化の時に segmentation fault がおきる.
1.23      takayama 2607: @end table
                   2608:
                   2609:
                   2610: @itemize @bullet
1.59      noro     2611: @item static 変数の取扱.
                   2612: 下の例を参照のこと.
1.23      takayama 2613: @end itemize
                   2614:
1.34      ohara    2615:
1.23      takayama 2616: @example
1.34      ohara    2617: if (1) @{
                   2618:  module abc;
                   2619:  static A;
                   2620:  A=1;
                   2621:  endmodule;
                   2622: @} else @{ @};
1.23      takayama 2623:
1.34      ohara    2624: end$
1.59      noro     2625: を t.rr とするとき,
1.23      takayama 2626:
1.34      ohara    2627: [6] load("./t.rr");
                   2628: 1
                   2629: internal error (SEGV)
1.59      noro     2630: となる.
1.23      takayama 2631:
1.59      noro     2632: t.rr を
1.34      ohara    2633: if (1) @{
                   2634:  module abc;
                   2635:  static A;
                   2636:  localf initA;
                   2637:  localf foo;
                   2638:  def initA() @{
                   2639:    A=1;
                   2640:  @}
                   2641:  initA();
                   2642:  def foo() @{
                   2643:    return A;
                   2644:  @}
                   2645:  endmodule;
                   2646: @} else @{ @};
1.23      takayama 2647:
1.34      ohara    2648: end$
1.59      noro     2649: とすると正しく初期化される.
1.23      takayama 2650: @end example
                   2651:
1.34      ohara    2652: @comment --- ChangeLog
1.23      takayama 2653: @noindent
                   2654: ChangeLog
                   2655: @itemize @bullet
1.59      noro     2656: @item  oxasir-win.rr の取扱で問題点として浮上.  2005.07.25.
                   2657: @item  oxasir-win.rr の取扱で double quote の取り扱いに問題があったが, これは asir2000/io/ox_asir.c, 1.58, で問題点解決.
                   2658: @item ox_asir に計算を依頼する時は if (1) @{ ... @}で囲む.
1.23      takayama 2659: @end itemize
1.34      ohara    2660:
1.23      takayama 2661: @comment ****************************************************************
1.13      takayama 2662:
1.59      noro     2663: @node function,,, 言語
1.56      takayama 2664: @subsection @code{function}
                   2665: @findex function
                   2666:
                   2667: @table @t
1.59      noro     2668: @item function 宣言することにより函数形式の不定元を生成できる.
1.56      takayama 2669: @end table
                   2670:
1.59      noro     2671: @comment --- 説明 ---
1.56      takayama 2672: @table @t
1.59      noro     2673: @item function 宣言することにより函数形式の不定元を生成できる.
                   2674: @item 微分函数 diff はこの函数形式の不定元の微分をやはり函数形式の不定元として生成する.
                   2675: たとえば f@{1,2@}(x,y) は f を x について一階偏微分, y について 2階偏微分したもの.
                   2676: @item diff は合成関数としての処理も行う.
1.56      takayama 2677: @end table
                   2678:
                   2679:
                   2680: @example
                   2681: [1915] function f(x,y);
                   2682: [1916] F=f(f(x,y),y)$
                   2683: [1917] diff(F,y);
                   2684: f@{1,0@}(f(x,y),y)*f@{0,1@}(x,y)+f@{0,1@}(f(x,y),y)
                   2685: [1918] vtype(f(p,q));
                   2686: 2
                   2687: [1919] deg(diff(F,y),f@{0,1@}(x,y));
                   2688: 1
                   2689: @end example
                   2690:
                   2691: @xref{vtype}
                   2692: @xref{diff}
                   2693:
                   2694: @comment --- ChangeLog
                   2695: @noindent
                   2696: ChangeLog
                   2697: @itemize @bullet
1.59      noro     2698: @item  いつの commit で導入されたか不明.
1.56      takayama 2699: @end itemize
                   2700:
                   2701: @comment ****************************************************************
                   2702:
1.59      noro     2703: @node 数論・代数,,, 実験的仕様の関数
                   2704: @section 数論・代数
1.34      ohara    2705:
1.24      takayama 2706:
1.59      noro     2707: @node small_jacobi,,, 数論・代数
1.34      ohara    2708: @subsection @code{small_jacobi}
                   2709: @findex small_jacobi
1.24      takayama 2710:
1.59      noro     2711: @comment --- 関数の簡単な説明 ---
1.24      takayama 2712: @table @t
1.34      ohara    2713: @item small_jacobi(@var{a},@var{m})
1.59      noro     2714: :: Jacobi 記号の計算
1.24      takayama 2715: @end table
                   2716:
1.34      ohara    2717: @table @var
                   2718: @item return
1.59      noro     2719: 整数
1.34      ohara    2720: @item arg1, arg2
1.59      noro     2721: 整数
1.34      ohara    2722: @end table
1.24      takayama 2723:
                   2724: @itemize @bullet
1.34      ohara    2725: @item
1.59      noro     2726:  @var{m} が素数のときは Legendre 記号とよばれ,
                   2727:  x^2 = @var{a} mod @var{m} に解があるとき 1, 解がないとき -1 をもどす.
1.34      ohara    2728: @item
1.59      noro     2729: Jacobi 記号は Legendre 記号の積で定義される (初等整数論の本参照).
1.34      ohara    2730: @item
1.59      noro     2731:  この関数は machine int の範囲で jacobi 記号を計算する.
1.24      takayama 2732: @end itemize
                   2733:
                   2734: @example
1.34      ohara    2735: [1286] small_jacobi(2,3);
                   2736: -1
                   2737: [1287] small_jacobi(2,7);
                   2738: 1
1.24      takayama 2739: @end example
                   2740:
                   2741: @table @t
1.59      noro     2742: @item 参照
1.34      ohara    2743: http://members.jcom.home.ne.jp/yokolabo/asirlib/
1.59      noro     2744: も見てね.
1.24      takayama 2745: @end table
                   2746:
1.59      noro     2747: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
1.24      takayama 2748: @noindent
                   2749: ChangeLog
                   2750: @itemize @bullet
1.59      noro     2751: @item この関数の由来は不明.
1.24      takayama 2752: @end itemize
                   2753:
1.34      ohara    2754:
1.59      noro     2755: @node noro_matrix.rr,,, 数論・代数
1.25      takayama 2756: @subsection @code{noro_matrix.rr}
                   2757: @findex noro_matrix.rr
                   2758:
1.59      noro     2759: @comment --- 関数の簡単な説明 ---
                   2760: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.25      takayama 2761: @table @t
                   2762: @item linalg.unit_mat(@var{arg1})
                   2763: @item linalg.random_rmat(@var{arg1}, @var{arg2}, @var{arg3})
                   2764: @item linalg.minipoly_mat(@var{arg1})
                   2765: @item linalg.compute_kernel(@var{arg1})
                   2766: @item linalg.compute_image(@var{arg1})
                   2767: @item linalg.jordan_canonical_form(@var{arg1})
                   2768: @end table
                   2769:
                   2770:
                   2771: @itemize @bullet
1.59      noro     2772: @item 簡単な解説および実例は http://www.math.kobe-u.ac.jp/HOME/taka/2007/knx/noro_matrix-ja.txt を参照.
1.25      takayama 2773: @end itemize
                   2774:
                   2775: @example
                   2776: load("noro_matrix.rr");
                   2777: A=newmat(4,4,[[2,0,0,0],[3,5,1,0],[-9,-9,-1,0],[-5,0,0,1]]);
                   2778: B=linalg.jordan_canonical_form(A);
                   2779: @end example
                   2780:
                   2781: @table @t
1.59      noro     2782: @item 参照
1.25      takayama 2783: @ref{invmat}
                   2784: @end table
                   2785:
1.59      noro     2786: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2787: @comment --- openxm の外部からの寄与も述べる. Credit.
1.25      takayama 2788: @noindent
                   2789: ChangeLog
                   2790: @itemize @bullet
1.59      noro     2791: @item この関数は 2004-04 頃から線形代数III の講義をしながら書かれた.
                   2792: @item ソース:  OpenXM/src/asir-contrib/packages/src/noro_matrix.rr
1.25      takayama 2793: @end itemize
                   2794:
                   2795:
1.59      noro     2796: @node f_res,,, 数論・代数
1.26      takayama 2797: @subsection @code{f_res}
                   2798: @findex f_res
1.25      takayama 2799:
1.59      noro     2800: @comment --- 関数の簡単な説明 ---
1.25      takayama 2801: @table @t
1.26      takayama 2802: @item f_res
1.25      takayama 2803: @end table
                   2804:
                   2805:
                   2806: @itemize @bullet
1.59      noro     2807: @item f_res は各種の終結式を計算するモジュールである. ox_grep("f_res"); で online manual を閲覧可能である.
1.25      takayama 2808: @end itemize
                   2809:
                   2810: @table @t
1.59      noro     2811: @item 参照
1.25      takayama 2812: @ref{}
                   2813: @end table
                   2814:
1.59      noro     2815: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   2816: @comment --- openxm の外部からの寄与も述べる. Credit.
1.25      takayama 2817: @noindent
                   2818: ChangeLog
                   2819: @itemize @bullet
1.59      noro     2820: @item このモジュールは Fujiwara 君の修士論文が元になり, それを改造したものである.
1.26      takayama 2821: @item OpenXM/src/ox_cdd, OpenXM/src/asir-contrib/packages/src/f_res.rr
1.25      takayama 2822: @end itemize
                   2823:
                   2824:
1.59      noro     2825: @node D 加群の制限に関する関数,,, 実験的仕様の関数
                   2826: @section D 加群の制限に関する関数
1.27      ohara    2827:
                   2828:
1.59      noro     2829: @node nk_restriction.restriction,,, D 加群の制限に関する関数
1.29      nakayama 2830: @subsection @code{nk_restriction.restriction}
1.59      noro     2831: @comment --- 索引用キーワード
1.29      nakayama 2832: @findex nk_restriction.restriction
                   2833:
1.59      noro     2834: @comment --- 関数の簡単な説明 ---
1.29      nakayama 2835: @table @t
1.34      ohara    2836: @item nk_restriction.restriction(@var{Id}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     2837: :: D 加群 M = D / @var{Id} (ホロノミック D イデアル @var{Id}) に対して,
                   2838: 重みベクトル @var{W} についての制限加群を返す.
1.29      nakayama 2839: @end table
                   2840:
1.59      noro     2841: @comment --- 引数の簡単な説明 ---
1.29      nakayama 2842: @table @var
                   2843: @item Id
1.59      noro     2844: イデアルの生成元のリスト
1.29      nakayama 2845: @item VL
1.59      noro     2846: 変数のリスト
1.29      nakayama 2847: @item DVL
1.59      noro     2848: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.29      nakayama 2849: @item W
1.59      noro     2850: 重みベクトルを表すリスト
1.29      nakayama 2851: @end table
                   2852:
                   2853: @itemize @bullet
                   2854: @item
1.59      noro     2855: @var{W} の要素は非負整数で, 0 番目の要素から連続して正の整数が入らなければならない.
                   2856: (すなわち, @code{[1,1,0,0,0]} は OK だが、 @code{[1,0,1,0,0]} はダメ)
1.29      nakayama 2857: @item
1.59      noro     2858: 正の重みを持つ変数についての制限を行う.
                   2859: 例えば, @var{VL} @code{=[x,y,z]}, @var{W} @code{=[1,1,0]} であれば,
                   2860: x,y について制限を行う.
1.29      nakayama 2861: @end itemize
                   2862:
1.59      noro     2863: 以下は, イデアル
1.34      ohara    2864: @iftex
1.29      nakayama 2865: @tex
1.34      ohara    2866: $I = D \cdot \{x \partial_x -1, y \partial_y - 1\} $
                   2867: @end tex
1.59      noro     2868: とおいた時, D 加群
1.52      nakayama 2869: @tex $M = D / I$ @end tex
1.59      noro     2870: の
1.52      nakayama 2871: @tex $x$ @end tex
1.34      ohara    2872: @end iftex
                   2873: @ifinfo
1.59      noro     2874: I = D . @{ x dx -1, y dy - 1 @} とおいた時,
                   2875: D 加群 M = D / I の x
1.34      ohara    2876: @end ifinfo
1.59      noro     2877: についての制限加群を計算した例である.
1.29      nakayama 2878: @example
                   2879: [1432] nk_restriction.restriction([x*dx-1,y*dy-1],[x,y],[dx,dy],[1,0]);
                   2880: -- generic_bfct_and_gr :0.001sec(0.001629sec)
                   2881: generic bfct : [[1,1],[s-1,1]]
                   2882: S0 : 1
1.33      ohara    2883: B_@{S0@} length : 2
1.29      nakayama 2884: -- fctr(BF) + base :0.000999sec(0.0005109sec)
                   2885: [[y*dy-1,(y*dy-1)*dx,-1],[[1],[0]]]
                   2886: @end example
1.59      noro     2887: 返り値の第 1 番目の要素 @code{[[1],[0]]]} は,
                   2888: 制限加群の基底
1.52      nakayama 2889: @iftex
1.51      nakayama 2890: @tex $\partial_x^1, \partial_x^0$ @end tex
1.59      noro     2891: を意味し,
                   2892: 返り値の第 0 番目の要素から, 制限加群は
1.51      nakayama 2893: @tex $(y \partial_y - 1, 0), (0, y\partial_y-1), (-1,0)$ @end tex
1.52      nakayama 2894: @end iftex
                   2895: @ifinfo
                   2896: dx^1, dx^0
1.59      noro     2897: を意味し,
                   2898: 返り値の第 0 番目の要素から, 制限加群は
1.52      nakayama 2899: (y dy - 1, 0), (0, ydy-1), (-1,0)
                   2900: @end ifinfo
1.59      noro     2901: で生成されることがわかる.
1.29      nakayama 2902:
1.59      noro     2903: @node nk_restriction.restriction_ideal,,, D 加群の制限に関する関数
1.29      nakayama 2904: @subsection @code{nk_restriction.restriction_ideal}
1.59      noro     2905: @comment --- 索引用キーワード
1.29      nakayama 2906: @findex nk_restriction.restriction_ideal
                   2907:
1.59      noro     2908: @comment --- 関数の簡単な説明 ---
1.29      nakayama 2909: @table @t
1.34      ohara    2910: @item nk_restriction.restriction_ideal(@var{Id}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     2911: :: ホロノミック D イデアル @var{Id} を重みベクトル @var{W} についての制限イデアルを返す.
1.29      nakayama 2912: @end table
                   2913:
1.59      noro     2914: @comment --- 引数の簡単な説明 ---
1.29      nakayama 2915: @table @var
                   2916: @item Id
1.59      noro     2917: イデアルの生成元のリスト
1.29      nakayama 2918: @item VL
1.59      noro     2919: 変数のリスト
1.29      nakayama 2920: @item DVL
1.59      noro     2921: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.29      nakayama 2922: @item W
1.59      noro     2923: 重みベクトルを表すリスト
1.29      nakayama 2924: @end table
                   2925:
                   2926: @itemize @bullet
                   2927: @item
1.59      noro     2928: @var{W} の要素は非負整数で, 0 番目の要素から連続して正の整数が入らなければならない.
                   2929: (すなわち, @code{[1,1,0,0,0]} は OK だが, @code{[1,0,1,0,0]} はダメ)
1.29      nakayama 2930: @item
1.59      noro     2931: 正の重みを持つ変数についての制限を行う.
                   2932: 例えば, @var{VL} @code{=[x,y,z]}, @var{W} @code{=[1,1,0]} であれば,
                   2933: x,y について制限を行う.
1.29      nakayama 2934: @end itemize
                   2935:
1.59      noro     2936: 以下は, イデアル
1.34      ohara    2937: @iftex
1.52      nakayama 2938: @tex $I = D \cdot \{x \partial_x -1, y \partial_y - 1\} $ @end tex
1.59      noro     2939: の
1.52      nakayama 2940: @tex $x$ @end tex
1.34      ohara    2941: @end iftex
                   2942: @ifinfo
1.59      noro     2943: I = D . @{ x dx -1, y dy - 1 @} の x
1.34      ohara    2944: @end ifinfo
1.59      noro     2945: についての制限イデアルを計算した例である。
1.29      nakayama 2946: @example
                   2947: [1346] nk_restriction.restriction_ideal([x*dx-1,y*dy-1],[x,y],[dx,dy],[1,0]);
                   2948: -- generic_bfct_and_gr :0.002sec(0.001652sec)
                   2949: generic bfct : [[1,1],[s-1,1]]
                   2950: S0 : 1
1.33      ohara    2951: B_@{S0@} length : 2
1.29      nakayama 2952: -- fctr(BF) + base :0sec(0.000566sec)
                   2953: -- restriction_ideal_internal :0.001sec(0.0007441sec)
                   2954: [-1]
                   2955: @end example
                   2956:
1.59      noro     2957: @node nk_restriction.integration,,, D 加群の制限に関する関数
1.29      nakayama 2958: @subsection @code{nk_restriction.integration}
1.59      noro     2959: @comment --- 索引用キーワード
1.29      nakayama 2960: @findex nk_restriction.integration
                   2961:
1.59      noro     2962: @comment --- 関数の簡単な説明 ---
1.29      nakayama 2963: @table @t
1.34      ohara    2964: @item nk_restriction.integration(@var{Id}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     2965: :: D 加群 M = D / @var{Id} (ホロノミック D イデアル @var{Id}) に対して, 重みベクトル @var{W} についての積分加群を返す.
1.29      nakayama 2966: @end table
                   2967:
1.59      noro     2968: @comment --- 引数の簡単な説明 ---
1.29      nakayama 2969: @table @var
                   2970: @item Id
1.59      noro     2971: イデアルの生成元のリスト
1.29      nakayama 2972: @item VL
1.59      noro     2973: 変数のリスト
1.29      nakayama 2974: @item DVL
1.59      noro     2975: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.29      nakayama 2976: @item W
1.59      noro     2977: 重みベクトルを表すリスト
1.29      nakayama 2978: @end table
                   2979:
1.59      noro     2980: @comment --- ここで関数の詳しい説明 ---
                   2981: @comment --- @itemize〜@end itemize は箇条書き ---
                   2982: @comment --- @bullet は黒点付き ---
1.29      nakayama 2983: @itemize @bullet
                   2984: @item
1.59      noro     2985: @var{W} の要素は非負整数で, 0 番目の要素から連続して正の整数が入らなければならない.
                   2986: (すなわち, @code{[1,1,0,0,0]} は OK だが, @code{[1,0,1,0,0]} はダメ)
1.29      nakayama 2987: @item
1.59      noro     2988: 正の重みを持つ変数についての積分を行う.
                   2989: 例えば, @var{VL} @code{=[x,y,z]}, @var{W} @code{=[1,1,0]} であれば,
                   2990: x,y について積分を行う.
1.29      nakayama 2991: @end itemize
                   2992:
1.59      noro     2993: 以下は, イデアル
1.34      ohara    2994: @iftex
1.52      nakayama 2995: @tex $I = D \cdot \{2 t \partial_x + \partial_t, t \partial_t + 2 x \partial_x + 2\}$ @end tex
1.59      noro     2996: とおいた時, D 加群
1.52      nakayama 2997: @tex $M = D / I$ @end tex
1.59      noro     2998: の
1.52      nakayama 2999: @tex $t$ @end tex
1.34      ohara    3000: @end iftex
                   3001: @ifinfo
1.52      nakayama 3002: I = D . @{2 t dx + dt, t dt + 2 x dx + 2 @}
1.59      noro     3003: とおいた時, D 加群 M = D / I の t
1.34      ohara    3004: @end ifinfo
1.59      noro     3005: についての積分加群を計算した例である. ([SST, Ex5.5.2, Ex5.5.6])
1.29      nakayama 3006: @example
                   3007: [1351] nk_restriction.integration([2*t*dx+dt,2*x*dx+t*dt+2],[t,x],
                   3008: [dt,dx],[1,0]);
                   3009: -- generic_bfct_and_gr :0.001sec(0.001796sec)
                   3010: generic bfct : [[1,1],[s,1],[s-1,1]]
                   3011: S0 : 1
1.33      ohara    3012: B_@{S0@} length : 2
1.29      nakayama 3013: -- fctr(BF) + base :0.001sec(0.0006731sec)
                   3014: [[4*x*dx^2+6*dx,-4*t*x*dx^2-6*t*dx,2*x*dx+1,-2*t*x*dx,2*t*dx],[[1],[0]]]
                   3015: @end example
1.59      noro     3016: 返り値の第 1 番目の要素 @code{[[1],[0]]]} は,
                   3017: 積分加群の基底
1.52      nakayama 3018: @iftex
1.51      nakayama 3019: @tex $t^1, t^0$ @end tex
1.52      nakayama 3020: @end iftex
                   3021: @ifinfo
                   3022: t^1, t^0
                   3023: @end ifinfo
1.59      noro     3024: を意味し,
                   3025: 返り値の第 0 番目の要素から, 積分加群は
1.52      nakayama 3026: @iftex
1.51      nakayama 3027: @tex $(4 x \partial_x^2 + 6 \partial_x, 0), (0, -4 x \partial_x^2 - 6 \partial_x),
                   3028: (0, -2 x \partial_x), (0, 2 \partial_x)$ @end tex
1.52      nakayama 3029: @end iftex
                   3030: @ifinfo
                   3031: (4 x dx^2 + 6 dx, 0), (0, -4 x dx^2 - 6 dx),
                   3032: (0, -2 x dx), (0, 2 dx)
                   3033: @end ifinfo
1.59      noro     3034: で生成されることがわかる.
1.29      nakayama 3035:
1.59      noro     3036: @node nk_restriction.integration_ideal,,, D 加群の制限に関する関数
1.29      nakayama 3037: @subsection @code{nk_restriction.integration_ideal}
1.59      noro     3038: @comment --- 索引用キーワード
1.29      nakayama 3039: @findex nk_restriction.integration_ideal
                   3040:
1.59      noro     3041: @comment --- 関数の簡単な説明 ---
1.29      nakayama 3042: @table @t
1.34      ohara    3043: @item nk_restriction.integration_ideal(@var{Id}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     3044: :: ホロノミック D イデアル @var{Id} を重みベクトル @var{W} についての積分イデアルを返す.
1.29      nakayama 3045: @end table
                   3046:
1.59      noro     3047: @comment --- 引数の簡単な説明 ---
1.29      nakayama 3048: @table @var
                   3049: @item Id
1.59      noro     3050: イデアルの生成元のリスト
1.29      nakayama 3051: @item VL
1.59      noro     3052: 変数のリスト
1.29      nakayama 3053: @item DVL
1.59      noro     3054: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.29      nakayama 3055: @item W
1.59      noro     3056: 重みベクトルを表すリスト
1.29      nakayama 3057: @end table
                   3058:
1.59      noro     3059: @comment --- ここで関数の詳しい説明 ---
                   3060: @comment --- @itemize〜@end itemize は箇条書き ---
                   3061: @comment --- @bullet は黒点付き ---
1.29      nakayama 3062: @itemize @bullet
                   3063: @item
1.59      noro     3064: @var{W} の要素は非負整数で, 0 番目の要素から連続して正の整数が入らなければならない.
                   3065: (すなわち, @code{[1,1,0,0,0]} は OK だが, @code{[1,0,1,0,0]} はダメ)
1.29      nakayama 3066: @item
1.59      noro     3067: 正の重みを持つ変数についての積分を行う.
                   3068: 例えば, @var{VL} @code{=[x,y,z]}, @var{W} @code{=[1,1,0]} であれば,
                   3069: x,y について積分を行う.
1.29      nakayama 3070: @end itemize
                   3071:
1.59      noro     3072: 以下は, イデアル
1.34      ohara    3073: @iftex
                   3074: @tex
1.29      nakayama 3075: $I = D \cdot \{2 t \partial_x + \partial_t, t \partial_t + 2 x \partial_x + 2\} $
1.34      ohara    3076: @end tex
1.59      noro     3077: の
1.52      nakayama 3078: @tex $t$ @end tex
1.34      ohara    3079: @end iftex
                   3080: @ifinfo
1.59      noro     3081: I = D . @{2 t dx + dt, t dt + 2 x dx + 2 @} の t
1.34      ohara    3082: @end ifinfo
1.59      noro     3083: についての積分イデアルを計算した例である. ([SST, Ex5.5.2, Ex5.5.6])
1.29      nakayama 3084: @example
                   3085: [1431]  nk_restriction.integration_ideal([2*t*dx+dt,t*dt+2*x*dx+2],[t,x],
                   3086: [dt,dx],[1,0]);
                   3087: -- generic_bfct_and_gr :0.002999sec(0.002623sec)
                   3088: generic bfct : [[1,1],[s,1],[s-1,1]]
                   3089: S0 : 1
1.33      ohara    3090: B_@{S0@} length : 2
1.29      nakayama 3091: -- fctr(BF) + base :0.001sec(0.001091sec)
                   3092: -- integration_ideal_internal :0.002sec(0.001879sec)
                   3093: [2*x*dx+1]
                   3094: @end example
                   3095:
1.59      noro     3096: @node nk_restriction.ann_mul,,, D 加群の制限に関する関数
1.42      nisiyama 3097: @subsection @code{nk_restriction.ann_mul}
1.59      noro     3098: @comment --- 索引用キーワード
1.42      nisiyama 3099: @findex nk_restriction.ann_mul
                   3100:
1.59      noro     3101: @comment --- 関数の簡単な説明 ---
1.42      nisiyama 3102: @table @t
                   3103: @item nk_restriction.ann_mul(@var{I}, @var{J}, @var{VL}, @var{DVL})
1.59      noro     3104: :: @var{f} を零化するホロノミック D イデアル @var{I},
                   3105: @var{g} を零化するホロノミック D イデアルを @var{J} としたとき,
                   3106: @var{fg} を零化するホロノミック D イデアルを返す.
1.42      nisiyama 3107: @end table
                   3108:
1.59      noro     3109: @comment --- 引数の簡単な説明 ---
1.42      nisiyama 3110: @table @var
                   3111: @item I
1.59      noro     3112: イデアルの生成元のリスト
1.42      nisiyama 3113: @item J
1.59      noro     3114: イデアルの生成元のリスト
1.42      nisiyama 3115: @item VL
1.59      noro     3116: 変数のリスト
1.42      nisiyama 3117: @item DVL
1.59      noro     3118: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.42      nisiyama 3119: @end table
                   3120:
1.59      noro     3121: @comment --- ここで関数の詳しい説明 ---
                   3122: @comment --- @itemize〜@end itemize は箇条書き ---
                   3123: @comment --- @bullet は黒点付き ---
1.42      nisiyama 3124: @itemize @bullet
1.59      noro     3125: @item test_ann_mul(), test_ann_mul2(), test_ann_mul3() を参照.
1.42      nisiyama 3126: @end itemize
                   3127:
                   3128:
1.59      noro     3129: @node nk_restriction (option) ,,, D 加群の制限, 積分に関する関数の説明 (option)
1.36      nisiyama 3130: @subsection @code{nk_restriction (option)}
1.59      noro     3131: @comment --- 索引用キーワード
1.36      nisiyama 3132: @findex nk_restriction (option)
                   3133:
1.59      noro     3134: @comment --- 関数の簡単な説明 ---
1.36      nisiyama 3135: @table @t
                   3136: @item nk_restriction.restriction(... | inhomo=@var{n}, param=@var{p}, s0=@var{m})
1.39      nisiyama 3137: @item nk_restriction.restriction_ideal(... | inhomo=@var{n}, param=@var{p}, s0=@var{m}, ht=@var{b}, ord=@var{ord})
1.36      nisiyama 3138: @item nk_restriction.integration(... | inhomo=@var{n}, param=@var{p}, s0=@var{m})
1.39      nisiyama 3139: @item nk_restriction.integration_ideal(... | inhomo=@var{n}, param=@var{p}, s0=@var{m}, ht=@var{b}, ord=@var{ord})
1.59      noro     3140: :: D 加群の制限, 積分に関する関数のオプションの説明
1.36      nisiyama 3141: @end table
                   3142:
1.59      noro     3143: @comment --- 引数の簡単な説明 ---
1.36      nisiyama 3144: @table @var
                   3145: @item @var{n}
1.59      noro     3146: 0 または 1
1.36      nisiyama 3147: @item @var{p}
1.59      noro     3148: リスト (係数体に属する変数のリスト)
1.36      nisiyama 3149: @item @var{m}
1.59      noro     3150: 整数
1.39      nisiyama 3151: @item @var{b}
1.59      noro     3152: 0, 1, 2, 3 のいずれか
1.39      nisiyama 3153: @item @var{ord}
1.59      noro     3154: 重み0の変数に対する項順序
1.36      nisiyama 3155: @end table
                   3156:
1.59      noro     3157: @comment --- ここで関数の詳しい説明 ---
                   3158: @comment --- @itemize〜@end itemize は箇条書き ---
                   3159: @comment --- @bullet は黒点付き ---
1.36      nisiyama 3160: @itemize @bullet
1.59      noro     3161: @item @var{n} が 0 でないとき, 非斉次部分の計算を行う.
1.36      nisiyama 3162:
1.59      noro     3163: restriction_ideal (integration_ideal) に関しては, イデアル @code{I} の
                   3164: @code{M} 変数についての制限(積分)イデアル @code{J} と
1.36      nisiyama 3165:
                   3166: @iftex
                   3167: @tex
                   3168: {\tt J[K]-(1/IH[K][1])(IH[K][0][0][0]IH[K][0][0][1]+...+IH[K][0][M][0]IH[K][0][M][1])} $\in$ {\tt I}
                   3169: @end tex
                   3170: @end iftex
                   3171: @ifinfo
                   3172: J[K]-(1/IH[K][1])(IH[K][0][0][0]IH[K][0][0][1]+...+IH[K][0][M][0]IH[K][0][M][1]) \in I
                   3173: @end ifinfo
                   3174:
1.59      noro     3175: を満たす非斉次部分を構成する情報 @code{IH} とのペア @code{[J,IH]} を出力する.
                   3176: 詳しい出力の見方については, 下の例やソースの @code{inhomo_part} の
                   3177: コメントを参照.
1.36      nisiyama 3178:
1.59      noro     3179: restriction, integration に対する @code{inhomo} オプションは
                   3180: restriction_ideal, integration_ideal のサブルーチンとしての実行用なので,
                   3181: ユーザが明示的に使用することはない.
1.36      nisiyama 3182:
1.59      noro     3183: @item @var{param} に指定された変数は係数体に属するものとみなされて計算が行われる.
                   3184: また, ``generic'' であることが仮定される.
                   3185: つまり, これらの変数に依存するような generic b-関数の根は,
                   3186: 最大整数根でないということである.
1.36      nisiyama 3187:
1.59      noro     3188: @item @var{param} が指定されると, generic b-関数の計算は noro による
                   3189: 高速アルゴリズムではなく, 消去法が用いられる.
                   3190: @var{param} に空リストを指定することで, b-関数の計算方法のフラグとしても
                   3191: 利用できる.
1.36      nisiyama 3192:
1.59      noro     3193: @item @var{m} が負でないとき, 計算を行わずに s-m を generic b-関数として
                   3194: 制限, 積分等の計算を行う.
1.39      nisiyama 3195:
1.59      noro     3196: @item @var{b} により, 加群のグレブナ基底計算に斉次化, trace アルゴリズム
                   3197: を用いるかどうか指定できる.
                   3198: ただし, 斉次化ありで計算できるのは Risa/Asir バージョン 20100415 以降である.
1.39      nisiyama 3199:
1.59      noro     3200: 0: 斉次化なし, trace なし
1.39      nisiyama 3201:
1.59      noro     3202: 1: 斉次化なし, trace あり
1.39      nisiyama 3203:
1.59      noro     3204: 2: 斉次化あり, trace なし (デフォルト)
1.39      nisiyama 3205:
1.59      noro     3206: 3: 斉次化あり, trace あり
1.39      nisiyama 3207:
1.59      noro     3208: @item @var{ord} が指定されると, 出力の積分, 制限イデアルは, その項順序に
                   3209: 関するグレブナ基底となる. 加群のグレブナ基底計算の POT 順序の tie breaker
                   3210: として使用されるので計算効率に大きな影響を与える可能性がある.
                   3211: デフォルトは 0, つまり全次数逆次書式順序である.
1.39      nisiyama 3212:
1.59      noro     3213: このオプションは @var{param} と同時利用できない. (後に対応予定.)
1.36      nisiyama 3214: @end itemize
                   3215:
1.59      noro     3216: 以下は,
1.36      nisiyama 3217: @iftex
                   3218: @tex
                   3219: $ t^{b-1} (1-t)^{c-b-1} (1-xt)^{-a} $
                   3220: @end tex
1.59      noro     3221: の annihilator
1.36      nisiyama 3222: @tex
                   3223: $I = D \cdot \{ x(1-x) \partial_x^2+((1-t) \partial_t-(a+b+1)x+c-1)
                   3224:  \partial_x-ab, (1-t)x \partial_x+t(1-t) \partial_t+(2-c)t+b-1,
                   3225:  (xt-1) \partial_x+at \}$
                   3226: @end tex
1.59      noro     3227: の
1.36      nisiyama 3228: @tex
                   3229: $t$
                   3230: @end tex
1.59      noro     3231: についての積分イデアル
1.36      nisiyama 3232: @tex
                   3233: $J$
                   3234: @end tex
1.59      noro     3235: を計算し, Gauss の超幾何微分方程式を導出した例である. ([SST, Chap 1.3])
1.36      nisiyama 3236: @end iftex
                   3237: @ifinfo
1.56      takayama 3238: t^@{b-1@} (1-t)^@{c-b-1@} (1-xt)^@{-a@}
1.59      noro     3239: の annihilator
1.36      nisiyama 3240: I = D . @{ x(1-x)dx^2+((1-t)dt-(a+b+1)x+c-1)dx-ab,
                   3241:  (1-t)x dx+t(1-t)dt+(2-c)t+b-1, (xt-1)dx+at @}
1.59      noro     3242: の t についての積分イデアル J
                   3243: を計算し, Gauss の超幾何微分方程式を導出した例である. ([SST, Chap 1.3])
1.36      nisiyama 3244: @end ifinfo
                   3245: @example
                   3246: [1555] A=ndbf.ann_n([t,1-t,1-x*t])$
                   3247: [1556] I=map(subst,A,s0,b-1,s1,c-b-1,s2,-a);
                   3248: [(x^2-x)*dx^2+((t-1)*dt+(a+b+1)*x-c+1)*dx+b*a,(-t+1)*x*dx+(t^2-t)*dt+(-c+2)*t+b-1,(t*x-1)*dx+a*t]
                   3249: [1557] J=nk_restriction.integration_ideal(I,[t,x],[dt,dx],[1,0]|inhomo=1, param=[a,b,c]);
                   3250: -- nd_weyl_gr :0sec(0.001875sec)
                   3251: -- weyl_minipoly_by_elim :0.008001sec(0.006133sec)
                   3252: -- generic_bfct_and_gr :0.008001sec(0.006181sec)
                   3253: generic bfct : [[-1,1],[s,1],[s-a+c-1,1]]
                   3254: S0 : 0
1.56      takayama 3255: B_@{S0@} length : 1
1.36      nisiyama 3256: -- fctr(BF) + base :0sec(0.003848sec)
                   3257: -- integration_ideal_internal :0sec(0.07707sec)
                   3258: [[(x^2-x)*dx^2+((a+b+1)*x-c)*dx+b*a],[[[[dt,(-t+1)*dx]],1]]]
                   3259: @end example
                   3260: @iftex
1.59      noro     3261: この出力は
1.36      nisiyama 3262: @tex
                   3263: $\{(x^2-x) \partial_x^2+((a+b+1)x-c) \partial_x+ab \}
                   3264: - 1/1 \{ \partial_t (-t+1) \partial_x \} \in I$
                   3265: @end tex
1.59      noro     3266: であることを意味する.
1.36      nisiyama 3267: @end iftex
                   3268: @ifinfo
1.59      noro     3269: この出力は
1.36      nisiyama 3270: @{(x^2-x)dx^2+((a+b+1)x-c)dx+ab @} - 1/1 @{ dt (-t+1)dx @} \in I
1.59      noro     3271: であることを意味する.
1.36      nisiyama 3272: @end ifinfo
                   3273:
1.60      takayama 3274: この例のように積分変数が1変数 t, パラメータ変数が x のとき
                   3275: イデアル I に対する inhomo=1 での積分アルゴリズムの出力が
                   3276: [[L],[[[[dt,M]],N]]] である場合,
                   3277: L は x のみの微分作用素, M は x, t の微分作用素, N は数で,
                   3278: L - (1/N)*dt*M が I の元となる. したがって f(x,t) が I で零化される
                   3279: 函数とすれば,
                   3280: @iftex
                   3281: @tex
1.61    ! takayama 3282: $L \cdot \int_a^b f(x,t) dt - {{1}\over{N}}[M\cdot f]_{t=a}^{t=b} = 0$
1.60      takayama 3283: @end tex
                   3284: @ifinfo
                   3285: L integral(f(x,t),[t,a,b]) - (1/N)[(Mf)(a)-(Mf)(b)]=0
                   3286: @end ifinfo
                   3287: が成り立つ.
                   3288:
                   3289:
1.59      noro     3290: @node nk_restriction.trans_inhomo,,, D 加群の積分イデアルの非斉次部分に関する関数
1.39      nisiyama 3291: @subsection @code{nk_restriction.trans_inhomo}
1.59      noro     3292: @comment --- 索引用キーワード
1.42      nisiyama 3293: @findex nk_restriction.trans_inhomo
1.39      nisiyama 3294:
1.59      noro     3295: @comment --- 関数の簡単な説明 ---
1.39      nisiyama 3296: @table @t
                   3297: @item nk_restriction.trans_inhomo(@var{P}, @var{INT}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     3298: :: D 加群の制限イデアル, 積分イデアルの生成元に対する非斉次部分の情報から, 任意の元に対する非斉次部分を計算する関数
1.39      nisiyama 3299: @end table
                   3300:
1.59      noro     3301: @comment --- 引数の簡単な説明 ---
1.39      nisiyama 3302: @table @var
                   3303: @item P
1.59      noro     3304: 積分イデアルの元, または制限イデアルの元
1.39      nisiyama 3305: @item INT
1.59      noro     3306: nk_restriction.integration_ideal( ... |inhomo=1); または
1.39      nisiyama 3307:
1.59      noro     3308: nk_restriction.restriction_ideal( ... |inhomo=1); の出力
1.39      nisiyama 3309: @item VL
1.59      noro     3310: 変数のリスト
1.39      nisiyama 3311: @item DVL
1.59      noro     3312: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.39      nisiyama 3313: @item W
1.59      noro     3314: 重みベクトルを表すリスト
1.39      nisiyama 3315: @end table
                   3316:
1.59      noro     3317: @comment --- ここで関数の詳しい説明 ---
                   3318: @comment --- @itemize〜@end itemize は箇条書き ---
                   3319: @comment --- @bullet は黒点付き ---
1.39      nisiyama 3320: @itemize @bullet
1.59      noro     3321: @item @var{VL}, @var{DVL}, @var{W} は @var{INT} の計算に用いたものをそのまま使用しなければならない.
                   3322: @item もし, @var{P} が @var{INT[0]} で生成される積分, 制限イデアルの元でない場合はエラーメッセージが表示される.
1.39      nisiyama 3323: @end itemize
                   3324:
1.59      noro     3325: @node nk_restriction.ost_integration_ideal,,, D 加群の積分イデアル
1.42      nisiyama 3326: @subsection @code{nk_restriction.ost_integration_ideal}
1.59      noro     3327: @comment --- 索引用キーワード
1.42      nisiyama 3328: @findex nk_restriction.ost_integration_ideal
                   3329:
1.59      noro     3330: @comment --- 関数の簡単な説明 ---
                   3331: 積分領域が区間の直積であるような積分の満たす
                   3332: ホロノミック斉次微分方程式系を返す (Oaku-Shiraki-Takayama, 2003).
1.42      nisiyama 3333: @table @t
                   3334: @item nk_restriction.ost_integration_ideal(@var{Id}, @var{VL}, @var{DVL}, @var{W}, @var{LB}, @var{UB})
1.59      noro     3335: :: Heaviside 関数との積の満たす微分方程式系の計算にショートカット法を用いる.
1.42      nisiyama 3336: @item nk_restriction.ost_integration_ideal2(@var{Id}, @var{VL}, @var{DVL}, @var{W}, @var{LB}, @var{UB})
1.59      noro     3337: :: Heaviside 関数との積の満たす微分方程式系の計算に制限イデアルを用いる.
1.42      nisiyama 3338: @end table
                   3339:
1.59      noro     3340: @comment --- 引数の簡単な説明 ---
1.42      nisiyama 3341: @table @var
                   3342: @item Id
1.59      noro     3343: イデアルの生成元のリスト
1.42      nisiyama 3344: @item VL
1.59      noro     3345: 変数のリスト
1.42      nisiyama 3346: @item DVL
1.59      noro     3347: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.42      nisiyama 3348: @item W
1.59      noro     3349: 重みベクトルを表すリスト
1.42      nisiyama 3350: @item LB
1.59      noro     3351: 積分区間の下端を表すリスト
1.42      nisiyama 3352: @item UB
1.59      noro     3353: 積分区間の上端を表すリスト
1.42      nisiyama 3354: @end table
                   3355:
1.59      noro     3356: @comment --- ここで関数の詳しい説明 ---
                   3357: @comment --- @itemize〜@end itemize は箇条書き ---
                   3358: @comment --- @bullet は黒点付き ---
1.42      nisiyama 3359: @itemize @bullet
1.59      noro     3360: @item 下端, 上端に無限大を指定するときは, 文字列  "inf", "+inf", "-inf" を用いる.
1.42      nisiyama 3361: @end itemize
                   3362:
1.59      noro     3363: 以下は, Oaku-Shiraki-Takayama (2003) の例5.1を計算したものである.
1.42      nisiyama 3364: @iftex
                   3365: @tex
                   3366: $ \int_0^\infty \exp((-t^3+t)x) dt $
                   3367: @end tex
1.59      noro     3368: の被積分関数の満たすホロノミックイデアルは
1.42      nisiyama 3369: @tex
                   3370: $ I = \langle \partial_t +(3t^2-1)x, \partial_x+t^3-t \rangle $
                   3371: @end tex
1.59      noro     3372: であるから, これを入力として次のように計算を行う.
1.42      nisiyama 3373: @end iftex
                   3374: @ifinfo
1.59      noro     3375: \int_0^∞ exp((-t^3+t)x) dt
                   3376: の非積分関数の満たすホロノミックイデアルは
1.42      nisiyama 3377: I = < dt +(3t^2-1)x, dx+t^3-t >
1.59      noro     3378: であるから, これを入力として次のように計算を行う.
1.42      nisiyama 3379: @end ifinfo
                   3380: @example
                   3381: [1871] Id=[dt+(3*t^2-1)*x, dx+t^3-t]$
                   3382: [1872] VL=[t,x]$
                   3383: [1873] DVL=[dt,dx]$
                   3384: [1874] W=[1,0]$
                   3385: [1875] nk_restriction.ost_integration_ideal(Id,VL,DVL,W,[0],["inf"]);
                   3386: -- nd_weyl_gr :0.008sec(0.006768sec)
                   3387: -- weyl_minipoly :0.004001sec(0.003029sec)
                   3388: -- generic_bfct_and_gr :0.012sec(0.0129sec)
                   3389: generic bfct : [[1,1],[s,1],[s-2,1]]
                   3390: S0 : 2
1.56      takayama 3391: B_@{S0@} length : 3
1.42      nisiyama 3392: -- fctr(BF) + base :0.008sec(0.007395sec)
                   3393: -- integration_ideal_internal :0.012sec + gc : 0.016sec(0.04311sec)
                   3394: [-27*x^3*dx^3-54*x^2*dx^2+(4*x^3+3*x)*dx+4*x^2-3,27*x^2*dx^4+135*x*dx^3+(-4*x^2+105)*dx^2-16*x*dx-8]
                   3395:
                   3396:
                   3397: [1876] nk_restriction.ost_integration_ideal2(Id,VL,DVL,W,[0],["inf"]);
1.59      noro     3398: (略)
1.42      nisiyama 3399: [27*x^3*dx^3+54*x^2*dx^2+(-4*x^3-3*x)*dx-4*x^2+3,-27*x^2*dx^4-135*x*dx^3+(4*x^2-105)*dx^2+16*x*dx+8]
                   3400: @end example
1.59      noro     3401: この出力は, 積分を零化するホロノミック系である.
1.42      nisiyama 3402:
1.59      noro     3403: @node nk_restriction.ost_sum,,, D 加群の積分イデアル
1.44      nisiyama 3404: @subsection @code{nk_restriction.ost_sum}
1.59      noro     3405: @comment --- 索引用キーワード
1.44      nisiyama 3406: @findex nk_restriction.ost_sum
                   3407:
1.59      noro     3408: @comment --- 関数の簡単な説明 ---
1.44      nisiyama 3409: @table @t
                   3410: @item nk_restriction.ost_sum(@var{Id}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     3411: :: 和の満たす(斉次/非斉次)差分方程式系を返す.
1.44      nisiyama 3412: @end table
                   3413:
1.59      noro     3414: @comment --- 引数の簡単な説明 ---
1.44      nisiyama 3415: @table @var
                   3416: @item Id
1.59      noro     3417: イデアルの生成元のリスト
1.44      nisiyama 3418: @item VL
1.59      noro     3419: 変数のリスト
1.44      nisiyama 3420: @item DVL
1.59      noro     3421: 変数のリスト(@var{VL} に対応する差分作用素の方の変数)
1.44      nisiyama 3422: @item W
1.59      noro     3423: 重みベクトルを表すリスト
1.44      nisiyama 3424: @end table
                   3425:
1.59      noro     3426: @comment --- ここで関数の詳しい説明 ---
                   3427: @comment --- @itemize〜@end itemize は箇条書き ---
                   3428: @comment --- @bullet は黒点付き ---
1.44      nisiyama 3429: @itemize @bullet
1.59      noro     3430: @item Oaku-Shiraki-Takayama (2003) の第6節のアルゴリズムの実装.
                   3431: @item オプション inhomo が 0 でないとき, 非斉次部分を与える情報も返す.
1.44      nisiyama 3432: @end itemize
                   3433:
1.59      noro     3434: 以下は, Oaku-Shiraki-Takayama (2003) の例6.5の非斉次部分まで計算したものである.
1.44      nisiyama 3435: @iftex
                   3436: @tex
                   3437: $ \sum_{k=a}^b {n \choose k} $
                   3438: @end tex
1.59      noro     3439: の非和関数の満たすホロノミックイデアルは
1.44      nisiyama 3440: @tex
                   3441: $ I = \langle (n-k+1)E_n-(n+1), (k+1)E_k-(n-k) \rangle $
                   3442: @end tex
1.59      noro     3443: であるから, これを入力として次のように計算を行う.
1.44      nisiyama 3444: @end iftex
                   3445: @ifinfo
1.56      takayama 3446: \sum_@{k=a@}^b n_C_k
1.59      noro     3447: の非和関数の満たすホロノミックイデアルは
1.44      nisiyama 3448: I = < (n-k+1)E_n-(n+1), (k+1)E_k-(n-k) >
1.59      noro     3449: であるから, これを入力として次のように計算を行う.
1.44      nisiyama 3450: @end ifinfo
                   3451: @example
                   3452: [1871] Id=[(n-k+1)*en-(n+1), (k+1)*ek-(n-k)]$
                   3453: [1872] VL=[k,n]$
                   3454: [1873] DVL=[ek,en]$
                   3455: [1874] W=[1,0]$
                   3456: [1875] nk_restriction.ost_sum(Id,VL,DVL,W|inhomo=1);
                   3457: -- nd_weyl_gr :0.006667sec(0.004057sec)
                   3458: -- weyl_minipoly :0sec(0.001163sec)
                   3459: -- generic_bfct_and_gr :0.01sec(0.007085sec)
                   3460: generic bfct : [[1,1],[s,1]]
                   3461: S0 : 0
1.56      takayama 3462: B_@{S0@} length : 1
1.44      nisiyama 3463: -- fctr(BF) + base :0.003333sec(0.001785sec)
                   3464: -- restriction_ideal_internal :0sec(0.002336sec)
                   3465: [[(en-2)*n+en-2],[[[[ek-1,[(-en+1)*n-en+1,1]]],1]]]
                   3466: @end example
                   3467:
1.59      noro     3468: @node nk_restriction.module_restriction,,, D 加群の制限に関する関数
1.51      nakayama 3469: @subsection @code{nk_restriction.module_restriction}
1.59      noro     3470: @comment --- 索引用キーワード
1.51      nakayama 3471: @findex nk_restriction.module_restriction
                   3472:
1.59      noro     3473: @comment --- 関数の簡単な説明 ---
1.51      nakayama 3474: @table @t
                   3475: @item nk_restriction.module_restriction(@var{M}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     3476: :: D 加群 D^r/@var{M} (@var{M} は D^r の部分加群) の重みベクトル @var{W} についての制限加群を返す.
1.51      nakayama 3477: @end table
                   3478:
1.59      noro     3479: @comment --- 引数の簡単な説明 ---
1.51      nakayama 3480: @table @var
1.52      nakayama 3481: @item M
1.59      noro     3482: D 自由加群 D^r の部分加群
1.51      nakayama 3483: @item VL
1.59      noro     3484: 変数のリスト
1.51      nakayama 3485: @item DVL
1.59      noro     3486: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.51      nakayama 3487: @item W
1.59      noro     3488: 重みベクトルを表すリスト
1.51      nakayama 3489: @end table
                   3490:
                   3491: @itemize @bullet
                   3492: @item
1.59      noro     3493: @var{W} の要素は非負整数で, 0 番目の要素から連続して正の整数が入らなければならない.
                   3494: @comment{(すなわち、@code{[1,1,0,0,0]} は OK だが、 @code{[1,0,1,0,0]} はダメ)}
                   3495: 現在のところ, 1 変数についてだけ制限をとるようにしか実装していないため,
                   3496: @var{W} は 0 番目の要素だけ正の整数が入る.
1.51      nakayama 3497: @item
1.59      noro     3498: 正の重みを持つ変数についての制限を行う.
                   3499: 例えば, @var{VL} @code{=[x,y,z]}, @var{W} @code{=[1,0,0]} であれば
                   3500: x について制限を行う.
1.51      nakayama 3501: @end itemize
                   3502:
1.59      noro     3503: 以下は, D 自由加群
1.51      nakayama 3504: @iftex
1.52      nakayama 3505: @tex $D^2$ @end tex
1.59      noro     3506: の部分加群
1.51      nakayama 3507: @tex
                   3508: $M = D \cdot \{(\partial_x, \partial_y), (\partial_y, \partial_x), (x,y) \}$
                   3509: @end tex
1.59      noro     3510: をとり, D 加群
1.52      nakayama 3511: @tex $D^2 / M$ @end tex
1.59      noro     3512: の
1.52      nakayama 3513: @tex $x$ @end tex
                   3514: @end iftex
1.51      nakayama 3515: @ifinfo
1.59      noro     3516: D^2 の部分加群 M = D . @{ (dx, dy), (dy, dx), (x, y) @}
                   3517: をとり, D 加群 D^2 / M の x
1.51      nakayama 3518: @end ifinfo
1.59      noro     3519: ついての制限加群を計算した例である.
1.51      nakayama 3520: @example
                   3521: [2691] nk_restriction.module_restriction([[dx,dy],[dy,dx],[x,y]], [x,y], [dx,dy], [1,0]);
                   3522: ....
                   3523: bfunction :
                   3524: s
                   3525: [[1,1],[s,1]]
                   3526: integer roots :
                   3527: [0,0]
                   3528: Generators:
                   3529: [e1,e2]
                   3530: Relations:
                   3531: [-8*e2*dy,4*e2*dy^2,-4*e2*dy^3,4*e1*y*dy-4*e1,-4*e1*dy^2,-4*e2,-e2*y*dy^2+2*e2*dy,-e1*y*dy+e1,e1*y*dy-e1]
                   3532: [[0,-1],[-dy^2,0],[y*dy-1,0]]
                   3533: @end example
1.59      noro     3534: 制限加群は
1.52      nakayama 3535: @iftex
1.51      nakayama 3536: @tex $(0, -1), (-\partial_y^2, 0), (y \partial_y -1 , 0)$ @end tex
1.52      nakayama 3537: @end iftex
                   3538: @ifinfo
                   3539: (0, -1), (-dy^2, 0), (y, dy-1, 0)
                   3540: @end ifinfo
1.59      noro     3541: で生成されることがわかる.
1.51      nakayama 3542:
1.59      noro     3543: @node nk_restriction.module_integration,,, D 加群の制限に関する関数
1.51      nakayama 3544: @subsection @code{nk_restriction.module_integration}
1.59      noro     3545: @comment --- 索引用キーワード
1.51      nakayama 3546: @findex nk_restriction.module_integration
                   3547:
1.59      noro     3548: @comment --- 関数の簡単な説明 ---
1.51      nakayama 3549: @table @t
                   3550: @item nk_restriction.module_integration(@var{M}, @var{VL}, @var{DVL}, @var{W})
1.59      noro     3551: :: D 加群 D^r/M (@var{M} は D^r の部分加群) の重みベクトル @var{W} についての積分加群を返す.
1.51      nakayama 3552: @end table
                   3553:
1.59      noro     3554: @comment --- 引数の簡単な説明 ---
1.51      nakayama 3555: @table @var
1.52      nakayama 3556: @item M
1.59      noro     3557: D 自由加群 D^r の部分加群
1.51      nakayama 3558: @item VL
1.59      noro     3559: 変数のリスト
1.51      nakayama 3560: @item DVL
1.59      noro     3561: 変数のリスト(@var{VL} に対応する微分作用素の方の変数)
1.51      nakayama 3562: @item W
1.59      noro     3563: 重みベクトルを表すリスト
1.51      nakayama 3564: @end table
                   3565:
                   3566: @itemize @bullet
                   3567: @item
1.59      noro     3568: @var{W} の要素は非負整数で, 0 番目の要素から連続して正の整数が入らなければならない.
                   3569: @comment{(すなわち、@code{[1,1,0,0,0]} は OK だが、 @code{[1,0,1,0,0]} はダメ)}
                   3570: 現在のところ, 1 変数についてだけ積分をとるようにしか実装していないため,
                   3571: @var{W} は 0 番目の要素だけ正の整数が入る.
1.51      nakayama 3572: @item
1.59      noro     3573: 正の重みを持つ変数についての積分を行う.
                   3574: 例えば, @var{VL} @code{=[x,y,z]}, @var{W} @code{=[1,0,0]} であれば
                   3575: x について積分を行う.
1.51      nakayama 3576: @end itemize
                   3577:
1.59      noro     3578: 以下は, D 自由加群
1.51      nakayama 3579: @iftex
1.52      nakayama 3580: @tex $D^2$ @end tex
1.59      noro     3581: の部分加群
1.52      nakayama 3582: @tex $M = D \cdot \{(x, y), (y, x), (\partial_x, \partial_y) \}$ @end tex
1.59      noro     3583: をとり, D 加群
1.52      nakayama 3584: @tex $D^2/M$ @end tex
1.59      noro     3585: の
1.52      nakayama 3586: @tex $x$ @end tex
                   3587: @end iftex
1.51      nakayama 3588: @ifinfo
1.59      noro     3589: D^2 の部分加群 M = D . @{ (x, y), (y, x), (dx, dy) @} をとり,
                   3590: D 加群 D^2 / M の x
1.51      nakayama 3591: @end ifinfo
1.59      noro     3592: についての積分加群を計算した例である.
1.51      nakayama 3593: @example
                   3594: [2702] nk_restriction.module_integration([[x,y],[y,x],[dx,dy]], [x,y], [dx,dy], [1,0]);
                   3595: ...
                   3596: bfunction :
                   3597: s
                   3598: [[1,1],[s,1]]
                   3599: integer roots :
                   3600: [0,0]
                   3601: Generators:
                   3602: [e1,e2]
                   3603: Relations:
                   3604: [-8*e2*y,-4*e2*y^2,-4*e2*y^3,-4*e1*y*dy-8*e1,-4*e1*y^2,-4*e2,-e2*y^2*dy-4*e2*y,e1*y*dy+2*e1,e1*y*dy+2*e1]
                   3605: [[0,-1],[y*dy+2,0],[-y^2,0]]
                   3606: @end example
1.59      noro     3607: 積分加群は
1.52      nakayama 3608: @iftex
1.51      nakayama 3609: @tex $(0, -1), (y \partial_y + 2, 0), (-y^2, 0)$ @end tex
1.52      nakayama 3610: @end iftex
                   3611: @ifinfo
                   3612: (0, -1), (y dy + 2, 0), (-y^2, 0)
                   3613: @end ifinfo
1.59      noro     3614: で生成されることがわかる.
1.44      nisiyama 3615:
1.30      takayama 3616: @noindent
                   3617: ChangeLog
                   3618: @itemize @bullet
1.59      noro     3619: @item  これらの関数は OpenXM/src/asir-contrib/packages/src/nk_restriction.rr で定義されている. nk_restriction.rr, 1.1--1.6 を見よ.
                   3620: @item 2010-02-05 に 3 つの option (@code{inhomo}, @code{param}, @code{s0}) が追加された. 1.7--1.9 を見よ.
                   3621: @item 2010-05 から 2010-07 にかけて 2 つの option (@code{ht}, @code{ord}) と
                   3622: 新たな関数 trans_inhomo() が追加された. 1.10--1.13 を見よ.
                   3623: @item 2011-08 に ost_sum() が追加された. 1.20 を見よ.
                   3624: @item 2016-05 に module_integration(), module_restriction() が追加された.
1.30      takayama 3625: @end itemize
                   3626:
1.59      noro     3627: @node その他(未分類),,, 実験的仕様の関数
                   3628: @section その他(未分類)
1.37      takayama 3629:
1.59      noro     3630: @node tk_pfn.rkn,,, 実験的仕様の関数
1.37      takayama 3631: @subsection @code{tk_pfn.rkn}
                   3632: @findex tk_pfn.rkn
                   3633:
1.59      noro     3634: @comment --- 関数の簡単な説明 ---
                   3635: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.37      takayama 3636: @table @t
                   3637: @item tk_pfn.rkn(@var{F},@var{X},@var{Y},@var{Xs},@var{Ys},@var{Ht},@var{H})
1.59      noro     3638: :: Pfaffian 方程式に対する Runge-Kutta 法
1.37      takayama 3639: @end table
                   3640:
                   3641: @table @var
                   3642: @item return
1.59      noro     3643: リスト  独立変数と解の組
1.37      takayama 3644: @item F, X, Y, Xs, Ys, Ht, H
1.59      noro     3645: @var{F} は Pfaffian 方程式の係数行列リスト.
                   3646: @var{X} は独立変数リスト.
                   3647: @var{Y} は従属変数リスト.
                   3648: @var{Xs} 独立変数の出発値リスト.
                   3649: @var{Ys} は出発時の従属変数の値リスト.
                   3650: @var{Xt} は停止する独立変数の値リスト.
                   3651: @var{H} は微少数.
1.37      takayama 3652: @end table
                   3653:
                   3654: @itemize @bullet
1.59      noro     3655: @item この関数は連立Pfaffian方程式 dY/d X[i] = F[i] Y を数値的に解く.
                   3656: @item 任意の holonomic system は Pfaffian 方程式に変換できる ([SST, Chap 1]). 変換には yang.rr パッケージを用いる.
                   3657: @item d F[i]/d X[j] + F[i] F[j] = d F[j]/d X[i] + F[j] F[i] = 0 が任意の i, j に対して成立していることが解が存在する必要十分条件である. この条件が成立しないときにこの関数を用いて解を計算してもその解は偽物である.
                   3658: @item X[i] が動く範囲は実数でないといけない.
                   3659: @item Xs[i] <= X[i] <= Xt[i] または Xt[i] <= X[i] <= Xs[i] である.
                   3660: @item 引数の与え方の例はソースコード (@code{OpenXM/lib/asir-contrib/tk_pfn.rr} )の @code{tk_pfn.test1}, @code{tk_pfn.test2} を参照.
                   3661: @item 下の例の出力は X=(1,3) での値が Y=(-8,2,-6) であることを意味する.
                   3662: @item 参考. taka_runge_kutta.rr, yang.rr
1.37      takayama 3663: @end itemize
                   3664:
                   3665: @example
                   3666: [1355] import("tk_pfn.rr");
                   3667: [1590]  tk_pfn.test1();
                   3668: Value at (3,0.1)[8.99,6,-0.2]
                   3669: Value at (1,3)[-8,2,-6]
                   3670: [[[1,3],-8,2,-6],
                   3671:  [[1,2.9],-7.41,2,-5.8],
                   3672:  --- snip ---
                   3673:  [[3,0.1],8.99,6,-0.2]]
                   3674: @end example
                   3675:
                   3676:
1.59      noro     3677: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   3678: @comment --- openxm の外部からの寄与も述べる. Credit.
1.37      takayama 3679: @noindent
                   3680: ChangeLog
                   3681: @itemize @bullet
1.59      noro     3682: @item この関数は 2009-12 から 2010-01 にかけて最初の版が書かれた.
1.37      takayama 3683: @item @code{OpenXM/src/asir-contrib/packages/src/tk_pfn.rr} 1.1, 1.2
1.59      noro     3684: @item このモジュールの前身は @code{tk_pf2.rr} である. これは独立変数が 2 個の場合である.
1.37      takayama 3685: @end itemize
1.29      nakayama 3686:
1.40      takayama 3687:
1.59      noro     3688: @node tk_pfn.graph,,, 実験的仕様の関数
1.40      takayama 3689: @subsection @code{tk_pfn.graph}
                   3690: @findex tk_pfn.graph
                   3691:
1.59      noro     3692: @comment --- 関数の簡単な説明 ---
                   3693: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.40      takayama 3694: @table @t
                   3695: @item tk_pfn.graph(@var{Pf},@var{Dom},@var{Iv},@var{Step})
1.59      noro     3696: :: 2変数 Pfaffian 方程式を Runge-Kutta 法で解いてグラフ表示する.
1.40      takayama 3697: @end table
                   3698:
                   3699: @table @var
                   3700: @item return
1.59      noro     3701: リスト  リストの要素は以下の形式 [[xの値,yの値],Y_1の値,Y_2の値, ...].
                   3702: [xの値, yの値] は [0,0],[0.2,0],[0.4,0], ... , [0,0.2],[0.2,0.2], ... のように
                   3703: y の値が外側ループ, x の値が内側ループの形式で増える.
1.40      takayama 3704: @item Pf, Dom, Iv, Step
1.59      noro     3705: @var{Pf} は Pfaffian 方程式の係数行列リスト.  独立変数は x, y で固定.
                   3706: @var{Dom} リスト. 解くべき領域.
                   3707: @var{Iv} リスト. 領域の左端での初期値.
                   3708: @var{Step} 刻み幅.
1.40      takayama 3709: @end table
                   3710:
                   3711: @itemize @bullet
1.59      noro     3712: @item tk_pf2.rr, mt_graph.rr を import しておく必要がある.
                   3713: @item この関数は連立Pfaffian方程式 dY/dx = Pf[0] Y, dY/dy = Pf[1] Y を数値的に解いてグラフ表示する.
                   3714: @item @var{Dom} は [[xmin,xmax],[ymin,ymax]] の形式.
                   3715: @item 例はソースコード (@code{OpenXM/lib/asir-contrib/tk_pfn.rr} )の @code{tk_pfn.testgraph1()}, @code{tk_pfn.testgraph2()} を参照.
                   3716: @item option としては fit=1 がある. Z軸を適宜調整する.
                   3717: @item @var{Dom} の端はグラフ表示の時に一部カットされるので注意.
1.40      takayama 3718: @end itemize
                   3719:
                   3720: @example
                   3721: [1355] import("tk_pf2.rr"); import("mt_graph.rr"); import("tk_pfn.rr");
1.41      takayama 3722: [1590] tk_pfn.testgraph1();
1.40      takayama 3723:
1.59      noro     3724: ここで testgraph1() は以下のとおり.
1.56      takayama 3725: def testgraph1() @{
1.40      takayama 3726:   /* tk_bess2.bess2pf(1/2); */
                   3727:   Pf=  [[[ 0, (1)/(x), 0 ],
                   3728:          [ -x, (2*x^2+1)/(x), -2*x ],
                   3729:          [ -y, 0, 0 ]],
                   3730:         [[ 0, 0, (1)/(y) ],
                   3731:          [ -x, 0, 0 ],
                   3732:          [ -x, (1/2)/(x), (-1/2)/(y) ]]];
                   3733:   /* tk_bess2.bess2Iv(1/2,[0.5,1.5]); */
                   3734:   Iv = [0.105994,-0.651603,-0.760628];
                   3735:   Dom=[[0.5,1.5],[1.5,9]];
                   3736:   Step = 0.5;
1.41      takayama 3737:   return tk_pfn.graph(Pf,Dom,Iv,Step | fit=1);
1.56      takayama 3738: @}
1.40      takayama 3739:
                   3740:
                   3741: @end example
                   3742:
                   3743:
1.59      noro     3744: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   3745: @comment --- openxm の外部からの寄与も述べる. Credit.
1.40      takayama 3746: @noindent
                   3747: ChangeLog
                   3748: @itemize @bullet
1.59      noro     3749: @item この関数は 2010-08 に最初の版が書かれた.
1.40      takayama 3750: @item @code{OpenXM/src/asir-contrib/packages/src/tk_pfn.rr} 1.8
                   3751: @end itemize
                   3752:
1.59      noro     3753: @node tk_rk.runge_kutta_4,,, 実験的仕様の関数
1.41      takayama 3754: @subsection @code{tk_rk.runge_kutta_4}
                   3755: @findex tk_rk.runge_kutta_4
                   3756:
1.59      noro     3757: @comment --- 関数の簡単な説明 ---
                   3758: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.41      takayama 3759: @table @t
                   3760: @item tk_rk.runge_kutta_4(@var{Eq},@var{X},@var{Y},@var{X0},@var{Y0},@var{Terminal},@var{Step})
1.59      noro     3761: :: 4次の Runge-Kutta 法による微分方程式の数値近似解
1.41      takayama 3762: @end table
                   3763:
                   3764: @table @var
                   3765: @item return
1.59      noro     3766: リスト  リストの要素は以下の形式 [@var{X}の値,Y_1の値,Y_2の値, ...].
                   3767:  @var{X} の値は減っていく. よってリストの先頭が @var{Terminal} 付近での @var{Y} の値.
1.41      takayama 3768: @item Eq, X, Y, Step
1.59      noro     3769: @var{Eq} は 方程式の右辺. リスト. Y[0]'=Eq[0], Y[1]'=Eq[1], ... である.
                   3770: @var{X} 独立変数名.
                   3771: @var{Y} リスト. 従属変数のリスト.
                   3772: @var{Step} 刻み幅.
1.41      takayama 3773: @item X0, Y0, Terminal
1.59      noro     3774: @var{X0} 出発点の @var{X} の値.
                   3775: @var{Y0} 出発点での @var{Y} の初期値.
                   3776: @var{Terminal} @var{X} の終着点.
1.41      takayama 3777: @end table
                   3778:
                   3779: @itemize @bullet
1.59      noro     3780: @item taka_runge_kutta.rr を import しておく必要がある.
                   3781: @item この関数は連立常微分方程式 Y[0]'=Eq[0], Y[1]'=Eq[1], ... を数値的に解く.
                   3782: @item 例はソースコード (@code{OpenXM/lib/asir-contrib/src/taka_runge_kutta.rr} )の
                   3783: @code{tk_rk.test4()} を参照.
1.41      takayama 3784: @end itemize
                   3785:
                   3786: @example
                   3787: [1355] import("taka_runge_kutta.rr");
                   3788: [1590] tk_rk.test4();
                   3789:
1.59      noro     3790: ここで test4() は以下のとおり. 振動の方程式, y0'=y1, y1'=-y0 (y0''+y0=0). 答は y0=cos(x)
                   3791: taka_plot_auto は下方向で y が正.
1.41      takayama 3792:
1.56      takayama 3793: def test4() @{
1.41      takayama 3794:   A=runge_kutta_4([y1,-y0],x,[y0,y1],0,[1,0],3.14*2,0.1);
                   3795:   taka_plot_auto(A);
                   3796:   return(A);
1.56      takayama 3797: @}
1.41      takayama 3798:
                   3799: @end example
                   3800:
                   3801:
1.59      noro     3802: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   3803: @comment --- openxm の外部からの寄与も述べる. Credit.
1.41      takayama 3804: @noindent
                   3805: ChangeLog
                   3806: @itemize @bullet
1.59      noro     3807: @item この関数は 2000 年代の前半に最初の版が書かれた. 2010年 Pfaffian の数値解析の為に再度整備
1.41      takayama 3808: @item @code{OpenXM/src/asir-contrib/packages/src/taka_runge_kutta.rr} 1.17
                   3809: @end itemize
                   3810:
1.59      noro     3811: @node tk_rk.runge_kutta_4_linear,,, 実験的仕様の関数
1.41      takayama 3812: @subsection @code{tk_rk.runge_kutta_4_linear}
                   3813: @findex tk_rk.runge_kutta_4_linear
                   3814:
1.59      noro     3815: @comment --- 関数の簡単な説明 ---
                   3816: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.41      takayama 3817: @table @t
                   3818: @item tk_rk.runge_kutta_4_linear(@var{P},@var{X},@var{Y},@var{X0},@var{Y0},@var{Terminal},@var{Step})
1.59      noro     3819: :: 4次の Runge-Kutta 法による微分方程式の数値近似解. 線形方程式専用.
1.41      takayama 3820: @end table
                   3821:
                   3822: @table @var
                   3823: @item return
1.59      noro     3824: リスト  リストの要素は以下の形式 [@var{X}の値,Y_1の値,Y_2の値, ...].
                   3825:  @var{X} の値は減っていく. よってリストの先頭が @var{Terminal} 付近での @var{Y} の値.
1.41      takayama 3826: @item P, X, Y, Step
1.59      noro     3827: @var{P} は 方程式の右辺. リスト. Y'=P Y である. 従属変数 @var{Y} は不要.
                   3828: @var{X} 独立変数名.
                   3829: @var{Y} リスト. 従属変数のリスト. 従属変数は自動生成される. 使われていないので空リストでよい.
                   3830: @var{Step} 刻み幅.
1.41      takayama 3831: @item X0, Y0, Terminal
1.59      noro     3832: @var{X0} 出発点の @var{X} の値.
                   3833: @var{Y0} 出発点での @var{Y} の初期値.
                   3834: @var{Terminal} @var{X} の終着点.
1.41      takayama 3835: @end table
                   3836:
                   3837: @itemize @bullet
1.59      noro     3838: @item taka_runge_kutta.rr を import しておく必要がある.
1.41      takayama 3839: @end itemize
                   3840:
                   3841: @example
                   3842: [1355] import("taka_runge_kutta.rr");
                   3843: [1590] A=tk_rk.runge_kutta_4_linear([[0,1],[-1,0]],x,[ ], 0, [1,0], 3.14*2, 0.1);
                   3844: [1591] taka_plot_auto(A);
                   3845:
1.59      noro     3846: 振動の方程式, y0'=y1, y1'=-y0 (y0''+y0=0). 答は y0=cos(x) を解いている.
                   3847: taka_plot_auto は下方向で y が正.
1.41      takayama 3848:
                   3849: @end example
                   3850:
                   3851:
1.59      noro     3852: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   3853: @comment --- openxm の外部からの寄与も述べる. Credit.
1.41      takayama 3854: @noindent
                   3855: ChangeLog
                   3856: @itemize @bullet
1.59      noro     3857: @item 2010年 Pfaffian の数値解析の為に再整備.
1.41      takayama 3858: @item @code{OpenXM/src/asir-contrib/packages/src/taka_runge_kutta.rr} 1.17
                   3859: @end itemize
                   3860:
1.40      takayama 3861:
                   3862:
1.59      noro     3863: @node fj_simplify.simplify,,, 実験的仕様の関数
1.57      takayama 3864: @subsection @code{fj_simplify.simplify}
                   3865: @findex fj_simplify.simplify
1.38      takayama 3866:
1.59      noro     3867: @comment --- 関数の簡単な説明 ---
                   3868: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.38      takayama 3869: @table @t
1.57      takayama 3870: @item fj_simplify.simplify(@var{arg1})
1.59      noro     3871: :: arg1 を簡単化する.
1.38      takayama 3872: @end table
                   3873:
                   3874: @table @var
                   3875: @item return
1.59      noro     3876: 多項式, 有理式 または quote
1.38      takayama 3877: @item arg1
1.59      noro     3878: 多項式 または 有理式
1.38      takayama 3879: @end table
                   3880:
                   3881: @itemize @bullet
                   3882: @item
1.59      noro     3883: この関数は
1.38      takayama 3884: Joel S. Cohen, Computer Algebra and Symbolic Computation,
                   3885: http://web.cs.du.edu/~jscohen/MathematicalMethods/index.htm
1.59      noro     3886: に記述されている Automatic simplification algorithm と
1.38      takayama 3887: B.F.Caviness, R.J.Fateman, Simplification of Radical Expressions (1976)
1.59      noro     3888: に記述されている radcan アルゴリズムの実装である.
1.38      takayama 3889: @item
1.59      noro     3890: 複素多値関数としては (x*y)^a = x^a*x^b は一般には成立しないので, 結果を複素関数に使うときは
                   3891: 注意が必要である. (x^a = exp(a*log(x)) なので)
1.38      takayama 3892: @end itemize
                   3893:
                   3894: @example
1.57      takayama 3895: import("fj_simplify.rr");
                   3896: [1434] fj_simplify.simplify((x^(1/2))^3);
1.38      takayama 3897: ((x)^(3/2))
1.57      takayama 3898: [1435] fj_simplify.simplify((2^(1/2))^2);
1.38      takayama 3899: 2
1.57      takayama 3900: [1436] fj_simplify.simplify((2+2^(1/2))^3);
1.38      takayama 3901: 14*((2)^(1/2))+20
1.57      takayama 3902: [1437] fj_simplify.simplify(exp(x)*exp(-x+y));
1.38      takayama 3903: ((@@e)^(y))
                   3904: @end example
                   3905:
                   3906: @table @t
1.59      noro     3907: @item 参照
1.38      takayama 3908: @ref{quote}
                   3909: @end table
                   3910:
                   3911: @noindent
                   3912: ChangeLog
                   3913: @itemize @bullet
                   3914: @item
1.59      noro     3915: Todo: exp 以外の特殊関数についてのsimplification の機能.
1.38      takayama 3916: @item
1.59      noro     3917: この関数は 2010.01 に M.Fujimoto により最初の版が書かれた.
1.38      takayama 3918: OpenXM/src/asir-contrib/packages/src/fj_simplify.rr
                   3919: @end itemize
                   3920:
1.59      noro     3921: @node tk_jack.zonal,,, 実験的仕様の関数
1.46      takayama 3922: @subsection @code{tk_jack.zonal}
                   3923: @findex tk_jack.zonal
                   3924:
1.59      noro     3925: @comment --- 関数の簡単な説明 ---
                   3926: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.46      takayama 3927: @table @t
                   3928: @item tk_jack.zonel(@var{p},@var{n})
1.59      noro     3929: :: 分割 p に対する n 変数の zonal 多項式を出力する.
1.46      takayama 3930: @end table
                   3931:
                   3932: @table @var
                   3933: @item return
1.59      noro     3934: 多項式. x_1, x_2, ... が変数.
1.46      takayama 3935: @item p
1.59      noro     3936: 数のリスト. p=[p0,p1,...] の時 p0>=p1>=...>0.
1.46      takayama 3937: @item n
1.59      noro     3938: 自然数
1.46      takayama 3939: @end table
                   3940:
                   3941: @itemize @bullet
                   3942: @item
1.59      noro     3943: この関数は
                   3944: Koev-Edelman による Pieri 型公式を用いた Jack symmetric function の計算
                   3945: アルゴリズムの実装である.
                   3946: 詳しくは Wikipedia 英語版 Jack symmetric function の項を参照.
                   3947: @item zonal(P,N) = jack(P,N,2) である.
1.46      takayama 3948: @end itemize
                   3949:
                   3950: @example
                   3951: load("tk_jack.rr");
                   3952: [1434] tk_jack.zonal([3,2,1],3);
                   3953: (112*x_3*x_2^2+112*x_3^2*x_2)*x_1^3+(112*x_3*x_2^3+168*x_3^2*x_2^2+112*x_3^3*x_2)*x_1^2+(112*x_3^2*x_2^3+112*x_3^3*x_2^2)*x_1
                   3954: [1435] tk_jack.zonal([1,1],3);
                   3955: (2*x_2+2*x_3)*x_1+2*x_3*x_2
                   3956: [1436]  tk_jack.jack([1,1],3,2);
                   3957: (2*x_2+2*x_3)*x_1+2*x_3*x_2
                   3958: @end example
                   3959:
                   3960: @table @t
1.59      noro     3961: @item 参照
1.46      takayama 3962: @end table
                   3963:
                   3964: @noindent
                   3965: ChangeLog
                   3966: @itemize @bullet
                   3967: @item
1.59      noro     3968: この関数は wishart 分布に従う対称行列の第一固有値が x 以下である確率の計算を
                   3969: holonomic gradient method でやるためにその初期値を計算する C のプログラムが
                   3970: 必要であった. それを debug するためにとりあえず書いたもの.
                   3971: @item 最適化をまだまださぼってる.
1.46      takayama 3972: @end itemize
                   3973:
1.59      noro     3974: @node ot_hgm_ahg.cbase,,, 実験的仕様の関数
1.49      takayama 3975: @subsection @code{ot_hgm_ahg.cbase}
                   3976: @findex ot_hgm_ahg.cbase
                   3977:
                   3978: @table @t
                   3979: @item cbase(@var{A})
1.59      noro     3980: ::  @var{A} で定義される A-超幾何方程式系の Pfaffian の基底を求める.
1.49      takayama 3981: @end table
                   3982:
                   3983: @table @var
                   3984: @item return
1.59      noro     3985: Pfaffianの基底(微分作用素のモノミアル)のリスト
1.49      takayama 3986: @item A
1.59      noro     3987: 整数を成分とする行列 (maximal rank のもの)を表すリスト
1.49      takayama 3988: @end table
                   3989:
                   3990: @itemize @bullet
1.59      noro     3991: @item A-超幾何イデアルの Q(x)[dx] における標準基底は Pfaffian の基底となるが, 逆はかならずしも真ではない.  個数はもちろん同じである.
1.49      takayama 3992: @item
1.59      noro     3993: アルゴリズムは
1.49      takayama 3994: T.Hibi, K.Nishiyama, N.Takayama, Pfaffian Systems of A-Hypergeometric Equations I, Bases of Twisted Cohomology Groups, arxiv:1212.6103
1.59      noro     3995: による.
                   3996: さらにパラメータ b を数に特殊化する確率算法を用いている.
1.49      takayama 3997: @end itemize
                   3998:
                   3999: @example
                   4000: [2190] import("ot_hgm_ahg.rr");
                   4001: 1
                   4002: [2191] ot_hgm_ahg.cbase([[1,1,1,1],[0,1,2,3]]);
                   4003: We use a probabilistic algorithm to determine the base.[dx2^2,dx3*dx2,dx3^2]
                   4004:
                   4005: [dx3,dx4,1]
                   4006: @end example
                   4007:
                   4008: @table @t
1.59      noro     4009: @item 参照
1.49      takayama 4010: @ref{get_mat2}
                   4011: @end table
                   4012:
                   4013: @noindent
                   4014: ChangeLog
                   4015: @itemize @bullet
                   4016: @item
1.59      noro     4017: この関数は 2012  から 2014-春休みにかけてかかれた.
                   4018: @item version 1.1 以前の版は h-mle/A-hg/Prog  (研究グループの共有フォルダ) にあり.
1.49      takayama 4019: @end itemize
                   4020:
1.59      noro     4021: @node ot_hgm_ahg.get_mat2,,, 実験的仕様の関数
1.49      takayama 4022: @subsection @code{ot_hgm_ahg.get_mat2}
                   4023: @findex ot_hgm_ahg.get_mat2
                   4024: @comment get_mat2
                   4025: @table @t
                   4026: @item get_mat2(@var{A},@var{W},@var{Std},@var{Mset})
1.59      noro     4027: ::  @var{A} で定義される A-超幾何方程式系 H_A の Pfaffian の基底を求めるための Sylvester 法 を適用するための行列を生成する.
1.49      takayama 4028: @end table
                   4029:
                   4030: @table @var
                   4031: @item return
1.59      noro     4032: リスト
1.49      takayama 4033: @item A
1.59      noro     4034: 整数を成分とする行列 (maximal rank のもの)を表すリスト
1.49      takayama 4035: @item W
1.59      noro     4036: リスト. toric ideal のグレブナー基底を計算するための weight vector.
                   4037: 多分なんでもいいはず.
1.49      takayama 4038: @item Std
1.59      noro     4039: リスト. Pfaffian の基底.  cbase(A) の出力を用いる.
1.49      takayama 4040: @item Mset
1.59      noro     4041: Sylvester 型行列を作るための微分作用素のモノミアルのリスト.
1.49      takayama 4042: @end table
                   4043:
                   4044: @itemize @bullet
1.59      noro     4045: @item 出力を @var{P} に代入すると,
                   4046: @var{P}[0]*@var{P}[2] - @var{P}[1]*@var{Std} が modulo  H_A で 0 となる.
                   4047: @var{P}[0] と @var{P}[2] を結合した行列が, sylvester 行列 (論文の記号での F').
                   4048: @var{P}[2], @var{Std} が index モノミアルである.
                   4049: 論文での記号では @var{P}[2] は M_t,  @var{Std} は S.
1.49      takayama 4050: @item
1.59      noro     4051: アルゴリズムは
1.49      takayama 4052: K.Ohara, N.Takayama, Pfaffian Systems of A-Hypergeometric Equations II, Holonomic Gradient Method
1.59      noro     4053: による.  論文の行列 F'.
1.49      takayama 4054: @end itemize
                   4055:
                   4056: @example
                   4057: [2190] import("ot_hgm_ahg.rr");
                   4058: 1
                   4059: [2191] A=[[1,1,1,1],[0,1,2,3]]$
                   4060: Std=ot_hgm_ahg.cbase(A)$
                   4061: W=[[dx1,1,dx2,1,dx3,1,dx4,1]]$
                   4062: Mset=[1,dx1,dx2,dx3,dx4]$
                   4063: [2192] ot_hgm_ahg.get_mat2(A,W,Std,Mset);
                   4064:
1.59      noro     4065: 省略
1.49      takayama 4066: @end example
                   4067:
                   4068: @table @t
1.59      noro     4069: @item 参照
1.49      takayama 4070: @ref{cbase}
                   4071: @end table
                   4072:
                   4073: @noindent
                   4074: ChangeLog
                   4075: @itemize @bullet
                   4076: @item
1.59      noro     4077: この関数は 2012  から 2014-春休みにかけてかかれた.
                   4078: @item version 1.1 以前の版は h-mle/A-hg/Prog  (研究グループの共有フォルダ) にあり.
1.49      takayama 4079: @item
1.59      noro     4080: ソース ot_hgm_ahg.rr の test3(), test3b(), test4(), test5(), test6(), test6c() 等に利用例がある.
1.49      takayama 4081: @item
1.59      noro     4082: test3b() で @var{Mset} を一次式全部にしたものが, 論文の例.
1.49      takayama 4083: @end itemize
                   4084:
                   4085: @comment -------------------
                   4086: @comment  hgm_ahg_contiguity
                   4087: @comment -------------------
1.59      noro     4088: @node ot_hgm_ahg.hgm_ahg_contiguity,,, 実験的仕様の関数
1.49      takayama 4089: @subsection @code{ot_hgm_ahg.hgm_ahg_contiguity}
                   4090: @findex ot_hgm_ahg.hgm_ahg_contiguity
                   4091:
                   4092: @table @t
                   4093: @item hgm_ahg_contiguity(@var{A},@var{StdMon},@var{Line},@var{X0},@var{InitVal},@var{Start},@var{End})
1.59      noro     4094: ::  @var{A} で定義される A-超幾何方程式系のcontiguity relation
                   4095: を Sylvester matrix を用いて計算し, それを用いて超幾何関数の値を求める.
1.49      takayama 4096: @end table
                   4097:
                   4098: @table @var
                   4099: @item return
1.59      noro     4100: 基底を超幾何関数に作用させたベクトルの値 F(End;X0) ??
1.49      takayama 4101: @item A
1.59      noro     4102: 整数を成分とする行列 (maximal rank のもの)を表すリスト.
1.49      takayama 4103: @item StdMon
1.59      noro     4104: リスト.  Pfaffian の基底を与える微分作用素のモノミアルのリスト.
1.49      takayama 4105: @item Line
1.59      noro     4106: リスト  [ContiDir,Beta,Z].
1.49      takayama 4107: @item X0
1.59      noro     4108: リスト. x 変数の値.
1.49      takayama 4109: @item InitVal
1.59      noro     4110: リスト. 基底を超幾何関数に作用させたベクトルの初期値 F(Start;X0)
1.49      takayama 4111: @item Start
1.59      noro     4112: リスト.   Z パラメータの初期値??
1.49      takayama 4113: @item End
1.59      noro     4114: リスト.   Z パラメータの終端値??
1.49      takayama 4115: @end table
                   4116:
                   4117: @itemize @bullet
1.59      noro     4118: @item Todo, この関数のインタフェースは変更される予定.
                   4119: @item  X0 は有理数のリスト.
                   4120: @item ContiDir は End-Start と同じ方向.
                   4121: @item Beta.  A超幾何関数の B パラメータの初期値 ??
                   4122: @item Z.  ContiDir での一次元 contiguity を表現するための不定元の名前.
                   4123: @item ソース中の利用例. test_fd_conti(), test_c111_conti()
1.49      takayama 4124: @item
1.59      noro     4125: アルゴリズムおよび利点は
1.49      takayama 4126: K.Ohara, N.Takayama, Pfaffian Systems of A-Hypergeometric Equations II, Holonomic Gradient Method
1.59      noro     4127: 参照.
1.49      takayama 4128: @end itemize
                   4129:
                   4130: @example
                   4131: [2190] import("ot_hgm_ahg.rr");
                   4132: 1
                   4133: [2191] ot_hgm_ahg.test_fd_conti();
1.59      noro     4134: (Todo, 引数がどうなるかの例を加える.)
1.49      takayama 4135: @end example
                   4136:
                   4137: @table @t
1.59      noro     4138: @item 参照
1.49      takayama 4139: @ref{get_mat2}
                   4140: @ref{hgm_ahg_expected_value_contiguity}
                   4141: @ref{hgm_ahg}
                   4142: @end table
                   4143:
                   4144: @noindent
                   4145: ChangeLog
                   4146: @itemize @bullet
                   4147: @item
1.59      noro     4148: この関数は 2014-07-11 に最初の版が 1.10版 ot_hgm_ahg.rr に commit された.
                   4149: @item インタフェースが更新された版は, 1.??版.
1.49      takayama 4150: @end itemize
                   4151:
                   4152: @comment -------------------
                   4153: @comment  tk_hgpoly.optip
                   4154: @comment -------------------
1.59      noro     4155: @node tk_hgpoly.optip,,, 実験的仕様の関数
1.49      takayama 4156: @subsection @code{tk_hgpoly.optip}
                   4157: @findex tk_hgpoly.optip
                   4158:
                   4159: @table @t
                   4160: @item hgpoly.optip(@var{A},@var{B},@var{W})
1.59      noro     4161: ::  整数計画問題をグレブナー基底を用いて解く.
1.49      takayama 4162: @end table
                   4163:
                   4164: @table @var
                   4165: @item return
1.59      noro     4166: リスト.
1.49      takayama 4167: @item A
1.59      noro     4168: 非負整数を成分とする行列 (maximal rank のもの)を表すリスト
1.49      takayama 4169: @item B
1.59      noro     4170: 非負整数を成分とするベクトルを表すリスト
1.49      takayama 4171: @item W
1.59      noro     4172: 非負整数を成分とするベクトルを表すリスト
1.49      takayama 4173: @end table
                   4174:
                   4175: @itemize @bullet
1.59      noro     4176: @item  @var{A} U = @var{B} を満たす非負の整数ベクトル U の中で,
                   4177: 内積 @var{W} U を最小化する U を戻す.
1.49      takayama 4178: @end itemize
                   4179:
                   4180: @example
                   4181: [0] import("tk_hgpoly.rr");
                   4182: [2191] tk_hgpoly.optip([[1,1,1,1],[0,1,2,3]],[20,40],[1,1,1,0]);
                   4183: [6,1,0,13]
                   4184: @end example
                   4185:
                   4186: @table @t
1.59      noro     4187: @item 参照
1.49      takayama 4188: @ref{feasible}
                   4189: @end table
                   4190:
                   4191: @noindent
                   4192: ChangeLog
                   4193: @itemize @bullet
                   4194: @item
1.59      noro     4195: この関数は   2014-12-12 に commit された.
                   4196: 元版は h-mle/A-hg/Prog
1.49      takayama 4197: @end itemize
                   4198:
                   4199: @comment -------------------
                   4200: @comment  tk_hgpoly.hgpoly
                   4201: @comment -------------------
1.59      noro     4202: @node tk_hgpoly.hgpoly,,, 実験的仕様の関数
1.49      takayama 4203: @subsection @code{tk_hgpoly.hgpoly}
                   4204: @findex tk_hgpoly.hgpoly
                   4205: @table @t
                   4206: @item hgpoly.hgpoly(@var{A},@var{B})
1.59      noro     4207: ::  @var{A}, @var{B} で定義される超幾何多項式を計算する.
1.49      takayama 4208: @end table
                   4209:
                   4210: @table @var
                   4211: @item return
1.59      noro     4212: リスト.
1.49      takayama 4213: @item A
1.59      noro     4214: 非負整数(todo, 再度確認)を成分とする行列 (maximal rank のもの)を表すリスト
1.49      takayama 4215: @item B
1.59      noro     4216: 非負整数を成分とするリスト.
1.49      takayama 4217: @end table
                   4218:
                   4219: @itemize @bullet
1.59      noro     4220: @item  戻り値を F とするとき, F[0] が超幾何多項式. 変数は x_1, x_2, ...
                   4221: F[1] は F[0] の分散表現多項式.
1.49      takayama 4222: @end itemize
                   4223:
                   4224: @example
                   4225: [0] import("tk_hgpoly.rr");
                   4226: [2191] tk_hgpoly.hgpoly([[1,1,1,1],[0,1,2,3]],[2,2]);
                   4227: [x_3*x_1+1/2*x_2^2,(1/2)*<<0,2,0,0>>+(1)*<<1,0,1,0>>]
                   4228: @end example
                   4229:
                   4230:
                   4231: @noindent
                   4232: ChangeLog
                   4233: @itemize @bullet
                   4234: @item
1.59      noro     4235: この関数は   2014-12-12 に commit された.
1.49      takayama 4236: @end itemize
                   4237:
                   4238: @comment -------------------
                   4239: @comment  tk_fd.abc2ahg
                   4240: @comment -------------------
1.59      noro     4241: @node tk_fd.abc2ahg,,, 実験的仕様の関数
1.49      takayama 4242: @subsection @code{tk_fd.abc2ahg}
                   4243: @findex tk_fd.abc2ahg
                   4244: @table @t
                   4245: @item tk_fd.abc2ahg(@var{A},@var{B},@var{C})
1.59      noro     4246: ::  F_D(@var{A}, @var{B},@var{C}) を解にもつ A-超幾何方程式系を求める.
1.49      takayama 4247: @end table
                   4248:
                   4249: @table @var
                   4250: @item return
1.59      noro     4251: リスト.
1.49      takayama 4252: @item A
1.59      noro     4253: 数
1.49      takayama 4254: @item B
1.59      noro     4255: 数のリスト
1.49      takayama 4256: @item C
1.59      noro     4257: 数
1.49      takayama 4258: @end table
                   4259:
                   4260: @itemize @bullet
1.59      noro     4261: @item 戻り値リストの第0成分は A-超幾何方程式系を定義する行列.
                   4262: 第1成分はA-超幾何方程式系のパラメータβ.
1.49      takayama 4263: @end itemize
                   4264:
                   4265: @example
                   4266: [2191] tk_fd.abc2ahg(-3,[-4,-5],3);
                   4267:
                   4268: [[[0,0,0,1,1,1],[1,0,0,1,0,0],[0,1,0,0,1,0],[0,0,1,0,0,1]],[11,5,4,5]]
                   4269: @end example
                   4270:
                   4271: @table @t
1.59      noro     4272: @item 参照
1.49      takayama 4273: @ref{abc2marginal}
                   4274: @ref{marginal2abc}
                   4275: @end table
                   4276:
                   4277: @noindent
                   4278: ChangeLog
                   4279: @itemize @bullet
                   4280: @item
1.59      noro     4281: この関数は   2014-12-13 に tk_fd.rr に追加された.
1.49      takayama 4282: @end itemize
                   4283:
                   4284: @comment -------------------
                   4285: @comment  tk_fd.ahvec_abc
                   4286: @comment -------------------
1.59      noro     4287: @node tk_fd.ahvec_abc,,, 実験的仕様の関数
1.49      takayama 4288: @subsection @code{tk_fd.ahvec_abc}
                   4289: @findex tk_fd.ahvec_abc
                   4290: @table @t
                   4291: @item tk_fd.ahvec_abc(@var{A},@var{B},@var{C},@var{Y} | all=1)
1.59      noro     4292: ::   abc2marginal(@var{A}, @var{B},@var{C})  を周辺和にもつ (2,m+1) 分割表全体についての正規化定数 Z, および Z の変数 Y[1][0], ..., Y[1][m]
                   4293: (2番目の行)についての偏微分を計算する.
1.49      takayama 4294: @end table
                   4295:
                   4296: @table @var
                   4297: @item return
1.59      noro     4298: リスト @var{Ans}
1.49      takayama 4299: @item A
1.59      noro     4300: 数
1.49      takayama 4301: @item B
1.59      noro     4302: 数のリスト. 長さは m.
1.49      takayama 4303: @item C
1.59      noro     4304: 数
1.49      takayama 4305: @item Y
1.59      noro     4306: (2,m+1) 変数値をあらわすリストのリスト.
1.49      takayama 4307: @end table
                   4308:
                   4309: @itemize @bullet
                   4310: @item
1.59      noro     4311: @var{A}, @var{B}, @var{C}, に現れる数は整数を与える.
                   4312: @var{Y} の成分は有理数を与える.
1.49      takayama 4313: @item
1.59      noro     4314: @var{Ans}[2]*@var{Ans}[1] が Z.
                   4315: @var{Ans}[2]*@var{Ans}[0][I] が Z の Y[1][I] についての偏微分.
1.49      takayama 4316: @item
1.59      noro     4317: 論文
1.49      takayama 4318: 1.Y.Goto, Contiguity relations of Lauricella's F_D revisited,  arxiv:1412.3256
1.59      noro     4319: で導出されている
                   4320: contiguity relation を用いて計算する.
1.49      takayama 4321: @end itemize
                   4322:
                   4323: @example
                   4324: [2449] marginal2abc([3,12],[6,3,3,3]);
                   4325: [-3,[-3,-3,-3],4]
                   4326:
                   4327: [2450] tk_fd.ahvec_abc(-3,[-3,-3,-3],4,[[1,1/2,1/3,1/4],[1,1,1,1]]);
                   4328: [[ 24041/1152 143551/11520 16973/1280 78827/5760 ],1/7776]
                   4329:
                   4330: [2451] expectation_abc(-3,[-3,-3,-3],4,[[1,1/2,1/3,1/4],[1,1,1,1]]);
                   4331: [721230/173593,430653/173593,458271/173593,67566/24799]
                   4332: @end example
                   4333:
                   4334: @table @t
1.59      noro     4335: @item 参照
1.49      takayama 4336: @ref{expectation_abc}
                   4337: @end table
                   4338:
                   4339: @noindent
                   4340: ChangeLog
                   4341: @itemize @bullet
                   4342: @item
1.59      noro     4343: この関数は   2014-夏に開発された.
1.49      takayama 4344: @end itemize
                   4345:
                   4346:
1.59      noro     4347: @node pari setbprec setround todouble mpfr_gamma mpfr_floor mpfr_round,,, 実験的仕様の関数
1.50      takayama 4348: @subsection @code{pari}, @code{setbprec},@code{setround},@code{todouble},@code{mpfr_gamma},@code{mpfr_floor},@code{mpfr_round},
                   4349: @findex pari
                   4350: @findex setbprec
                   4351: @findex setround
                   4352: @findex todouble
                   4353: @findex mpfr_gamma
                   4354: @findex mpfr_floor
                   4355: @findex mpfr_round
                   4356:
1.59      noro     4357: @comment --- 関数の簡単な説明 ---
                   4358: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.50      takayama 4359: @table @t
                   4360: @item pari(@var{arg1},@var{arg2},...)
1.59      noro     4361: ::  MPFR で pari の関数を emulate するか ox_pari サーバーを呼び出す.
1.50      takayama 4362: @itemx setbprec(@var{arg1})
                   4363: @itemx setround(@var{arg1})
1.59      noro     4364:    丸めの方法の指定. mpfr 準拠.
1.50      takayama 4365: @itemx todouble(@var{arg1})
1.59      noro     4366: :: bigfloat 型を double に変換する.
1.50      takayama 4367: @itemx mpfr_gamma(@var{arg1})
1.59      noro     4368: :: gamma 関数の計算.
1.50      takayama 4369: @itemx mpfr_floor(@var{arg1})
1.59      noro     4370: ::  floor の計算.
1.50      takayama 4371: @itemx mpfr_round(@var{arg1})
1.59      noro     4372: :: 丸めの計算.
1.50      takayama 4373: @end table
                   4374:
                   4375: @table @var
                   4376: @item return
1.59      noro     4377: 後述.
1.50      takayama 4378: @item arg1, arg2
1.59      noro     4379: 後述.
1.50      takayama 4380: @end table
                   4381:
                   4382: @itemize @bullet
1.59      noro     4383: @item 20150807 以降の asir では, bigfloat が pari ではなく mpfr を用いて計算される.
                   4384: Todo, pari は ox_pari を呼び出すが, まだ ox_pari に未実装の機能が多くある.
                   4385: 区間演算への対応は行っていない.
1.50      takayama 4386: @item
                   4387: pari(floor,@var{arg1}),
                   4388: pari(round,@var{arg1}),
                   4389: pari(gamma,@var{arg1})
1.59      noro     4390: は mpfr で pari を emulate しているので, 動作が異なる.
                   4391: 特に gamma は複素数の引数を受け取らない.
                   4392: pari の floor は桁数が足りなくなるとエラーで終了したが,
                   4393: この floor では setprec で指定した桁数以内なら正しく floor を戻す.
                   4394: Todo, ox_pari  を指定して呼び出す方法.
1.50      takayama 4395: @end itemize
                   4396:
                   4397: @example
                   4398: [219] ctrl("bigfloat",1)$
                   4399: [220] setprec(100)$
                   4400: [221] pari(floor,1111111111111.1+1/10);
                   4401: 1111111111111
                   4402: @end example
                   4403:
                   4404: @table @t
1.59      noro     4405: @item 参照
1.50      takayama 4406: @ref{pari}
                   4407: @end table
                   4408:
1.59      noro     4409: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   4410: @comment --- openxm の外部からの寄与も述べる. Credit.
1.50      takayama 4411: @noindent
                   4412: ChangeLog
                   4413: @itemize @bullet
1.59      noro     4414: @item これらの大変更は 2015-08-03 より 08-07 の asir 合宿でおこなわれた.
                   4415: まだ作業中.  Todo, asirgui への対応. debug, ...
                   4416: @item 変更をうけたソースコードは asir2000/builtin/bfaux.c,
                   4417: asir2000/engine/bf.c, asir2000/builtin/parif.c 等多数.
1.50      takayama 4418: @end itemize
                   4419:
1.19      takayama 4420: @comment ****************************************************************
1.59      noro     4421: @comment --- ◯◯◯◯  以下他の関数について真似して記述する. ◯◯◯◯
                   4422: @comment 新しい関数の説明を書くためのテンプレートである. 消すな.
                   4423: @comment --- ◯◯◯◯  関数 syz_pqr, xyz_stu の説明 ◯◯◯◯
                   4424: @comment --- 複数の関数をまとめて説明する例 ---
                   4425: @node xyz_pqr syz_stu,,, 実験的仕様の関数
                   4426: @comment @menu にも * syz_pqr syz_stu::  と続けて書く事. 分けてはいけない.
1.4       takayama 4427: @subsection @code{xyz_pqr}, @code{syz_stu}
                   4428: @findex xyz_pqr
                   4429: @findex xyz_stu
                   4430:
1.59      noro     4431: @comment --- 関数の簡単な説明 ---
                   4432: @comment --- @itemx は複数に対して説明を一つつける場合に使う ---
1.3       takayama 4433: @table @t
1.1       takayama 4434: @item xyz_pqr(@var{arg1},@var{arg2}[,@var{flag}])
                   4435: @itemx xyz_stu(@var{arg1},@var{arg2})
1.59      noro     4436: :: xyz に関する操作.
1.1       takayama 4437: @end table
                   4438:
                   4439: @table @var
                   4440: @item return
1.59      noro     4441: 整数
1.1       takayama 4442: @item arg1, arg2
1.59      noro     4443: 整数
1.1       takayama 4444: @item flag
1.59      noro     4445: 0 または 1
1.1       takayama 4446: @end table
                   4447:
                   4448: @itemize @bullet
1.59      noro     4449: @item この項目は新しい関数の説明を書くためのテンプレートである. 消すな.
1.1       takayama 4450: @item
1.59      noro     4451: @code{xyz_pqr()} は, @var{arg1}, @var{arg2} を pqr する.
1.1       takayama 4452: @item
1.59      noro     4453: @var{flag} が 0 でないとき, モジュラ計算を行う.
1.1       takayama 4454: @item
1.59      noro     4455: @code{xyz_stu()} は stu アルゴリズムを用いる.
1.1       takayama 4456: @end itemize
                   4457:
                   4458: @example
                   4459: [219] xyz_pqr(1,2);
                   4460: 3
                   4461: [220] xyz_pqr(1,2,1);
                   4462: 3
                   4463: 0
                   4464: [221] xyz_stu(1,2);
                   4465: 3
                   4466: @end example
                   4467:
                   4468: @table @t
1.59      noro     4469: @item 参照
1.1       takayama 4470: @ref{xyz_abc}
                   4471: @end table
                   4472:
1.59      noro     4473: @comment --- ChangeLog を書く. 動機. ソースコードの位置. 変更日時 など CVSサーバを見るため
                   4474: @comment --- openxm の外部からの寄与も述べる. Credit.
1.1       takayama 4475: @noindent
                   4476: ChangeLog
                   4477: @itemize @bullet
1.59      noro     4478: @item この関数は 2004-3-1 から 2004-3-14 にかけて アルゴリズム xyz (論文
                   4479:  http://www.afo.org/xyz.pdf ) を用いて書き直された.
                   4480:  変更をうけたソースコードは xxxyy.rr, ppp.c である.
                   4481: @item この関数は 2000 頃にはじめてのバージョンが書かれた. ソースは ppp.c である.
1.1       takayama 4482: @end itemize
                   4483:
1.59      noro     4484: @comment --- おまじない ---
1.1       takayama 4485: @node Index,,, Top
                   4486: @unnumbered Index
                   4487: @printindex fn
                   4488: @printindex cp
                   4489: @iftex
                   4490: @vfill @eject
                   4491: @end iftex
                   4492: @summarycontents
                   4493: @contents
                   4494: @bye
1.59      noro     4495: @comment --- おまじない終り ---

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>