Sophie

Sophie

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

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>Singular Book 1.1.8 -- computation in fields</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="___Singular_sp__Book_sp1.1.9.html">next</a> | <a href="___M2__Singular__Book.html">previous</a> | <a href="___Singular_sp__Book_sp1.1.9.html">forward</a> | backward | <a href="___M2__Singular__Book.html">up</a> | <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>
<div><a href="index.html" title="">Macaulay2Doc</a> > <a href="_basic_spcommutative_spalgebra.html" title="">basic commutative algebra</a> > <a href="___M2__Singular__Book.html" title="Macaulay2 examples for the Singular book">M2SingularBook</a> > <a href="___Singular_sp__Book_sp1.1.8.html" title="computation in fields">Singular Book 1.1.8</a></div>
<hr/>
<div><h1>Singular Book 1.1.8 -- computation in fields</h1>
<div><h2>Computation over ZZ and QQ</h2>
In Macaulay2, Integers are arbitary precision.  The ring of integers is denoted ZZ.<table class="examples"><tr><td><pre>i1 : 123456789^5

o1 = 28679718602997181072337614380936720482949</pre>
</td></tr>
<tr><td><pre>i2 : matrix{{123456789^5}}

o2 = | 28679718602997181072337614380936720482949 |

              1        1
o2 : Matrix ZZ  &lt;--- ZZ</pre>
</td></tr>
<tr><td><pre>i3 : gcd(3782621293644611237896400,85946734897630958700)

o3 = 100</pre>
</td></tr>
</table>
The ring of rational numbers is denoted by QQ.<table class="examples"><tr><td><pre>i4 : n = 12345/6789

     4115
o4 = ----
     2263

o4 : QQ</pre>
</td></tr>
<tr><td><pre>i5 : n^5

     1179910858126071875
o5 = -------------------
      59350279669807543

o5 : QQ</pre>
</td></tr>
<tr><td><pre>i6 : toString(n^5)

o6 = 1179910858126071875/59350279669807543</pre>
</td></tr>
</table>
<h2>Computation in finite fields</h2>
<table class="examples"><tr><td><pre>i7 : A = ZZ/32003;</pre>
</td></tr>
</table>
In order to do arithmetic in this ring, you must construct elements of this ring.  <tt>n_A</tt> gives the image of the integer n in A.<table class="examples"><tr><td><pre>i8 : 123456789 * 1_A

o8 = -10785

o8 : A</pre>
</td></tr>
<tr><td><pre>i9 : (123456789_A)^5

o9 = 8705

o9 : A</pre>
</td></tr>
</table>
<table class="examples"><tr><td><pre>i10 : A2 = GF(8,Variable=>a)

o10 = A2

o10 : GaloisField</pre>
</td></tr>
<tr><td><pre>i11 : ambient A2

         ZZ
         --[a]
          2
o11 = ----------
       3
      a  + a + 1

o11 : QuotientRing</pre>
</td></tr>
<tr><td><pre>i12 : a^3+a+1

o12 = 0

o12 : A2</pre>
</td></tr>
</table>
<table class="examples"><tr><td><pre>i13 : A3 = ZZ/2[a]/(a^20+a^3+1);</pre>
</td></tr>
<tr><td><pre>i14 : n = a+a^2

       2
o14 = a  + a

o14 : A3</pre>
</td></tr>
<tr><td><pre>i15 : n^5

       10    9    6    5
o15 = a   + a  + a  + a

o15 : A3</pre>
</td></tr>
</table>
<h2>Computing with real and complex numbers</h2>
<table class="examples"><tr><td><pre>i16 : n = 123456789.0

o16 = 123456789

o16 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i17 : n = n * 1_RR

o17 = 123456789

o17 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i18 : n^5

o18 = 2.86797186029972e40

o18 : RR (of precision 53)</pre>
</td></tr>
</table>
<h2>Computing with parameters</h2>
<table class="examples"><tr><td><pre>i19 : R3 = frac(ZZ[a,b,c])

o19 = R3

o19 : FractionField</pre>
</td></tr>
<tr><td><pre>i20 : n = 12345*a + 12345/(78*b*c)

      320970a*b*c + 4115
o20 = ------------------
             26b*c

o20 : R3</pre>
</td></tr>
<tr><td><pre>i21 : n^2

                   2 2 2
      103021740900a b c  + 2641583100a*b*c + 16933225
o21 = -----------------------------------------------
                              2 2
                          676b c

o21 : R3</pre>
</td></tr>
<tr><td><pre>i22 : n/(9*c)

      320970a*b*c + 4115
o22 = ------------------
                  2
            234b*c

o22 : R3</pre>
</td></tr>
</table>
</div>
</div>
</body>
</html>