next up previous contents
Next: Zero Up: CMOexpressions for numbers and Previous: CMOexpressions for numbers and

Indeterminate and Tree

Group CMObject/Tree requires CMObject/Basic.
Tree, Lambda $\in$ CMObject/Tree.

\begin{eqnarray*}\mbox{Tree} &:& ({\tt CMO\_TREE}, {\sl Cstring}\, {\rm name},
...
...y}) \\
& & \mbox{ --- a function with the arguments body. } \\
\end{eqnarray*}


In many computer algebra systems, mathematical expressions are usually expressed in terms of a tree structure. For example, $\sin(x+e)$ is expressed as (sin, (plus, x, e)) as a tree. Tree may be expressed by putting the expression between SM_beginBlock and SM_endBlock, which are stack machine commands for delayed evaluation. (cf. { , } in PostScript). However it makes the implementation of stack machines complicated. It is desirable that CMObject is independent of OX stack machine. Therefore we introduce an OpenMath like tree representation for CMO Tree object. This method allows us to implement tree structure easily on individual OpenXM systems. Note that CMO Tree corresponds to Symbol and Application in OpenMath.

Lambda is used to define functions. The notion ``lambda'' is borrowed from the language Lisp.

Example: the expression of sin(x+e).

(CMO_TREE, (CMO_STRING, "sin"), 
    (CMO_LIST,[size=]1,(CMO_LIST,[size=]2,(CMO_STRING, "cdname"),
                                          (CMO_STRING,"basic")))
    (CMO_LIST,[size=]1, 
        (CMO_TREE, (CMO_STRING, "plus"), (CMO_STRING, "basic"),
            (CMO_LIST,[size=]2, (CMO_INDETERMINATE,"x"),
                 (CMO_TREE,(CMO_STRING, "e"),  the base of natural logarithms
    (CMO_LIST,[size=]1,(CMO_LIST,[size=]2,(CMO_STRING, "cdname"),
                                          (CMO_STRING,"basic")))
        ))
    )
)
Elements of the leave may be any objects including polynomials.

Example:

sm1> [(plus) [[(cdname) (basic)]] [(123).. (345)..]] [(class) (tree)] dc ::
Class.tree [$plus$ , [[$cdname$ , $basic$ ]], [ 123 , 345 ]  ]

Example:

asir
[753] taka_cmo100_xml_form(quote(sin(x+1)));
<cmo_tree>  <cmo_string>"sin"</cmo_string> 
 <cmo_list><cmo_int32 for="length">1</cmo_int32>   
   <cmo_list><cmo_int32 for="length">2</cmo_int32>    
     <cmo_string>"cdname"</cmo_string> 
     <cmo_string>"basic"</cmo_string> 
   </cmo_list> </cmo_list> 
<cmo_tree>    <cmo_string>"plus"</cmo_string> 
  <cmo_list><cmo_int32 for="length">1</cmo_int32>     
    <cmo_list><cmo_int32 for="length">2</cmo_int32>      
      <cmo_string>"cdname"</cmo_string> 
      <cmo_string>"basic"</cmo_string> 
    </cmo_list> </cmo_list> 
 <cmo_indeterminate> <cmo_string>"x"</cmo_string>  </cmo_indeterminate>
 <cmo_zz>1</cmo_zz>
</cmo_tree></cmo_tree>

Let us define a group for distributed polynomials. In the following, DMS stands for Distributed Monomial System.

Group CMObject/DistributedPolynomials requires CMObject/Primitive, CMObject/Basic.
Monomial, Monomial32, Coefficient, Dpolynomial, DringDefinition, Generic DMS ring, RingByName, DMS of N variables $\in$ CMObject/DistributedPolynomials.


\begin{eqnarray*}\mbox{Monomial} &:& \mbox{Monomial32}\, \vert\, \mbox{Zero} \\ ...
... & & \mbox{ --- outord is the order of variables to output.} \\
\end{eqnarray*}


Note that it is possible to define DMS without RingByName and DMS of N variables.

In the following we describe how the above CMObjects are implemented on Asir and Kan.


next up previous contents
Next: Zero Up: CMOexpressions for numbers and Previous: CMOexpressions for numbers and
Nobuki Takayama 平成14年1月21日