Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 7ebd25ac536d248d499a3ce2acda963a > files > 3473

Macaulay2-1.3.1-8.fc15.i686.rpm

<?xml version="1.0" encoding="utf-8" ?>  <!-- for emacs: -*- coding: utf-8 -*- -->
<!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"	 "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Expression -- the class of all expressions</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_expression.html">next</a> | <a href="_exponents.html">previous</a> | <a href="_expression.html">forward</a> | <a href="_exponents.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div>

    </td>
  </tr>
</table>
<hr/>
<div><h1>Expression -- the class of all expressions</h1>
<div class="single"><h2>Description</h2>
<div>An <em>expression</em> is a symbolic representation of a mathematical expression.  It retains some of the semantics of the mathematical expression, as well as enough information to print the expression nicely.  In Macaulay2 expressions have two main functions: they are an intermediate phase in the conversion of a mathematical object to a <a href="_net.html" title="format for printing, as a net">net</a> that can be printed; and they are a way of holding and displaying a mathematical expression in an unevaluated form that can be both printed and evaluated.<p/>
Internally, each expression is a basic list whose elements may also be expressions.  The elements that are not expressions are interpreted as themselves, and may be strings, symbols, numbers, etc.  There are several types of expression that correspond to various sorts of mathematical entities, such as sums of class <a href="___Sum.html" title="the class of all sum expressions">Sum</a>, products, of class <a href="___Product.html" title="the class of all product expressions">Product</a>, fractions of class <a href="___Divide.html" title="the class of all divide expressions">Divide</a>, etc.<p/>
Expressions are produced with the function <a href="_expression.html" title="convert to an expression">expression</a>.  The various methods installed for it try to bring as much of the semantic structure of the mathematical object to light.  The following examples illustrate that, using <a href="_peek.html" title="examine contents of an object">peek</a> and <a href="_peek_sq_lp__Z__Z_cm__Thing_rp.html" title="examine contents of an object">peek'</a> to display the internal structure.<table class="examples"><tr><td><pre>i1 : expression 4

o1 = 4

o1 : Expression of class Holder</pre>
</td></tr>
<tr><td><pre>i2 : peek oo

o2 = Holder{4}</pre>
</td></tr>
<tr><td><pre>i3 : d = expression (-4)

o3 = -4

o3 : Expression of class Minus</pre>
</td></tr>
<tr><td><pre>i4 : peek oo

o4 = Minus{4}</pre>
</td></tr>
<tr><td><pre>i5 : QQ[x];</pre>
</td></tr>
<tr><td><pre>i6 : f = (x+1)^5

      5     4      3      2
o6 = x  + 5x  + 10x  + 10x  + 5x + 1

o6 : QQ[x]</pre>
</td></tr>
<tr><td><pre>i7 : peek f

o7 = QQ[x]{x5+5x4+10x3+10x2+5x+1}</pre>
</td></tr>
<tr><td><pre>i8 : e = expression f

      5     4      3      2
o8 = x  + 5x  + 10x  + 10x  + 5x + 1

o8 : Expression of class Sum</pre>
</td></tr>
<tr><td><pre>i9 : peek e

          5    4     3     2
o9 = Sum{x , 5x , 10x , 10x , 5x, 1}</pre>
</td></tr>
<tr><td><pre>i10 : peek'_2 e

                   5               4                3                2
o10 = Sum{Product{x }, Product{5, x }, Product{10, x }, Product{10, x },
      -----------------------------------------------------------------------
      Product{5, x}, 1}</pre>
</td></tr>
<tr><td><pre>i11 : peek'_11 e

o11 = Sum{Product{Power{x, 5}}, Product{5, Power{x, 4}}, Product{10, Power{x,
      -----------------------------------------------------------------------
      3}}, Product{10, Power{x, 2}}, Product{5, x}, 1}</pre>
