<?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>clean -- Set to zero elements that are approximately zero</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_clear__All.html">next</a> | <a href="___Check__Documentation.html">previous</a> | <a href="_clear__All.html">forward</a> | <a href="___Check__Documentation.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>clean -- Set to zero elements that are approximately zero</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>clean(epsilon,M)</tt><br/><tt>clean_epsilon M</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><li><span><tt>epsilon</tt>, <span>a <a href="___R__R.html">real number</a></span></span></li> <li><span><tt>M</tt>, <span>a <a href="___Matrix.html">matrix</a></span>, or a <span>a <a href="___Ring__Element.html">ring element</a></span></span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><span>a <a href="___Matrix.html">matrix</a></span>, or <span>a <a href="___Ring__Element.html">ring element</a></span></span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div><p>If the input is <span>a <a href="___Matrix.html">matrix</a></span> or <span>a <a href="___Ring__Element.html">ring element</a></span>, then the result has the same type, where each real or complex number coefficient that is less than <tt>epsilon</tt> in absolute value is replaced with zero.</p> <table class="examples"><tr><td><pre>i1 : e = 1e-11;</pre> </td></tr> <tr><td><pre>i2 : M = random(RR^4,RR^4) o2 = | .142767 .650468 .34431 .831079 | | .344396 .477573 .35125 .50691 | | .249144 .62852 .344489 .741366 | | .0586825 .0463371 .60071 .690786 | 4 4 o2 : Matrix RR <--- RR 53 53</pre> </td></tr> <tr><td><pre>i3 : M * (M + 1) + 1 - M^2 - M o3 = | 1 0 0 -1.11022e-16 | | 0 1 1.11022e-16 0 | | 5.55112e-17 -1.11022e-16 1 1.11022e-16 | | 2.77556e-17 0 -1.11022e-16 1 | 4 4 o3 : Matrix RR <--- RR 53 53</pre> </td></tr> <tr><td><pre>i4 : clean_e oo o4 = | 1 0 0 0 | | 0 1 0 0 | | 0 0 1 0 | | 0 0 0 1 | 4 4 o4 : Matrix RR <--- RR 53 53</pre> </td></tr> </table> Cleaning a polynomial is a way to get rid of small terms.<table class="examples"><tr><td><pre>i5 : CC[x];</pre> </td></tr> <tr><td><pre>i6 : f = product(5,j -> x - exp(2*pi*j*ii/5)) 5 4 3 o6 = x + (2.22045e-16 - 1.11022e-16*ii)x - 1.11022e-16*ii*x + (- ------------------------------------------------------------------------ 2 1.11022e-16 - 1.11022e-16*ii)x - 1.11022e-16*ii*x - 1 + 5.55112e-16*ii o6 : CC [x] 53</pre> </td></tr> <tr><td><pre>i7 : clean_e f 5 o7 = x - 1 o7 : CC [x] 53</pre> </td></tr> </table> </div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_norm.html" title="">norm</a></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> <li><span><a href="_fill__Matrix.html" title="fill a mutable matrix with random numbers">fillMatrix</a> -- fill a mutable matrix with random numbers</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>clean</tt> :</h2> <ul><li>clean(RR,Matrix)</li> <li>clean(RR,MutableMatrix)</li> <li>clean(RR,Number)</li> <li>clean(RR,RingElement)</li> </ul> </div> </div> </body> </html>