# Singular

#### D.15.10.9 grpower

Procedure from library `gradedModules.lib` (see gradedModules_lib).

Usage:
grpower(A, p), graded object A, int p > 0

Return:

Purpose:
compute the graded direct power A^p

Note:
the power p must be positive

Example:
 ```LIB "gradedModules.lib"; ring r=32003,(x,y,z),dp; module A = grobj( module([x+y, x, 0], [0, x+y, y]), intvec(1,1,1) ); grview(A); ==> 1 2 ==> -------- ==> 1 : 1 . | 1 ==> 1 : 1 1 | 2 ==> 1 : . 1 | 3 ==> ======== ==> 2 2 module B = grobj( module([x,y]), intvec(2,2) ); grview(B); ==> 1 ==> --- ==> 2 : 1 | 1 ==> 2 : 1 | 2 ==> === ==> 3 module D = grsum( grpower(A,2), grpower(B,2) ); print(D); ==> x+y,0, 0, 0, 0,0, ==> x, x+y,0, 0, 0,0, ==> 0, y, 0, 0, 0,0, ==> 0, 0, x+y,0, 0,0, ==> 0, 0, x, x+y,0,0, ==> 0, 0, 0, y, 0,0, ==> 0, 0, 0, 0, x,0, ==> 0, 0, 0, 0, y,0, ==> 0, 0, 0, 0, 0,x, ==> 0, 0, 0, 0, 0,y homog(D); ==> 1 grview(D); ==> 1 2 3 4 5 6 ==> ------------------------ ==> 1 : 1 . . . . . | 1 ==> 1 : 1 1 . . . . | 2 ==> 1 : . 1 . . . . | 3 ==> 1 : . . 1 . . . | 4 ==> 1 : . . 1 1 . . | 5 ==> 1 : . . . 1 . . | 6 ==> 2 : . . . . 1 . | 7 ==> 2 : . . . . 1 . | 8 ==> 2 : . . . . . 1 | 9 ==> 2 : . . . . . 1 | 10 ==> ======================== ==> 2 2 2 2 3 3 ```