</td></tr>
</table>
The function <a href="_factor.html" title="factor a ring element or a ZZ-module">factor</a> returns an expression.<table class="examples"><tr><td><pre>i12 : c = factor f

             5
o12 = (x + 1)

o12 : Expression of class Product</pre>
</td></tr>
<tr><td><pre>i13 : peek'_2 c

o13 = Product{Power{x + 1, 5}}</pre>
</td></tr>
<tr><td><pre>i14 : factor 240012

       2 2
o14 = 2 3 59*113

o14 : Expression of class Product</pre>
</td></tr>
</table>
Expressions can be evaluated using <a href="_value.html" title="evaluate">value</a>.<table class="examples"><tr><td><pre>i15 : value e

       5     4      3      2
o15 = x  + 5x  + 10x  + 10x  + 5x + 1

o15 : QQ[x]</pre>
</td></tr>
<tr><td><pre>i16 : value e == f

o16 = true</pre>
</td></tr>
<tr><td><pre>i17 : value c

       5     4      3      2
o17 = x  + 5x  + 10x  + 10x  + 5x + 1

o17 : QQ[x]</pre>
</td></tr>
</table>
The following operators can be applied to expressions: <a href="___S__P__A__C__E.html" title="blank operator; often used for function application, making polynomial rings">SPACE</a>, <a href="__st.html" title="a binary operator, usually used for multiplication">*</a>, <a href="__st_st.html" title="a binary operator, usually used for tensor product or Cartesian product">**</a>, <a href="__pl.html" title="a unary or binary operator, usually used for addition">+</a>, <a href="_-.html" title="a unary or binary operator, usually used for negation or subtraction">-</a>, <a href="__sl.html" title="a binary operator, usually used for division">/</a>, <a href="__eq_eq.html" title="equality">==</a>, <a href="_^.html" title="a binary operator, usually used for powers">^</a>, and <a href="__us.html" title="a binary operator, used for subscripting and access to elements">_</a>.  They are contagious, in the sense that when applied to an expression and a non-expression, the non-expression will be converted to an expression and the operator will be applied.  Only the most trivial algebraic simplications are applied.<table class="examples"><tr><td><pre>i18 : d + e

             5     4      3      2
o18 = - 4 + x  + 5x  + 10x  + 10x  + 5x + 1

o18 : Expression of class Sum</pre>
</td></tr>
<tr><td><pre>i19 : d + 4

o19 = - 4 + 4

o19 : Expression of class Sum</pre>
</td></tr>
<tr><td><pre>i20 : d / 4

      -4
o20 = --
       4

o20 : Expression of class Divide</pre>
</td></tr>
<tr><td><pre>i21 : d / 1

o21 = -4

o21 : Expression of class Minus</pre>
</td></tr>
<tr><td><pre>i22 : d == e

             5     4      3      2
o22 = -4 == x  + 5x  + 10x  + 10x  + 5x + 1

