Révision 81 pobysoPythonSage/src/sageSLZ/sagePolynomialOperations.sage
sagePolynomialOperations.sage (revision 81) | ||
---|---|---|
107 | 107 |
return(expressionAsString) |
108 | 108 |
# End spo_expression_as_string. |
109 | 109 |
|
110 |
def spo_norm(poly, degree): |
|
111 |
""" |
|
112 |
Behaves more or less (no infinity defined) as the norm for the |
|
113 |
univariate polynomials. |
|
114 |
Quoting the Sage documentation: |
|
115 |
Definition: For integer p, the p-norm of a polynomial is the pth root of |
|
116 |
the sum of the pth powers of the absolute values of the coefficients of |
|
117 |
the polynomial. |
|
118 |
""" |
|
119 |
# TODO: check the arguments. |
|
120 |
norm = 0 |
|
121 |
for coefficient in poly.coefficients(): |
|
122 |
norm += (coefficient^degree).abs() |
|
123 |
return pow(norm, 1/degree) |
|
124 |
# end spo_norm |
|
125 |
|
|
110 | 126 |
def spo_polynomial_to_matrix(p, pRing, alpha, N, columnsWidth=0): |
111 | 127 |
""" |
112 | 128 |
From a (bivariate) polynomial and some other parameters build a matrix |
... | ... | |
316 | 332 |
# End for pPower loop |
317 | 333 |
return protoMatrixRows |
318 | 334 |
# End spo_polynomial_to_matrix |
335 |
|
|
336 |
print "sagePolynomialOperations loaded..." |
Formats disponibles : Unified diff