Sophie

Sophie

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

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>using functions with optional inputs</title>
<link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/>
</head>
<body>
<table class="buttons">
  <tr>
    <td><div><a href="_making_spfunctions.html">next</a> | <a href="_using_spfunctions.html">previous</a> | <a href="_making_spfunctions.html">forward</a> | <a href="_using_spfunctions.html">backward</a> | <a href="___The_sp__Macaulay2_splanguage.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="___The_sp__Macaulay2_splanguage.html" title="">The Macaulay2 language</a> > <a href="_using_spfunctions_spwith_spoptional_spinputs.html" title="">using functions with optional inputs</a></div>
<hr/>
<div><h1>using functions with optional inputs</h1>
<div>Some functions accept optional inputs in addition to their required inputs.  In the documentation, such an optional input is indicated by writing <tt>NAME => ...</tt>, where <tt>NAME</tt> is the name of the optional input, and the dots indicate the place where the user will provide the value of the optional input.<p/>
Optional inputs can be provided between parentheses along with the other inputs (or arguments) of the function.  For example, if the function is normally used with two required inputs, then instead of typing <tt>f(x,y)</tt>, you may type <tt>f(x,y,FOO => t, BAR => u)</tt>, where <tt>t</tt> is the value to be provided to <tt>f</tt> as the value of the optional input named <tt>FOO</tt> and <tt>u</tt> is the value to be provided to <tt>f</tt> as the value of the optional input named <tt>BAR</tt>.<p/>
The optional inputs can be inserted in any order, and may even occur before the required inputs.  If more than one optional input with the same option name are given, then the value accompanying the right-most one is the value provided to the function.<p/>
Use <a href="_options_lp__Function_rp.html">options</a> to discover the optional arguments accepted by a function.<table class="examples"><tr><td><pre>i1 : R = ZZ/101[x,y,z,w];</pre>
</td></tr>
<tr><td><pre>i2 : gb ideal(x*y-z^2,y^2-w^2)

o2 = GroebnerBasis[status: done; S-pairs encountered up to degree 4]

o2 : GroebnerBasis</pre>
</td></tr>
<tr><td><pre>i3 : gens oo

o3 = | y2-w2 xy-z2 yz2-xw2 z4-x2w2 |

             1       4
o3 : Matrix R  &lt;--- R</pre>
</td></tr>
</table>
One of the optional arguments for <a href="_gb.html" title="compute a Gröbner basis">gb</a> is named <a href="___Degree__Limit.html" title="name for an optional argument">DegreeLimit</a>; we may use <a href="_options_lp__Function_rp.html">options</a> to discover that, as follows.<table class="examples"><tr><td><pre>i4 : options gb

o4 = OptionTable{Algorithm => Inhomogeneous        }
                 BasisElementLimit => infinity
                 ChangeMatrix => false
                 CodimensionLimit => infinity
                 DegreeLimit => {}
                 GBDegrees => null
                 HardDegreeLimit => null
                 Hilbert => null
                 MaxReductionCount => 10
                 PairLimit => infinity
                 StopBeforeComputation => false
                 StopWithMinimalGenerators => false
                 Strategy => {}
                 SubringLimit => infinity
                 Syzygies => false
                 SyzygyLimit => infinity
                 SyzygyRows => infinity

o4 : OptionTable</pre>
</td></tr>
</table>
The optional input named <a href="___Degree__Limit.html" title="name for an optional argument">DegreeLimit</a> can be used to specify that the computation should stop after a certain degree has been reached.<table class="examples"><tr><td><pre>i5 : gb(ideal(x*y-z^2,y^2-w^2), DegreeLimit => 2)

o5 = GroebnerBasis[status: DegreeLimit; all S-pairs handled up to degree 2]

o5 : GroebnerBasis</pre>
</td></tr>
<tr><td><pre>i6 : gens oo

o6 = | y2-w2 xy-z2 |

             1       2
o6 : Matrix R  &lt;--- R</pre>
</td></tr>
</table>
<h2>Programming hint</h2>
<p>The value returned by <a href="_options_lp__Function_rp.html">options</a> is a type of hash table that can be used to obtain default values.</p>
<p>See also <a href="_making_spnew_spfunctions_spwith_spoptional_sparguments.html" title="">making new functions with optional arguments</a>.</p>
<table class="examples"><tr><td><pre>i7 : (options gb).Syzygies

o7 = false</pre>
</td></tr>
</table>
</div>
</div>
</body>
</html>