products/Sources/formale Sprachen/GAP/pkg/normalizinterface/doc/chap3_mj.html
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd " >
<html xmlns="http://www.w3.org/1999/xhtml " xml:lang="en" >
<head >
<script type="text/javascript"
src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML " >
</script >
<title >GAP (NormalizInterface) - Chapter 3: Examples</title >
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript" ></script >
<script type="text/javascript" >overwriteStyle();</script >
</head >
<body class="chap3" onload="jscontent()" >
<div class="chlinktop" ><span class="chlink1" >Goto Chapter: </span ><a href="chap0_mj.html" >Top</a> <a href="chap1_mj.html" >1</a> <a href="chap2_mj.html" >2</a> <a href="chap3_mj.html" >3</a> <a href="chap4_mj.html" >4</a> <a href="chapBib_mj.html" >Bib</a> <a href="chapInd_mj.html" >Ind</a> </div >
<div class="chlinkprevnexttop" > <a href="chap0_mj.html" >[Top of Book]</a> <a href="chap0_mj.html#contents" >[Contents]</a> <a href="chap2_mj.html" >[Previous Chapter]</a> <a href="chap4_mj.html" >[Next Chapter]</a> </div >
<p id="mathjaxlink" class="pcenter" ><a href="chap3.html" >[MathJax off]</a></p>
<p><a id="X7A489A5D79DA9E5C" name="X7A489A5D79DA9E5C" ></a></p>
<div class="ChapSects" ><a href="chap3_mj.html#X7A489A5D79DA9E5C" >3 <span class="Heading" >Examples</span ></a>
<div class="ContSect" ><span class="tocline" ><span class="nocss" > </span ><a href="chap3_mj.html#X7BD5B55C802805B4" >3.1 <span class="Heading" >Generators</span ></a>
</span >
</div >
<div class="ContSect" ><span class="tocline" ><span class="nocss" > </span ><a href="chap3_mj.html#X872A3FB37D6D7DFE" >3.2 <span class="Heading" >System of equations</span ></a>
</span >
</div >
<div class="ContSect" ><span class="tocline" ><span class="nocss" > </span ><a href="chap3_mj.html#X8570F3C87B5B7DD7" >3.3 <span class="Heading" >System of inhomogeneous equations</span ></a>
</span >
</div >
<div class="ContSect" ><span class="tocline" ><span class="nocss" > </span ><a href="chap3_mj.html#X7B191A1778012C1D" >3.4 <span class="Heading" >Combined input </span ></a>
</span >
</div >
<div class="ContSect" ><span class="tocline" ><span class="nocss" > </span ><a href="chap3_mj.html#X8406B01578B99D14" >3.5 <span class="Heading" >Using the dual mode</span ></a>
</span >
</div >
</div >
<h3>3 <span class="Heading" >Examples</span ></h3>
<p><a id="X7BD5B55C802805B4" name="X7BD5B55C802805B4" ></a></p>
<h4>3.1 <span class="Heading" >Generators</span ></h4>
<div class="example" ><pre >
<span class="GAPprompt" >gap></span > <span class="GAPinput" >C := NmzCone(["integral_closure" ,[[2,1],[1,3]]]);</span >
<a Normaliz cone>
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHasConeProperty(C,"HilbertBasis" );</span >
false
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHasConeProperty(C,"SupportHyperplanes" );</span >
false
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzConeProperty(C,"HilbertBasis" );</span >
[ [ 1, 1 ], [ 1, 2 ], [ 1, 3 ], [ 2, 1 ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHasConeProperty(C,"SupportHyperplanes" );</span >
true
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzConeProperty(C,"SupportHyperplanes" );</span >
[ [ -1, 2 ], [ 3, -1 ] ]
</pre ></div >
<p><a id="X872A3FB37D6D7DFE" name="X872A3FB37D6D7DFE" ></a></p>
<h4>3.2 <span class="Heading" >System of equations</span ></h4>
<div class="example" ><pre >
<span class="GAPprompt" >gap></span > <span class="GAPinput" >D := NmzCone(["equations" ,[[1,2,-3]], "grading" ,[[0,-1,3]]]);</span >
<a Normaliz cone>
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzCompute(D,["DualMode" ,"HilbertSeries" ]);</span >
true
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertBasis(D);</span >
[ [ 1, 1, 1 ], [ 0, 3, 2 ], [ 3, 0, 1 ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertSeries(D);</span >
[ t^2-t+1, [ [ 1, 1 ], [ 3, 1 ] ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHasConeProperty(D,"SupportHyperplanes" );</span >
true
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzSupportHyperplanes(D);</span >
[ [ 0, 1, 0 ], [ 1, 0, 0 ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzEquations(D);</span >
[ [ 1, 2, -3 ] ]
</pre ></div >
<p><a id="X8570F3C87B5B7DD7" name="X8570F3C87B5B7DD7" ></a></p>
<h4>3.3 <span class="Heading" >System of inhomogeneous equations</span ></h4>
<div class="example" ><pre >
<span class="GAPprompt" >gap></span > <span class="GAPinput" >P := NmzCone(["inhom_equations" ,[[1,2,-3,1]], "grading" , [[1,1,1]]]);</span >
<a Normaliz cone>
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzIsInhomogeneous(C);</span >
false
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzIsInhomogeneous(P);</span >
true
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertBasis(P);</span >
[ [ 1, 1, 1, 0 ], [ 3, 0, 1, 0 ], [ 0, 3, 2, 0 ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzModuleGenerators(P);</span >
[ [ 0, 1, 1, 1 ], [ 2, 0, 1, 1 ] ]
</pre ></div >
<p><a id="X7B191A1778012C1D" name="X7B191A1778012C1D" ></a></p>
<h4>3.4 <span class="Heading" >Combined input </span ></h4>
<p>Normaliz also allows the combination of different kinds of input , e.g. multiple constraint types, or additional data like a grading.</p>
<p>Suppose that you have a 3 by 3 <q>square</q> of nonnegative integers such that the 3 numbers in all rows, all columns, and both diagonals sum to the same constant <span class="SimpleMath" >\(M\)</span >. Sometimes such squares are called magic and <span class="SimpleMath" >\(M\)</span > is the magic constant. This leads to a linear system of equations. The magic constant is a natural choice for the grading. Additionally we force here the 4 corner to have even value by adding congruences.</p>
<div class="example" ><pre >
<span class="GAPprompt" >gap></span > <span class="GAPinput" >Magic3x3even := NmzCone(["equations" ,</span >
<span class="GAPprompt" >></span > <span class="GAPinput" >[ [1, 1, 1, -1, -1, -1, 0, 0, 0],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [1, 1, 1, 0, 0, 0, -1, -1, -1],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [0, 1, 1, -1, 0, 0, -1, 0, 0],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [1, 0, 1, 0, -1, 0, 0, -1, 0],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [1, 1, 0, 0, 0, -1, 0, 0, -1],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [0, 1, 1, 0, -1, 0, 0, 0, -1],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [1, 1, 0, 0, -1, 0, -1, 0, 0] ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" >"congruences" ,</span >
<span class="GAPprompt" >></span > <span class="GAPinput" >[ [1, 0, 0, 0, 0, 0, 0, 0, 0, 2],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [0, 0, 1, 0, 0, 0, 0, 0, 0, 2],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [0, 0, 0, 0, 0, 0, 1, 0, 0, 2],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [0, 0, 0, 0, 0, 0, 0, 0, 1, 2] ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" >"grading" ,</span >
<span class="GAPprompt" >></span > <span class="GAPinput" >[ [1, 1, 1, 0, 0, 0, 0, 0, 0] ] ] );</span >
<a Normaliz cone>
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertBasis(Magic3x3even);</span >
[ [ 0, 4, 2, 4, 2, 0, 2, 0, 4 ], [ 2, 0, 4, 4, 2, 0, 0, 4, 2 ],
[ 2, 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 4, 0, 0, 2, 4, 4, 0, 2 ],
[ 4, 0, 2, 0, 2, 4, 2, 4, 0 ], [ 2, 3, 4, 5, 3, 1, 2, 3, 4 ],
[ 2, 5, 2, 3, 3, 3, 4, 1, 4 ], [ 4, 1, 4, 3, 3, 3, 2, 5, 2 ],
[ 4, 3, 2, 1, 3, 5, 4, 3, 2 ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertSeries(Magic3x3even);</span >
[ t^3+3*t^2-t+1, [ [ 1, 1 ], [ 2, 2 ] ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertQuasiPolynomial(Magic3x3even);</span >
[ 1/2*t^2+t+1, 1/2*t^2-1/2 ]
</pre ></div >
<p><a id="X8406B01578B99D14" name="X8406B01578B99D14" ></a></p>
<h4>3.5 <span class="Heading" >Using the dual mode</span ></h4>
<p>For solving systems of equations and inequalities it is often faster to use the dual Normaliz algorithm. We demonstrate how to use it with an inhomogeneous system of equations and inequalities.</p>
<p>The input consists of a system of 8 inhomogeneous equations in R^3. The first row of the matrix M encodes the inequality <span class="SimpleMath" >\(8x + 8y + 8z + 7 \geq 0\)</span >. Additionally we say that <span class="SimpleMath" >\(x, y, z\)</span > should be non-negative by giving the sign vector and use the total degree.</p>
<div class="example" ><pre >
<span class="GAPprompt" >gap></span > <span class="GAPinput" >M := [</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 8, 8, 8, 7 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 0, 4, 0, 1 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 0, 1, 0, 7 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 0, -2, 0, 7 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 0, -2, 0, 1 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 8, 48, 8, 17 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 1, 6, 1, 34 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 2,-12, -2, 37 ],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > [ 4,-24, -4, 14 ]</span >
<span class="GAPprompt" >></span > <span class="GAPinput" >];;</span >
<span class="GAPprompt" >gap></span > <span class="GAPinput" >D := NmzCone(["inhom_inequalities" , M,</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > "signs" , [[1,1,1]],</span >
<span class="GAPprompt" >></span > <span class="GAPinput" > "grading" , [[1,1,1]]]);</span >
<a Normaliz cone>
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzCompute(D,["DualMode" ,"HilbertBasis" ,"ModuleGenerators" ]);</span >
true
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzHilbertBasis(D);</span >
[ [ 1, 0, 0, 0 ], [ 1, 0, 1, 0 ] ]
<span class="GAPprompt" >gap></span > <span class="GAPinput" >NmzModuleGenerators(D);</span >
[ [ 0, 0, 0, 1 ], [ 0, 0, 1, 1 ], [ 0, 0, 2, 1 ], [ 0, 0, 3, 1 ] ]
</pre ></div >
<p>As result we get the Hilbert basis of the cone of the solutions to the homogeneous system and the module generators which are the base solutions to the inhomogeneous system.</p>
<div class="chlinkprevnextbot" > <a href="chap0_mj.html" >[Top of Book]</a> <a href="chap0_mj.html#contents" >[Contents]</a> <a href="chap2_mj.html" >[Previous Chapter]</a> <a href="chap4_mj.html" >[Next Chapter]</a> </div >
<div class="chlinkbot" ><span class="chlink1" >Goto Chapter: </span ><a href="chap0_mj.html" >Top</a> <a href="chap1_mj.html" >1</a> <a href="chap2_mj.html" >2</a> <a href="chap3_mj.html" >3</a> <a href="chap4_mj.html" >4</a> <a href="chapBib_mj.html" >Bib</a> <a href="chapInd_mj.html" >Ind</a> </div >
<hr />
<p class="foot" >generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc " >GAPDoc2HTML</a></p>
</body >
</html >
quality 100%
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
*© Formatika GbR, Deutschland