ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 21 Jul 2020 03:46:56 -0500how to get the coefficient of a multivariate polynomial with respect to a specific variable and degree, in a quotient ring ?https://ask.sagemath.org/question/52594/how-to-get-the-coefficient-of-a-multivariate-polynomial-with-respect-to-a-specific-variable-and-degree-in-a-quotient-ring/Here is what I tried.
sage: F = ZZ.quo(3*ZZ); F
sage: A.<X, Y, Z> = PolynomialRing(F); A
sage: R.<x, y, z> = A.quotient(ideal(X^2 - 1, Y^2 - 1, Z^2 - 1))
sage: f = x*z + x*y*z + y + 1
sage: f.coefficient(z, 1)
sage: f.coefficient({z: 1})
sage: f.coeffcient(z)andriamTue, 21 Jul 2020 03:46:56 -0500https://ask.sagemath.org/question/52594/boolean function algebraic degreehttps://ask.sagemath.org/question/52195/boolean-function-algebraic-degree/ Hey, in the doc of the sage.crypto.boolean-function module, there's a algebraic_degree() method mentioned, but it's not available on my implementation of sage. Is it not up to date, or has it been deleted? Anyway, is there a more efficient way to find it than using B.algebraic_normal_form().deg()?HippolyteWed, 24 Jun 2020 04:54:06 -0500https://ask.sagemath.org/question/52195/What happened to BooleanFunction.algebraic_degree?https://ask.sagemath.org/question/52194/what-happened-to-booleanfunctionalgebraic_degree/ Hey, in the doc of the sage.crypto.boolean-function module, there's a algebraic_degree() method mentioned, but it's not available on my implementation of sage. Is it not up to date, or has it been deleted? Anyway, is there a more efficient way to find it than using B.algebraic_normal_form().deg()?HippolyteWed, 24 Jun 2020 04:53:04 -0500https://ask.sagemath.org/question/52194/How can I assign different degrees to the variables of a polynomial ring?https://ask.sagemath.org/question/47290/how-can-i-assign-different-degrees-to-the-variables-of-a-polynomial-ring/ In defining a polynomial ring, is there any way to assign varying degrees to the variables?
For example I want to define the polynomial ring Q[x, y, z] but I want x to be of degree 1, y to be degree 2, and z to be degree 3. I am looking for a way to do this in general not just for a small number of variables.
Laughematician760Mon, 29 Jul 2019 00:07:55 -0500https://ask.sagemath.org/question/47290/Is there a way to get the homogeneous part of certain degree of a (multivariate) polynomial?https://ask.sagemath.org/question/39177/is-there-a-way-to-get-the-homogeneous-part-of-certain-degree-of-a-multivariate-polynomial/Every multivariate polynomial $f\in\Bbb F[x_1,\ldots,x_n]$ of degree $d$ can be written as $f = f_0+f_1+\cdots+f_d$, where $f_i$ is a **homogeneous** polynomial of degree $i$. Is there a *direct* way to get each $f_i$ given $f$ in SageMath? For a specific application I have where I only need $f_d$ I am homogenizing and then setting $h=0$, and based on this I wrote an ugly script that recursively finds $f_i$.
Is there a cleaner (and more efficient) way to do this?
Thanks for the help!
**EDIT:**
This is the code I'm using to obtain $f_d$ from $f$
fd = R( f.homogenize()(h=0) )
where R is the multivariate polynomial ring (parent of $f$). If I want $f_{d-1}$ for example, I can define $g$ as $f - f_d$ and apply the line to $g$. This recursive definition is not satisfactory since to get $f_i$ I need to have all $f_{i+1},\ldots,f_d$ first, which is inefficient. Also, that trick of homogenizing, evaluating $h=0$ and coercing the result back to the original polynomial ring is not very neat.descuderoSun, 15 Oct 2017 12:37:26 -0500https://ask.sagemath.org/question/39177/leading coefficient polynomialhttps://ask.sagemath.org/question/35031/leading-coefficient-polynomial/ Hello everybody,
I'm new to sagemath and python in general, and one of my course in Uni uses it... I have a vague and unclear tutorial the prof gave us and for now I know only the most basic commands.
I have to write a function that takes a polynomial of any degree and tells me the coefficient of the highest degree member (for example , 2x^4+3x^3 would be 2, 7x^3+2x^4+2 would be 7...).
I think the function would have to use "expand", "degree", and of course "coefficient". But i barely have any idea as how to write it.
If anyone could help me it would be great, I am kinda lost here...
Sorry for sloppy english and thanks in advance.
waddupbbySun, 02 Oct 2016 11:27:48 -0500https://ask.sagemath.org/question/35031/The degree of a poynomial in a quotient ringhttps://ask.sagemath.org/question/32594/the-degree-of-a-poynomial-in-a-quotient-ring/ Hello,
I am defining a ring, R, two polynomials, p1 and p2, an ideal, I=<p1>, the quotient ring S=R/I, and then I compute p2 in the new ring:
<p>sage: R.<x,y>=QQ[]
<p>sage: p1=x-y
<p>sage:p2=x^2+y^2
<p>sage: I=ideal(p1)
<p>sage: S=R.quotient_ring(I)
<p>sage: q=p2.change_ring(S)
<p>sage: q
<p>2*ybar^2
When I compute the degree of q I get:
<p>sage: d=q.degree()
<p>sage: d
<p>0
and I want to get d=2.
Can anybody tell me how can I obtain d=2?SyzyAlexFri, 19 Feb 2016 03:26:04 -0600https://ask.sagemath.org/question/32594/How to get a list of monomials of a given degreehttps://ask.sagemath.org/question/8994/how-to-get-a-list-of-monomials-of-a-given-degree/Is there a nice way to get all monomials of a given degree in a multivariable polynomial ring?
For example I want to input x,y,3 and get
x^3, x^2*y, x*y^2, y^3.
I think I could code it myself with not too much work, but it seems like something that might already have a nice method.paragonTue, 22 May 2012 16:43:08 -0500https://ask.sagemath.org/question/8994/