[BACK]Return to m.oxweave CVS log [TXT][DIR] Up to [local] / OpenXM / src / asir-contrib / packages / doc

Annotation of OpenXM/src/asir-contrib/packages/doc/m.oxweave, Revision 1.1

1.1     ! takayama    1: /* $OpenXM$ */
        !             2: /* Use oxweave to generate documents on this source code
        !             3:    Use iso-2022 to write this file. No default use of GL and GR is allowed.
        !             4: */
        !             5:
        !             6:
        !             7: /*&C-texi
        !             8: @c DO NOT EDIT THIS FILE   oxmath.texi  It is automatically generated
        !             9: @c from asir-contrib/packages/doc/m.oxweave
        !            10: @node Mathematica Functions,,, Top
        !            11: */
        !            12: /*&jp-texi
        !            13: @chapter Mathematica $BH!?t(B
        !            14:
        !            15: $B$3$N@a$G$O(B Mathematica $B$N(B ox $B%5!<%P(B @code{ox_math}
        !            16: $B$H$N%$%s%?%U%'!<%94X?t$r2r@b$9$k(B.
        !            17: $B$3$l$i$N4X?t$O%U%!%$%k(B  @file{m} $B$GDj5A$5$l$F$$$k$N$G$3$N%U%!%$%k$r(B
        !            18: @code{load("m")$} $B$G$3$N%U%!%$%k$r%m!<%I$7$F$+$i;HMQ$7$J$$$H$$$1$J$$(B.
        !            19: @file{m} $B$O(B @file{$(OpenXM_HOME)/lib/asir-contrib} $B$K$"$k(B.
        !            20:
        !            21: $BCm0U(B: @code{ox_reset} $B$OF0$+$J$$(B.
        !            22: */
        !            23: /*&eg-texi
        !            24: @chapter Mathematica Functions
        !            25:
        !            26: This chapter describes  interface functions for
        !            27: Mathematica ox server @code{ox_math}.
        !            28: These interface functions are defined in the file @file{m}.
        !            29: You need to load the file before using the interface functions.
        !            30: by the command @code{load("m")$}.
        !            31: The file @file{m} is at @file{$(OpenXM_HOME)/lib/asir-contrib}.
        !            32:
        !            33: Note: @code{ox_reset} does not work.
        !            34: */
        !            35: /*&C-texi
        !            36: @example
        !            37: @include opening.texi
        !            38: [258] load("m")$
        !            39: m Version 19991113. m.start, m.tree_to_string, m.n_Eigenvalues
        !            40: [259] m.start();
        !            41: ox_math has started.
        !            42: ox_math: Portions copyright 2000 Wolfram Research, Inc.
        !            43: See OpenXM/Copyright/Copyright.mathlink  for details.
        !            44: 0
        !            45: [260] m.n_Eigenvalues([[1,2],[4,5]]);
        !            46: [-0.464102,6.4641]
        !            47: @end example
        !            48: */
        !            49:
        !            50: /*&C-texi
        !            51: @noindent
        !            52: @code{Mathematica} is the trade mark of Wolfram Research Inc.
        !            53: This package requires Mathmatica Version 3.0, so you need
        !            54: Mathematica to make this package work.
        !            55: See @code{http://www.wolfram.com}.
        !            56: The copyright and license agreement of the mathlink is put at
        !            57: @code{OpenXM/Copyright/Copyright.mathlink}
        !            58: Note that the licence prohibits to connect to a mathematica
        !            59: kernel via the internet.
        !            60:
        !            61: @noindent
        !            62: Author of @code{ox_math}: Katsuyoshi Ohara,
        !            63: @code{ohara@@air.s.kanazawa-u.ac.jp}.
        !            64: */
        !            65:
        !            66:
        !            67: /*&jp-texi
        !            68: @section $BH!?t0lMw(B
        !            69: */
        !            70: /*&eg-texi
        !            71: @section Functions
        !            72: */
        !            73: /*&jp-texi
        !            74: @menu
        !            75: * m.start::
        !            76: @end menu
        !            77: @node m.start,,, Mathematica Functions
        !            78: @subsection @code{m.start}
        !            79: @findex m.start
        !            80: @table @t
        !            81: @item m.start()
        !            82: ::  Localhost $B$G(B @code{ox_math} $B$r5/F0$9$k(B.
        !            83: @end table
        !            84:
        !            85: @table @var
        !            86: @item return
        !            87: $B@0?t(B
        !            88: @end table
        !            89:
        !            90: @itemize @bullet
        !            91: @item Localhost $B$G(B @code{ox_math} $B$r5/F0$9$k(B.
        !            92:     $B5/F0$5$l$?(B @code{ox_math} $B$N<1JLHV9f$rLa$9(B.
        !            93: @item @code{Xm_noX =1} $B$H$7$F$*$/$H(B, @code{ox_math} $BMQ$N(B debug window $B$,3+$+$J$$(B.
        !            94: @item $B<1JLHV9f$O(B @code{M_proc} $B$K3JG<$5$l$k(B.
        !            95: @end itemize
        !            96: */
        !            97: /*&eg-texi
        !            98: @menu
        !            99: * m.start::
        !           100: @end menu
        !           101: @node m.start,,, Mathematica Functions
        !           102: @subsection @code{m.start}
        !           103: @findex m.start
        !           104: @table @t
        !           105: @item m.start()
        !           106: ::  Start  @code{ox_math} on the localhost.
        !           107: @end table
        !           108:
        !           109: @table @var
        !           110: @item return
        !           111: Integer
        !           112: @end table
        !           113:
        !           114: @itemize @bullet
        !           115: @item Start @code{ox_math} on the localhost.
        !           116:     It returns the descriptor of @code{ox_math}.
        !           117: @item Set @code{Xm_noX = 1} to start @code{ox_math} without a debug window.
        !           118: @item The descriptor is stored in the variable @code{M_proc}.
        !           119: @end itemize
        !           120: */
        !           121: /*&C-texi
        !           122: @example
        !           123: P = m.start()
        !           124: @end example
        !           125: */
        !           126: /*&jp-texi
        !           127: @table @t
        !           128: @item $B;2>H(B
        !           129: @code{ox_launch}
        !           130: @end table
        !           131: */
        !           132: /*&eg-texi
        !           133: @table @t
        !           134: @item Reference
        !           135: @code{ox_launch}
        !           136: @end table
        !           137: */
        !           138:
        !           139: /*&jp
        !           140:   $B0J2<$G(BMathematica $B$r8F$V$?$a$NJd=u4X?t$rDj5A$9$k(B.
        !           141: */
        !           142:
        !           143: /*&jp-texi
        !           144: @menu
        !           145: * m.tree_to_string::
        !           146: @end menu
        !           147: @node m.tree_to_string,,, Mathematica Functions
        !           148: @subsection @code{m.tree_to_string}
        !           149: @findex m.tree_to_string
        !           150: @table @t
        !           151: @item m.tree_to_string(@var{t})
        !           152: ::  ox_math $B$NLa$9(B Mathematica $B$NLZ9=B$%G!<%?(B @var{t} $B$r(B @code{asir} $B7A<0$K(B
        !           153: $B$J$*$9(B.
        !           154: @end table
        !           155:
        !           156: @table @var
        !           157: @item return
        !           158: $BJ8;zNs(B
        !           159: @item t
        !           160: $B%j%9%H(B
        !           161: @end table
        !           162: @itemize @bullet
        !           163: @item
        !           164: t $B$O(B @code{ox_math} $B$NLa$9(B Mathematica $B$NLZ9=B$%G!<%?(B.
        !           165: @item
        !           166: ox_math $B$NLa$9(B Mathematica $B$NLZ9=B$%G!<%?(B @var{t} $B$r(B @code{asir} $B7A<0$K(B
        !           167: $B$J$*$9(B.
        !           168: @item
        !           169:    @var{t} $B$r$J$k$Y$/(B asir $B$,M}2r$G$-$k7A$G$N(B, $BA0CV$^$?$OCfCV5-K!(B
        !           170:    $B$NJ8;zNs$KJQ49$9$k(B.
        !           171:    @var{t}$B$N@hF,MWAG$NJ8;zNs$,%-!<%o!<%I$G$"$k$,(B, $B$=$NJ8;z$,JQ49%F!<%V%k$K$J$$(B
        !           172:    $B$H$-$O(B, @code{m_} $B$r%-!<%o!<%I$N@hF,$K$D$1$F(B, $B4X?t8F=P7A<0$NJ8;zNs$X(B
        !           173:    $B$+$($k(B.
        !           174: @end itemize
        !           175: */
        !           176: /*&eg-texi
        !           177: @menu
        !           178: * m.tree_to_string::
        !           179: @end menu
        !           180: @node m.tree_to_string,,, Mathematica Functions
        !           181: @subsection @code{m.tree_to_string}
        !           182: @findex m.tree_to_string
        !           183: @table @t
        !           184: @item m.tree_to_string(@var{t})
        !           185: ::  translates Mathematica tree data  @var{t} into a string that can
        !           186: be understandable by @code{asir} as far as possible.
        !           187: @end table
        !           188:
        !           189: @table @var
        !           190: @item return
        !           191: String
        !           192: @item t
        !           193: List
        !           194: @end table
        !           195: @itemize @bullet
        !           196: @item
        !           197: t is a Mathematica tree data which is generated by @code{ox_math}.
        !           198: @item
        !           199: This function
        !           200:  translates Mathematica tree data  @var{t} into a string that may
        !           201: be understandable by @code{asir}.
        !           202: @item
        !           203:    This function translates @var{t} into a prefix or infix expression that may be understantable by @code{asir}.
        !           204:    The first element of the list @var{t}
        !           205:   is a key word string of the Mathematica object.
        !           206:   If this function recognizes the key word, it translates @code{t} into
        !           207:   the form that can be understandable by @code{asir}.
        !           208:   If it cannot recognizes the key word, it translates @code{t} into
        !           209:   a function call with the function name
        !           210:   @code{m_(the key word)}.
        !           211: @end itemize
        !           212: */
        !           213: /*&C-texi
        !           214: @example
        !           215: [267] m.start();
        !           216: 0
        !           217: [268] ox_execute_string(0,"Expand[(x-1)^2]");
        !           218: 0
        !           219: [269] A=ox_pop_cmo(0);
        !           220: [Plus,1,[Times,-2,x],[Power,x,2]]
        !           221: [270] m.tree_to_string(A);
        !           222: (1)+((-2)*(x))+((x)^(2))
        !           223: [271] eval_str(@@);
        !           224: x^2-2*x+1
        !           225: @end example
        !           226: */
        !           227: /*&C-texi
        !           228: @example
        !           229: [259] m.tree_to_string(["List",1,2]);
        !           230: [1 , 2]
        !           231: [260] m.tree_to_string(["Plus",2,3]);
        !           232: (2)+(3)
        !           233: [261] m.tree_to_string(["Complex",2.3,4.55]);
        !           234: m.complex(2.3 , 4.55)
        !           235: [362] m.tree_to_string(["Plus",["Complex",1.2,3.5],1/2]);
        !           236: (m.complex(1.2 , 3.5))+(1/2)
        !           237: [380] eval_str(@@);
        !           238: (1.7+3.5*@i)
        !           239: @end example
        !           240: */
        !           241: /*&jp-texi
        !           242: @table @t
        !           243: @item $B;2>H(B
        !           244: @code{ox_pop_cmo}, @code{eval_str}, @code{m.rtomstr}
        !           245: @end table
        !           246: */
        !           247: /*&eg-texi
        !           248: @table @t
        !           249: @item Reference
        !           250: @code{ox_pop_cmo}, @code{eval_str}, @code{m.rtomstr}
        !           251: @end table
        !           252: */
        !           253: /*&jp
        !           254:   {\tt m\_tree\_to\_string(L)} $B$O(B, {\tt MathLink} $B$N(B $BLZ7A<0$GM?$($l$?(B
        !           255:   $B%*%V%8%(%'%/%H$r$J$k$Y$/(B asir $B$,M}2r$G$-$k7A$G$N(B, $BA0CV$^$?$OCfCV5-K!(B
        !           256:    $B$NJ8;zNs$KJQ49$9$k(B. \\
        !           257:    $BNc(B: {\tt m\_tree\_to\_string(["Plus",1,2])} $B$OJ8;zNs(B
        !           258:        {\tt 1+2} $B$rLa$9(B. \\
        !           259:    $B%j%9%H$N@hF,$NJ8;zNs$,%-!<%o!<%I$G$"$k$,(B, $B$=$NJ8;z$,JQ49%F!<%V%k$K$J$$(B
        !           260:    $B$H$-$O(B, {\tt m\_} $B$r%-!<%o!<%I$N@hF,$K$D$1$F(B, $B4X?t8F=P7A<0$NJ8;zNs$X(B
        !           261:    $BJQ$($k(B.
        !           262: */
        !           263:
        !           264: /*&jp-texi
        !           265: @menu
        !           266: * m.rtomstr::
        !           267: @end menu
        !           268: @node m.rtomstr,,, Mathematica Functions
        !           269: @subsection @code{m.rtomstr}
        !           270: @findex m.rtomstr
        !           271: @table @t
        !           272: @item m.rtomstr(@var{t})
        !           273: ::  @var{t} $B$r$J$k$Y$/(B Mathematica $B$NM}2r2DG=$JJ8;zNs$KJQ$($k(B.
        !           274: @end table
        !           275:
        !           276: @table @var
        !           277: @item return
        !           278: $BJ8;zNs(B
        !           279: @item t
        !           280: $B%*%V%8%'%/%H(B
        !           281: @end table
        !           282: @itemize @bullet
        !           283: @item
        !           284:    @var{t} $B$r$J$k$Y$/(B Mathematica $B$,M}2r$G$-$k7A$NJ8;zNs$KJQ49$9$k(B.
        !           285:    $B$?$H$($P(B, @code{asir} $B$G$O%j%9%H$r(B @code{[}, @code{]} $B$G0O$`$,(B,
        !           286:    Mathematica $B$G$O(B @code{@{}, @code{@}} $B$G0O$`(B.
        !           287:    $B$3$N4X?t$O$3$NJQ49$r$*$3$J$&(B.
        !           288: @end itemize
        !           289: */
        !           290: /*&eg-texi
        !           291: @menu
        !           292: * m.rtomstr::
        !           293: @end menu
        !           294: @node m.rtomstr,,, Mathematica Functions
        !           295: @subsection @code{m.rtomstr}
        !           296: @findex m.rtomstr
        !           297: @table @t
        !           298: @item m.rtomstr(@var{t})
        !           299: ::  translate the object @var{t} into a string that can be understandable
        !           300: by Mathematica as far as possible.
        !           301: @end table
        !           302:
        !           303: @table @var
        !           304: @item return
        !           305: String
        !           306: @item t
        !           307: Object
        !           308: @end table
        !           309: @itemize @bullet
        !           310: @item
        !           311:  It  translates the object @var{t} into a string that can be understandable
        !           312: by Mathematica as far as possible.
        !           313: For example, @code{asir} uses  @code{[}, @code{]} to express a list,
        !           314: but @code{Mathematica} uses @code{@{}, @code{@}}.
        !           315: This function makes this sort of translations.
        !           316: @end itemize
        !           317: */
        !           318: /*&C-texi
        !           319: @example
        !           320: [259] m.rtomstr([1,2,3]);
        !           321: {1,2,3}
        !           322: [260] m.rtomstr([[1,x,x^2],[1,y,y^2]]);
        !           323: @{@{1,x,x^2@},@{1,y,y^2@}@}
        !           324: @end example
        !           325: */
        !           326: /*&jp-texi
        !           327: $B$b$&0l$DNc$r$"$2$h$&(B.
        !           328: $B<!$N4X?t(B @code{m.inverse(M)} $B$O(B @code{ox_math}
        !           329: $B$r$h$s$G9TNs(B @code{M} $B$N5U9TNs$r7W;;$9$k4X?t$G$"$k(B.
        !           330: @code{m.inverse(M)} $B$O<!$N$h$&$K(B @code{r_tostr(M)} $B$rMQ$$$F(B
        !           331: asir $B$N9TNs$r(B Mathematica $B7A<0$KJQ49$7$F$+$i(B
        !           332: @code{ox_execute_string} $B$G(B Mathematica $B$K5U9TNs$r7W;;(B
        !           333: $B$5$;$F$$$k(B.
        !           334: */
        !           335: /*&eg-texi
        !           336: Let us see one more example.
        !           337: The following function @code{m.inverse(M)} outputs
        !           338: the inverse matrix of the matrix @code{M} by calling @code{ox_math}.
        !           339: It translates @code{asir} matrix @code{M} into a Mathematica expression
        !           340: by @code{r_tostr(M)}
        !           341: and makes Mathematica compute the inverse matrix of @code{M} by
        !           342: @code{ox_execute_string}.
        !           343: */
        !           344: /*&C-texi
        !           345: @example
        !           346: def inverse(M) @{
        !           347:   P = 0;
        !           348:   A = m.rtomstr(M);
        !           349:   ox_execute_string(P,"Inverse["+A+"]");
        !           350:   B = ox_pop_cmo(B);
        !           351:   C = m.tree_to_string(B);
        !           352:   return(eval_str(C));
        !           353: @}
        !           354:
        !           355: [269] M=[[1,x,x^2],[1,y,y^2],[1,z,z^2]];
        !           356: [[1,x,x^2],[1,y,y^2],[1,z,z^2]]
        !           357: [270] A=m.inverse(M)$
        !           358: [271] red(A[0][0]);
        !           359: (z*y)/(x^2+(-y-z)*x+z*y)
        !           360: @end example
        !           361: */
        !           362: /*&jp-texi
        !           363: @table @t
        !           364: @item $B;2>H(B
        !           365: @code{ox_execute_string}, @code{ToExpression}(Mathematica),
        !           366: @code{m.tree_to_string}
        !           367: @end table
        !           368: */
        !           369: /*&eg-texi
        !           370: @table @t
        !           371: @item Reference
        !           372: @code{ox_execute_string}, @code{ToExpression}(Mathematica),
        !           373: @code{m.tree_to_string}
        !           374: @end table
        !           375: */
        !           376: /*&jp
        !           377:   $B4X?t(B \verb+ m.rtomstr(L) + $B$O(B asir $B7A<0$N%*%V%8%'%/%H(B L $B$r$J$k$Y$/(B
        !           378:   Mathematica $B$,M}2r$G$-$k7A$NJ8;zNs$KJQ49$9$k(B.
        !           379:   $B$?$H$($P(B, $B%j%9%H(B, $B%Y%/%H%k(B, $B9TNs(B $B$O(B asir $B$G$O(B {\tt [}, {\tt ]}
        !           380:   $B$G0O$`$,(B, Mathematica $B$G$O(B, {\tt \{ }, {\tt \}} $B$G0O$`(B.
        !           381:   $B8=:_$N$H$3$m$3$N4X?t$O$3$NJQ49$N$_9T$J$C$F$$$k(B. \\
        !           382:   $BNc(B:
        !           383:   {\footnotesize
        !           384:   \begin{verbatim}
        !           385:    [262] m.rtomstr([1,2,3]);
        !           386:    {1,2,3}
        !           387:    [375] A = newvect(3,[x+2,"Hello",[1/2,3]]);
        !           388:    [ x+2 Hello [1/2,3] ]
        !           389:    [376] m.rtomstr(A);
        !           390:    {x+2,Hello,{1/2,3}}
        !           391:   \end{verbatim}
        !           392:   }
        !           393: */
        !           394:
        !           395: end$
        !           396:

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