o22 : Expression of class Equation</pre>
</td></tr>
</table>
</div>
</div>
<div class="waystouse"><h2>Types of expression :</h2>
<ul><li><span><a href="___Adjacent.html" title="the class of all adjacent expression pairs">Adjacent</a> -- the class of all adjacent expression pairs</span></li>
<li><span><a href="___Associative__Expression.html" title="the class of associative expressions">AssociativeExpression</a> -- the class of associative expressions</span></li>
<li><span><a href="___Binary__Operation.html" title="the class of all binary operation expressions">BinaryOperation</a> -- the class of all binary operation expressions</span></li>
<li><span><a href="___Divide.html" title="the class of all divide expressions">Divide</a> -- the class of all divide expressions</span></li>
<li><span><a href="___Function__Application.html" title="the class of all function application expressions">FunctionApplication</a> -- the class of all function application expressions</span></li>
<li><span><a href="___Holder.html" title="the class of all holder expressions">Holder</a> -- the class of all holder expressions</span></li>
<li><span><a href="___Matrix__Expression.html" title="the class of all matrix expressions">MatrixExpression</a> -- the class of all matrix expressions</span></li>
<li><span><a href="___Minus.html" title="the class of all minus expressions">Minus</a> -- the class of all minus expressions</span></li>
<li><span><a href="___Non__Associative__Product.html" title="the class of all nonassociative product expressions">NonAssociativeProduct</a> -- the class of all nonassociative product expressions</span></li>
<li><span><a href="___Parenthesize.html" title="">Parenthesize</a></span></li>
<li><span><a href="___Power.html" title="the class of all power expressions">Power</a> -- the class of all power expressions</span></li>
<li><span><a href="___Row__Expression.html" title="the class of all matrix expressions">RowExpression</a> -- the class of all matrix expressions</span></li>
<li><span><a href="___Sparse__Monomial__Vector__Expression.html" title="the class of all sparse monomial vector expressions">SparseMonomialVectorExpression</a> -- the class of all sparse monomial vector expressions</span></li>
<li><span><a href="___Sparse__Vector__Expression.html" title="the class of all sparse vector expressions">SparseVectorExpression</a> -- the class of all sparse vector expressions</span></li>
<li><span><a href="___Subscript.html" title="the class of all subscript expressions">Subscript</a> -- the class of all subscript expressions</span></li>
<li><span><a href="___Superscript.html" title="the class of all superscript expressions">Superscript</a> -- the class of all superscript expressions</span></li>
<li><span><a href="___Table.html" title="the class of all table expressions">Table</a> -- the class of all table expressions</span></li>
</ul>
<h2>Functions and methods returning an expression :</h2>
<ul><li><span><a href="_expression.html" title="convert to an expression">expression</a> -- convert to an expression</span></li>
<li><span><a href="_hold.html" title="hold something in a holder expression">hold</a> -- hold something in a holder expression</span></li>
</ul>
<h2>Methods that use an expression :</h2>
<ul><li><span>Equation == Expression, see <span><a href="__eq_eq.html" title="equality">==</a> -- equality</span></span></li>
<li><span>Expression == Equation, see <span><a href="__eq_eq.html" title="equality">==</a> -- equality</span></span></li>
<li>- Expression</li>
<li>Expression * Expression</li>
<li>Expression ** Expression</li>
<li>Expression + Expression</li>
<li>Expression - Expression</li>
<li>Expression / Expression</li>
<li>Expression == Expression</li>
<li>Expression ^ Expression</li>
<li>Expression _ Expression</li>
<li>Expression Expression</li>
<li>value(Expression)</li>
<li><span><tt>Expression ..&lt; Expression</tt> (missing documentation<!-- tag: (..<,Expression,Expression) -->)</span></li>
<li><span><tt>Expression ..&lt; Holder</tt> (missing documentation<!-- tag: (..<,Expression,Holder) -->)</span></li>
<li><span><tt>Expression ..&lt; Thing</tt> (missing documentation<!-- tag: (..<,Expression,Thing) -->)</span></li>
<li><span><tt>Expression and Expression</tt> (missing documentation<!-- tag: (and,Expression,Expression) -->)</span></li>
<li><span><tt>Expression or Expression</tt> (missing documentation<!-- tag: (or,Expression,Expression) -->)</span></li>
<li><span><tt>Holder ..&lt; Expression</tt> (missing documentation<!-- tag: (..<,Holder,Expression) -->)</span></li>
<li><span><tt>Thing ..&lt; Expression</tt> (missing documentation<!-- tag: (..<,Thing,Expression) -->)</span></li>
</ul>
</div>
<div class="waystouse"><h2>For the programmer</h2>
<p>The object <a href="___Expression.html" title="the class of all expressions">Expression</a> is <span>a <a href="___Type.html">type</a></span>, with ancestor classes <a href="___Basic__List.html" title="the class of all basic lists">BasicList</a> &lt; <a href="___Thing.html" title="the class of all things">Thing</a>.</p>
</div>
</div>
</body>
</html>