<?xml version="1.0" encoding="utf-8" standalone="no"?><?xml-stylesheet href="/mathmlc2p.xsl" type="text/xsl"?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>cyclic</title>
</head>
<body>
<tt>
// This is to demonstrate the use of the JSCL API from a java shell interpreter<br/>
<br/>
import jscl.math.Debug;<br/>
import jscl.math.Generic;<br/>
import jscl.math.Variable;<br/>
import jscl.math.polynomial.Basis;<br/>
import jscl.math.polynomial.Monomial;<br/>
static import jscl.math.Predef.*;<br/>
<br/>
Debug.setOutputStream(System.out);<br/>
<br/>
int n=4;<br/>
v=new Variable[n];<br/>
a=new Generic[n];<br/>
for(i=0;i&lt;n;i++) v[i]=variable(new Character((char)('a'+i)).toString()).variableValue();<br/>
for(i=0;i&lt;n;i++) {<br/>
        a[i]=integer(&quot;0&quot;);<br/>
        for(j=0;j&lt;(i&lt;n-1?n:1);j++) {<br/>
                s=integer(&quot;1&quot;);<br/>
                for(k=0;k&lt;=i;k++) s=s.multiply(v[(j+k)%n].expressionValue());<br/>
                a[i]=a[i].add(s);<br/>
        }<br/>
        if(i==n-1) a[i]=a[i].subtract(variable(&quot;t&quot;).pow(0));<br/>
}<br/>
t=System.currentTimeMillis();<br/>
b=Basis.compute(a,Basis.augmentUnknown(v,a),Monomial.degreeReverseLexicographic,0);<br/>
t=System.currentTimeMillis()-t;<br/>
print(b);<br/>
print(t);<br/>
</tt>
</body>
</html>
