Sophie

Sophie

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

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>basic rings of numbers</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_integers_spmodulo_spa_spprime.html">next</a> | <a href="_rings.html">previous</a> | <a href="_integers_spmodulo_spa_spprime.html">forward</a> | backward | <a href="_rings.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="_rings.html" title="">rings</a> > <a href="_basic_springs_spof_spnumbers.html" title="">basic rings of numbers</a></div>
<hr/>
<div><h1>basic rings of numbers</h1>
<div>The following rings are initially present in every session with Macaulay2.<ul><li><span><a href="___Z__Z.html" title="the class of all integers">ZZ</a> -- the class of all integers</span></li>
<li><span><a href="___Q__Q.html" title="the class of all rational numbers">QQ</a> -- the class of all rational numbers</span></li>
<li><span><a href="___R__R.html" title="the class of all real numbers">RR</a> -- the class of all real numbers</span></li>
<li><span><a href="___C__C.html" title="the class of all complex numbers">CC</a> -- the class of all complex numbers</span></li>
</ul>
The names of some of these rings are double letters so the corresponding symbols with single letters are preserved for use as variables.<p/>
Numbers in these rings are constructed as follows.<table class="examples"><tr><td><pre>i1 : 1234

o1 = 1234</pre>
</td></tr>
<tr><td><pre>i2 : 123/4

     123
o2 = ---
      4

o2 : QQ</pre>
</td></tr>
<tr><td><pre>i3 : 123.4

o3 = 123.4

o3 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i4 : 1.234e-20

o4 = 1.234e-20

o4 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i5 : 123+4*ii

o5 = 123+4*ii

o5 : CC (of precision 53)</pre>
</td></tr>
</table>
The usual arithmetic operations are available.<table class="examples"><tr><td><pre>i6 : 4/5 + 2/3

     22
o6 = --
     15

o6 : QQ</pre>
</td></tr>
<tr><td><pre>i7 : 10^20

o7 = 100000000000000000000</pre>
</td></tr>
<tr><td><pre>i8 : 3*5*7

o8 = 105</pre>
</td></tr>
<tr><td><pre>i9 : 3.1^2.1

o9 = 10.7611716060997

o9 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i10 : sqrt 3.

o10 = 1.73205080756888

o10 : RR (of precision 53)</pre>
</td></tr>
</table>
An additional pair of division operations that produce integer quotients and remainders is available.<table class="examples"><tr><td><pre>i11 : 1234//100

o11 = 12</pre>
</td></tr>
<tr><td><pre>i12 : 1234%100

o12 = 34</pre>
</td></tr>
</table>
Numbers can be promoted to larger rings as follows, see <a href="_promote.html" title="promote to another ring">RingElement _ Ring</a>.<table class="examples"><tr><td><pre>i13 : 1_QQ

o13 = 1

o13 : QQ</pre>
</td></tr>
<tr><td><pre>i14 : (2/3)_CC

o14 = .666666666666667

o14 : CC (of precision 53)</pre>
</td></tr>
</table>
One way to enter real and complex numbers with more precision is to insert the desired number of bits of precision after the letter p at the end of the number, but before the possible e that indicates the exponent of 10.<table class="examples"><tr><td><pre>i15 : 1p300

o15 = 1

o15 : RR (of precision 300)</pre>
</td></tr>
<tr><td><pre>i16 : 1p300e-30

o16 = 1e-30

o16 : RR (of precision 300)</pre>
</td></tr>
</table>
Numbers can be lifted to smaller rings as follows, see <a href="_lift.html" title="lift to another ring">lift</a>.<table class="examples"><tr><td><pre>i17 : x = 2/3*ii/ii

o17 = .666666666666667

o17 : CC (of precision 53)</pre>
</td></tr>
<tr><td><pre>i18 : lift(x,RR)

o18 = .666666666666667

o18 : RR (of precision 53)</pre>
</td></tr>
<tr><td><pre>i19 : lift(x,QQ)

      2
o19 = -
      3

o19 : QQ</pre>
</td></tr>
</table>
</div>
</div>
</body>
</html>