Changeset 2271063 in git


Ignore:
Timestamp:
Aug 31, 2018, 3:44:43 PM (5 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
Children:
5292886b6f6adce1c6a27dacf4fe27712caac11f5c67260d24e1d3b531a24492a610c49608477ba9
Parents:
a83d208fed33c8c5dd5ae7c36fca503e8b225ee7
Message:
Bring back lpPower for now
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/freegb.lib

    ra83d20 r2271063  
    2323
    2424shiftPoly(p,i); compute the i-th shift of letterplace polynomial p
     25lpPower(f,n);   natural power of a letterplace polynomial
    2526lieBracket(a,b[, N]);  compute Lie bracket ab-ba of two letterplace polynomials
    2627
     
    6263  /* secondary */
    6364  example   shiftPoly;
     65  example   lpPower;
    6466  example   lieBracket;
    6567  example   lp2lstr;
     
    32053207//   lpMult(a,b);
    32063208// }
    3207 //
    3208 // proc lpPower(poly f, int n)
    3209 // "USAGE:  lpPower(f,n); f letterplace polynomial, int n
    3210 // RETURN:  poly
    3211 // ASSUME: basering has a letterplace ring structure
    3212 // PURPOSE: compute the letterplace form of f^n
    3213 // EXAMPLE: example lpPower; shows examples
    3214 // "
    3215 // {
    3216 //   if (n<0) { ERROR("the power must be a natural number!"); }
    3217 //   if (n==0) { return(poly(1)); }
    3218 //   if (n==1) { return(f); }
    3219 //   int i;
    3220 //   poly p = 1;
    3221 //   for(i=1; i<= n; i++)
    3222 //   {
    3223 //     p = lpMult(p,f);
    3224 //   }
    3225 //   return(p);
    3226 // }
    3227 // example
    3228 // {
    3229 //   "EXAMPLE:"; echo = 2;
    3230 //   // define a ring in letterplace form as follows:
    3231 //   ring r = 0,(x(1),y(1),x(2),y(2),x(3),y(3),x(4),y(4)),dp;
    3232 //   def R = setLetterplaceAttributes(r,4,2); // supply R with letterplace structure
    3233 //   setring R;
    3234 //   poly a = x(1)*y(2) + y(1); poly b = y(1) - 1;
    3235 //   lpPower(a,2);
    3236 //   lpPower(b,4);
    3237 // }
     3209
     3210proc lpPower(poly f, int n)
     3211"USAGE:  lpPower(f,n); f letterplace polynomial, int n
     3212RETURN:  poly
     3213ASSUME: basering has a letterplace ring structure
     3214PURPOSE: compute the letterplace form of f^n
     3215EXAMPLE: example lpPower; shows examples
     3216"
     3217{
     3218  if (n<0) { ERROR("the power must be a natural number!"); }
     3219  if (n==0) { return(poly(1)); }
     3220  if (n==1) { return(f); }
     3221  poly p = 1;
     3222  for(int i = 1; i <= n; i++)
     3223  {
     3224    p = p*f;
     3225  }
     3226  return(p);
     3227}
     3228example
     3229{
     3230  "EXAMPLE:"; echo = 2;
     3231  // define a ring in letterplace form as follows:
     3232  ring r = 0,(x(1),y(1),x(2),y(2),x(3),y(3),x(4),y(4)),dp;
     3233  def R = setLetterplaceAttributes(r,4,2); // supply R with letterplace structure
     3234  setring R;
     3235  poly a = x(1)*y(2) + y(1); poly b = y(1) - 1;
     3236  lpPower(a,2);
     3237  lpPower(b,4);
     3238}
    32383239
    32393240// new: lp normal from by using shift-invariant data by Grischa Studzinski
Note: See TracChangeset for help on using the changeset viewer.