Module: sage.rings.polynomial.multi_polynomial_element
Multivariate Polynomials
Author Log:
f[1,3]
to get coeff of R.(x,y) = PolynomialRing(QQ,2) notation
.
We verify Lagrange's four squares identity:
sage: R.<a0,a1,a2,a3,b0,b1,b2,b3> = ZZ[] sage: (a0^2 + a1^2 + a2^2 + a3^2)*(b0^2 + b1^2 + b2^2 + b3^2) == (a0*b0 - a1*b1 - a2*b2 - a3*b3)^2 + (a0*b1 + a1*b0 + a2*b3 - a3*b2)^2 + (a0*b2 - a1*b3 + a2*b0 + a3*b1)^2 + (a0*b3 + a1*b2 - a2*b1 + a3*b0)^2 True
Module-level Functions
r, x) |
Input:
NOTES: This function is dependent on the ordering of a python dict. Thus, it isn't really mathematically well-defined. I think that it should made a method of the FractionFieldElement class and rewritten.
sage: R1 = PolynomialRing(FiniteField(5), 3, names = ["a","b","c"]) sage: F = FractionField(R1) sage: a,b,c = R1.gens() sage: f = 3*a*b^2*c^3+4*a*b*c sage: g = a^2*b*c^2+2*a^2*b^4*c^7
Consider the quotient
(note
the cancellation).
sage: r = f/g; r (-2*b*c^2 - 1)/(2*a*b^3*c^6 + a*c) sage: degree_lowest_rational_function(r,a) (-1, 3) sage: degree_lowest_rational_function(r,b) (0, 4) sage: degree_lowest_rational_function(r,c) (-1, 4)
x) |
Class: MPolynomial_element
self, parent, x) |
Functions: change_ring,
element
Special Functions: __call__,
__cmp__,
__init__,
__rpow__,
_add_,
_div_,
_im_gens_,
_lmul_,
_mul_,
_repr_,
_rmul_,
_sub_
self) |
Evaluate this multi-variate polynomial at
, where
is
either the tuple of values to substitute in, or one can use
functional notation
to evaluate
with the ith variable replaced by
.
sage: R.<x,y> = QQ[] sage: f = x^2 + y^2 sage: f(1,2) 5 sage: f((1,2)) 5
sage: x = PolynomialRing(QQ,3,'x').gens() sage: f = x[0] + x[1] - 2*x[1]*x[2] sage: f -2*x1*x2 + x0 + x1 sage: f(1,2,0) 3 sage: f(1,2,5) -17
Author: David Kohel, 2005-09-27
self, right) |
Compares right to self with respect to the term order of self.parent().
sage: R.<x,y,z>=PolynomialRing(GF(7),3,order='lex') sage: x^1*y^2 > y^3*z^4 True sage: x^3*y^2*z^4 < x^3*y^2*z^1 False
sage: R.<x,y,z>=PolynomialRing(QQ,3,order='deglex') sage: x^1*y^2*z^3 > x^3*y^2*z^0 True sage: x^1*y^2*z^4 < x^1*y^1*z^5 False
sage: R.<x,y,z>=PolynomialRing(ZZ,3,order='degrevlex') sage: x^1*y^5*z^2 > x^4*y^1*z^3 True sage: x^4*y^7*z^1 < x^4*y^2*z^3 False
self, right) |
sage: R.<x,y> = QQ['x,y'] sage: f = (x + y)/3 sage: f.parent() Multivariate Polynomial Ring in x, y over Rational Field
If we do the same over
the result is the same as
multiplying by 1/3 (i.e. base extension).
sage: R.<x,y> = ZZ[] sage: f = (x + y)/3 sage: f.parent() Multivariate Polynomial Ring in x, y over Rational Field sage: f = (x + y) * 1/3 sage: f.parent() Multivariate Polynomial Ring in x, y over Rational Field
But we get a true fraction field if the denominator is not in the fration field of the basering.
sage: f = x/y sage: f.parent() Fraction Field of Multivariate Polynomial Ring in x, y over Integer Ring
self, codomain, im_gens) |
sage: R.<x,y> = PolynomialRing(QQ, 2) sage: f = R.hom([y,x], R) sage: f(x^2 + 3*y^5) 3*x^5 + y^2
self, a) |
Left Scalar Multiplication
Note that it is not really possible to do a meaningful example since sage mpoly rings refuse to have non-commutative bases.
sage: R.<x,y> = ZZ[] sage: f = (x + y) sage: 3*f 3*x + 3*y
self, a) |
Right Scalar Multiplication
Note that it is not really possible to do a meaningful example since sage mpoly rings refuse to have non-commutative bases.
sage: R.<x,y> = ZZ[] sage: f = (x + y) sage: f*3 3*x + 3*y
Class: MPolynomial_macaulay2_repr
Special Functions: _macaulay2_
self, [macaulay2=Macaulay2]) |
Return corresponding Macaulay2 polynomial.
sage: R.<x,y> = GF(7)[] sage: f = (x^3 + 2*y^2*x)^7; f x^21 + 2*x^7*y^14 sage: macaulay2(R) # optional ZZ/7 [x, y, MonomialOrder => GRevLex, MonomialSize => 16] sage: h = f._macaulay2_(); print h # optional 21 7 14 x + 2x y sage: R(h) # optional x^21 + 2*x^7*y^14 sage: R(h^20) == f^20 # optional True
Class: MPolynomial_polydict
self, parent, x) |
sage: R, x = PolynomialRing(QQ, 10, 'x').objgens() sage: x (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) sage: loads(dumps(x)) == x True
Functions: coefficient,
constant_coefficient,
content,
degree,
degrees,
dict,
exponents,
factor,
gcd,
inverse_of_unit,
is_constant,
is_generator,
is_homogeneous,
is_monomial,
is_unit,
is_univariate,
lc,
lift,
lm,
lt,
monomial_coefficient,
monomials,
newton_polytope,
nvariables,
quo_rem,
reduce,
subs,
total_degree,
univariate_polynomial,
variable,
variables
self, degrees) |
Return the coefficient of the variables with the degrees
specified in the python dictionary degrees
. Mathematically,
this is the coefficient in the base ring adjoined by the variables
of this ring not listed in degrees
. However, the result
has the same parent as this polynomial.
This function contrasts with the function monomial_coefficient
which returns the coefficient in the base ring of a monomial.
Input:
SEE ALSO: For coefficients of specific monomials, look at efmonomial_coefficient.
sage: R.<x, y> = ZZ[] sage: f = 2 * x * y sage: c = f.coefficient({x:1,y:1}); c 2 sage: c.parent() Multivariate Polynomial Ring in x, y over Integer Ring sage: c in PolynomialRing(IntegerRing(), 2, names = ['x','y']) True sage: f = y^2 - x^9 - 7*x + 5*x*y sage: f.coefficient({y:1}) 5*x sage: f.coefficient({y:0}) -x^9 - 7*x sage: f.coefficient({x:0,y:0}) 0 sage: f=(1+y+y^2)*(1+x+x^2) sage: f.coefficient({x:0}) y^2 + y + 1 sage: f.coefficient([0,None]) y^2 + y + 1 sage: f.coefficient(x) y^2 + y + 1 sage: # Be aware that this may not be what you think! sage: # The physical appearance of the variable x is deceiving -- particularly if the exponent would be a variable. sage: f.coefficient(x^0) # outputs the full polynomial x^2*y^2 + x^2*y + x*y^2 + x^2 + x*y + y^2 + x + y + 1
sage: R.<x,y> = RR[] sage: f=x*y+5 sage: c=f.coefficient({x:0,y:0}); c 5.00000000000000 sage: parent(c) Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
Author: Joel B. Mohler (2007.10.31)
self) |
Return the constant coefficient of this multivariate polynomial.
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.constant_coefficient() 5 sage: f = 3*x^2 sage: f.constant_coefficient() 0
self) |
Returns the content of this polynomial. Here, we define content as the gcd of the coefficients in the base ring.
sage: R.<x,y>=ZZ[] sage: f=4*x+6*y sage: f.content() 2 sage: f.content().parent() Integer Ring
self, [x=None]) |
Return the degree of self in x, where x must be one of the generators for the parent of self.
Input:
sage: R.<x,y> = QQ[] sage: f = y^2 - x^9 - x sage: f.degree(x) 9 sage: f.degree(y) 2 sage: (y^10*x - 7*x^2*y^5 + 5*x^3).degree(x) 3 sage: (y^10*x - 7*x^2*y^5 + 5*x^3).degree(y) 10
self) |
Returns a list (precisely - an ETuple
) with the degree of
each variable in this polynomial. The list of degrees is, of course,
ordered by the order of the generators.
sage: R.<x,y,z>=PolynomialRing(ZZ) sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.degrees() (2, 2, 0) sage: f = x^2+z^2 sage: f.degrees() (2, 0, 2) sage: f.total_degree() # this simply illustrates that total degree is not the sum of the degrees 2 sage: R.<x,y,z,u>=PolynomialRing(ZZ) sage: f=(1-x)*(1+y+z+x^3)^5 sage: f.degrees() (16, 5, 5, 0) sage: R(0).degrees() (0, 0, 0, 0)
self) |
Return underlying dictioniary with keys the exponents and values the coefficients of this polynomial.
self) |
Return the exponents of the monomials appearing in self.
sage: R.<a,b,c> = PolynomialRing(QQ, 3) sage: f = a^3 + b + 2*b^2 sage: f.exponents() [(3, 0, 0), (0, 2, 0), (0, 1, 0)]
self) |
Compute the irreducible factorization of this polynomial.
ALGORITHM: Use Singular.
sage: R.<x, y> = QQ[] sage: f = (x^3 + 2*y^2*x) * (x^2 + x + 1); f x^5 + 2*x^3*y^2 + x^4 + 2*x^2*y^2 + x^3 + 2*x*y^2 sage: F = f.factor() sage: F x * (x^2 + x + 1) * (x^2 + 2*y^2)
Next we factor the same polynomial, but over the finite field
of order
.
sage: R.<x, y> = GF(3)[] sage: f = (x^3 + 2*y^2*x) * (x^2 + x + 1); f x^5 - x^3*y^2 + x^4 - x^2*y^2 + x^3 - x*y^2 sage: F = f.factor() sage: F # order is somewhat random (-1) * x * (-x + y) * (x + y) * (x - 1)^2
Next we factor a polynomial over a number field.
sage: p = var('p') sage: K.<s> = NumberField(p^3-2) sage: KXY.<x,y> = K[] sage: factor(x^3 - 2*y^3) (x + (-s)*y) * (x^2 + s*x*y + s^2*y^2) sage: k = (x^3-2*y^3)^5*(x+s*y)^2*(2/3 + s^2) sage: k.factor() (s^2 + 2/3) * (x + s*y)^2 * (x + (-s)*y)^5 * (x^2 + s*x*y + s^2*y^2)^5
This shows that ticket #2780 is fixed, i.e. that the unit part of the factorization is set correctly:
sage: x = var('x') sage: K.<a> = NumberField(x^2 + 1) sage: R.<y, z> = PolynomialRing(K) sage: f = 2*y^2 + 2*z^2 sage: F = f.factor(); F.unit_part() 2
self, f) |
Compute the greatest common divisor of this polynomial and f.
ALGORITHM: Use Singular.
sage: R.<x,y> = QQ[] sage: f = (x^3 + 2*y^2*x)^2 sage: g = x^2*y^2 sage: f.gcd(g) x^2
This also works correctly over ZZ:
sage: R.<x,y> = ZZ[] sage: gcd(2*x,4*x) 2*x sage: gcd(2*x,4*x) 2*x sage: gcd(9*x*y*(x^2-y^2), 15*x*y^2*(x^2+y^2)) 3*x*y
We compute a gcd over a finite field.
sage: F.<u> = GF(31^2) sage: R.<x,y,z> = F[] sage: p = x^3 + (1+u)*y^3 + z^3 sage: q = p^3 * (x - y + z*u) sage: gcd(p,q) x^3 + (u + 1)*y^3 + z^3 sage: gcd(p,q) # yes, twice -- tests that singular ring is properly set. x^3 + (u + 1)*y^3 + z^3
We compute a gcd over a number field:
sage: x = polygen(QQ) sage: F.<u> = NumberField(x^3 - 2) sage: R.<x,y,z> = F[] sage: p = x^3 + (1+u)*y^3 + z^3 sage: q = p^3 * (x - y + z*u) sage: gcd(p,q) x^3 + (u + 1)*y^3 + z^3
self) |
True if polynomial is constant, and False otherwise.
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.is_constant() False sage: g = 10*x^0 sage: g.is_constant() True
self) |
Returns True if self is a generator of it's parent.
sage: R.<x,y>=ZZ[] sage: x.is_generator() True sage: (x+y-y).is_generator() True sage: (x*y).is_generator() False
self) |
Return True if self is a homogeneous polynomial.
sage: R.<x,y> = QQ[] sage: (x+y).is_homogeneous() True sage: (x.parent()(0)).is_homogeneous() True sage: (x+y^2).is_homogeneous() False sage: (x^2 + y^2).is_homogeneous() True sage: (x^2 + y^2*x).is_homogeneous() False sage: (x^2*y + y^2*x).is_homogeneous() True
self) |
Returns True if self is a monomial. Here, we define a monomial as a product of variables with a coefficient (possibly not equal to 1).
sage: R.<x,y>=ZZ[] sage: x.is_monomial() True sage: (x+2*y).is_monomial() False sage: (2*x).is_monomial() True
self) |
Return True if self is a unit.
sage: R.<x,y> = ZZ[] sage: (x+y).is_unit() False sage: R(0).is_unit() False sage: R(-1).is_unit() True sage: R(-1 + x).is_unit() False sage: R(2).is_unit() False
self) |
Returns True if this multivariate polynomial is univariate and False otherwise.
sage: R.<x,y> = QQ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.is_univariate() False sage: g = f.subs({x:10}); g 700*y^2 - 2*y + 305 sage: g.is_univariate() True sage: f = x^0 sage: f.is_univariate() True
self) |
Returns the leading coefficent of self i.e., self.coefficient(self.lm())
sage: R.<x,y,z>=ZZ[] sage: f=3*x^2-y^2-x*y sage: f.lc() 3
self, I) |
given an ideal I = (f_1,...,f_r) and some g (== self) in I, find s_1,...,s_r such that g = s_1 f_1 + ... + s_r f_r
ALGORITHM: Use Singular.
sage: A.<x,y> = PolynomialRing(QQ,2,order='degrevlex') sage: I = A.ideal([x^10 + x^9*y^2, y^8 - x^2*y^7 ]) sage: f = x*y^13 + y^12 sage: M = f.lift(I) sage: M [y^7, x^7*y^2 + x^8 + x^5*y^3 + x^6*y + x^3*y^4 + x^4*y^2 + x*y^5 + x^2*y^3 + y^4] sage: sum( map( mul , zip( M, I.gens() ) ) ) == f True
self) |
Returns the lead monomial of self with respect to the term order of self.parent().
sage: R.<x,y,z>=PolynomialRing(GF(7),3,order='lex') sage: (x^1*y^2 + y^3*z^4).lm() x*y^2 sage: (x^3*y^2*z^4 + x^3*y^2*z^1).lm() x^3*y^2*z^4
sage: R.<x,y,z>=PolynomialRing(QQ,3,order='deglex') sage: (x^1*y^2*z^3 + x^3*y^2*z^0).lm() x*y^2*z^3 sage: (x^1*y^2*z^4 + x^1*y^1*z^5).lm() x*y^2*z^4
sage: R.<x,y,z>=PolynomialRing(ZZ,3,order='degrevlex') sage: (x^1*y^5*z^2 + x^4*y^1*z^3).lm() x*y^5*z^2 sage: (x^4*y^7*z^1 + x^4*y^2*z^3).lm() x^4*y^7*z
self) |
Returns the leading term of self i.e., self.lc()*self.lm(). The notion of "leading term" depends on the ordering defined in the parent ring.
sage: R.<x,y,z>=PolynomialRing(ZZ) sage: f=3*x^2-y^2-x*y sage: f.lt() 3*x^2 sage: R.<x,y,z>=PolynomialRing(ZZ,order="invlex") sage: f=3*x^2-y^2-x*y sage: f.lt() -y^2
self, mon) |
Return the coefficient in the base ring of the monomial mon in self, where mon must have the same parent as self.
This function contrasts with the function coefficient
which returns the coefficient of a monomial viewing this polynomial in a
polynomial ring over a base ring having fewer variables.
Input:
SEE ALSO: For coefficients in a base ring of fewer variables, look at efcoefficient.
The parent of the return is a member of the base ring.
sage: R.<x,y>=ZZ[]
The parent of the return is a member of the base ring.
sage: f = 2 * x * y sage: c = f.monomial_coefficient(x*y); c 2 sage: c.parent() Integer Ring
sage: f = y^2 + y^2*x - x^9 - 7*x + 5*x*y sage: f.monomial_coefficient(y^2) 1 sage: f.monomial_coefficient(x*y) 5 sage: f.monomial_coefficient(x^9) -1 sage: f.monomial_coefficient(x^10) 0
sage: var('a') a sage: K.<a> = NumberField(a^2+a+1) sage: P.<x,y> = K[] sage: f=(a*x-1)*((a+1)*y-1); f -x*y + (-a)*x + (-a - 1)*y + 1 sage: f.monomial_coefficient(x) -a
self) |
Returns the list of monomials in self. The returned list is decreasingly ordered by the term ordering of self.parent().
Output: list of MPolynomials representing Monomials
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.monomials() [x^2*y^2, x^2, y, 1]
sage: R.<fx,fy,gx,gy> = ZZ[] sage: F = ((fx*gy - fy*gx)^3) sage: F -fy^3*gx^3 + 3*fx*fy^2*gx^2*gy - 3*fx^2*fy*gx*gy^2 + fx^3*gy^3 sage: F.monomials() [fy^3*gx^3, fx*fy^2*gx^2*gy, fx^2*fy*gx*gy^2, fx^3*gy^3] sage: F.coefficients() [-1, 3, -3, 1] sage: sum(map(mul,zip(F.coefficients(),F.monomials()))) == F True
self) |
Return the Newton polytope of this polynomial.
You should have the optional polymake package installed.
sage: R.<x,y> = PolynomialRing(QQ,2) sage: f = 1 + x*y + x^3 + y^3 sage: P = f.newton_polytope() sage: P Convex hull of points [[1, 0, 0], [1, 0, 3], [1, 1, 1], [1, 3, 0]] sage: P.facets() [(0, 1, 0), (3, -1, -1), (0, 0, 1)] sage: P.is_simple() True
self) |
Number of variables in this polynomial
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.nvariables () 2 sage: g = f.subs({x:10}); g 700*y^2 - 2*y + 305 sage: g.nvariables () 1
self, right) |
Returns quotient and remainder of self and right.
ALGORITHM: Use Singular.
self, I) |
Reduce this polynomial by the the polynomials in I.
Input:
sage: P.<x,y,z> = ZZ[] sage: f1 = -2 * x^2 + x^3 sage: f2 = -2 * y + x* y sage: f3 = -x^2 + y^2 sage: F = Ideal([f1,f2,f3]) sage: g = x*y - 3*x*y^2 sage: g.reduce(F) 6*y^2 - 2*y sage: g.reduce(F.gens()) 6*y^2 - 2*y
sage: f = 3*x sage: f.reduce([2*x,y]) x
self, [fixed=None]) |
Fixes some given variables in a given multivariate polynomial and returns the changed multivariate polynomials. The polynomial itself is not affected. The variable,value pairs for fixing are to be provided as a dictionary of the form variable:value.
This is a special case of evaluating the polynomial with some of the variables constants and the others the original variables.
Input:
sage: R.<x,y> = ZZ[] sage: f = x^2 + y + x^2*y^2 + 5 sage: f((5,y)) 25*y^2 + y + 30 sage: f.subs({x:5}) 25*y^2 + y + 30
self) |
Return the total degree of self, which is the maximum degree of any monomial in self.
sage: R.<x,y,z> = QQ[] sage: f=2*x*y^3*z^2 sage: f.total_degree() 6 sage: f=4*x^2*y^2*z^3 sage: f.total_degree() 7 sage: f=99*x^6*y^3*z^9 sage: f.total_degree() 18 sage: f=x*y^3*z^6+3*x^2 sage: f.total_degree() 10 sage: f=z^3+8*x^4*y^5*z sage: f.total_degree() 10 sage: f=z^9+10*x^4+y^8*x^2 sage: f.total_degree() 10
self, [R=None]) |
Returns a univariate polynomial associated to this multivariate polynomial.
Input:
If this polynomial is not in at most one variable, then a ValueError exception is raised. This is checked using the is_univariate() method. The new Polynomial is over the same base ring as the given MPolynomial and in the variable 'x' if no ring 'ring' is provided.
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.univariate_polynomial() Traceback (most recent call last): ... TypeError: polynomial must involve at most one variable sage: g = f.subs({x:10}); g 700*y^2 - 2*y + 305 sage: g.univariate_polynomial () 700*x^2 - 2*x + 305 sage: g.univariate_polynomial(PolynomialRing(QQ,'z')) 700*z^2 - 2*z + 305
self, i) |
Returns
-th variable occuring in this polynomial.
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.variable(0) x sage: f.variable(1) y
self) |
Returns the list of variables occuring in this polynomial.
sage: R.<x,y> = ZZ[] sage: f = 3*x^2 - 2*y + 7*x^2*y^2 + 5 sage: f.variables() [x, y] sage: g = f.subs({x:10}); g 700*y^2 - 2*y + 305 sage: g.variables() [y]
Special Functions: __eq__,
__floordiv__,
__getitem__,
__init__,
__iter__,
__ne__,
__neg__,
_derivative,
_homogenize,
_latex_,
_repr_,
_repr_with_changed_varnames
self, right) |
self, right) |
Quotient of division of self by other. This is denoted //.
NOTES: It's not clear to me that this is well-defined if self is not exactly divisible by other.
sage: R.<x,y>=ZZ[] sage: 2*x*y//y 2*x sage: 2*x//y 0 sage: 2*x//4 0 sage: type(0//y) <class 'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict '>
self, x) |
Input:
sage: R.<x, y> = PolynomialRing(QQ, 2) sage: f = -10*x^3*y + 17*x*y sage: f[3,1] -10 sage: f[1,1] 17 sage: f[0,1] 0
sage: R.<x> = PolynomialRing(GF(7),1); R Multivariate Polynomial Ring in x over Finite Field of size 7 sage: f = 5*x^2 + 3; f -2*x^2 + 3 sage: f[2] 5
self) |
Facilitates iterating over the monomials of self, returning tuples of the form (coeff, mon) for each non-zero monomial.
sage: R = ZZ['t'] sage: P.<x,y,z> = PolynomialRing(R,3) sage: f = 3*x^3*y + 16*x + 7 sage: [(c,m) for c,m in f] [(3, x^3*y), (16, x), (7, 1)] sage: f = P.random_element(10,10) sage: sum(c*m for c,m in f) == f True
self, right) |
self) |
sage: R.<x,y>=ZZ[] sage: -x -x sage: -(y-1) -y + 1
self, [var=None]) |
Differentiates self with respect to variable var.
If var is not one of the generators of this ring, _derivative(var) is called recursively on each coefficient of this polynomial.
SEE ALSO: self.derivative()
sage: R.<t> = PowerSeriesRing(QQ) sage: S.<x, y> = PolynomialRing(R) sage: f = (t^2 + O(t^3))*x^2*y^3 + (37*t^4 + O(t^5))*x^3 sage: type(f) <class 'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict '> sage: f._derivative(x) # with respect to x (2*t^2 + O(t^3))*x*y^3 + (111*t^4 + O(t^5))*x^2 sage: f._derivative(y) # with respect to y (3*t^2 + O(t^3))*x^2*y^2 sage: f._derivative(t) # with respect to t (recurses into base ring) (2*t + O(t^2))*x^2*y^3 + (148*t^3 + O(t^4))*x^3 sage: f._derivative(x)._derivative(y) # with respect to x and then y (6*t^2 + O(t^3))*x*y^2 sage: f.derivative(y, 3) # with respect to y three times (6*t^2 + O(t^3))*x^2 sage: f._derivative() # can't figure out the variable Traceback (most recent call last): ... ValueError: must specify which variable to differentiate with respect to
self, var) |
Return self
if self
is homogeneous. Otherwise
return a homogenized polynomial constructed by modifying the
degree of the variable with index var
.
Input:
sage: P.<x,y> = ZZ[] sage: f = x^2 + y + 1 + 5*x*y^1 sage: g = f.homogenize('z'); g # indirect doctest x^2 + 5*x*y + y*z + z^2 sage: g.parent() Multivariate Polynomial Ring in x, y, z over Integer Ring
SEE: self.homogenize
self) |
sage: R.<x,y>=ZZ[] sage: latex(-x^2-y+1) -x^{2} - y + 1 sage: K.<I>=QuadraticField(-1) sage: R.<x,y>=K[] sage: latex(-I*y+I*x^2) I x^{2} + (-I) y
self) |
sage: R.<x,y>=ZZ[] sage: repr(-x^2-y+1) # indirect doc-test '-x^2 - y + 1' sage: K.<I>=QuadraticField(-1) sage: R.<x,y>=K[] sage: repr(-I*y-x^2) # indirect doc-test '-x^2 + (-I)*y'
self, varnames) |
sage: R.<x,y>=ZZ[] sage: f=-x^2-y+1 sage: f._repr_with_changed_varnames(['jack','jill']) '-jack^2 - jill + 1'
See About this document... for information on suggesting changes.