ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 24 Apr 2021 19:49:45 +0200General form of ANF of degree dhttps://ask.sagemath.org/question/56796/general-form-of-anf-of-degree-d/I need to create a general form of ANF of degree d, so I could
substitute values of x in it to find the actual ANF of the function.
I'm trying to write an algorithm that calculates algebraic immunity
of the function of degree d.
1. Substitute all N arguments x with f(x) = 1 in the ANF
of a general boolean function g(x) of degree d.
This gives a system of N linear equations for the coefficients of g(x).
2. Solve this linear system.
3. If there is no (nontrivial) solution, output no annihilator of degree d,
else determine sets of coefficients for linearly independent annihilators.vet99Sat, 24 Apr 2021 19:49:45 +0200https://ask.sagemath.org/question/56796/How to find the degree of a polynomialhttps://ask.sagemath.org/question/56440/how-to-find-the-degree-of-a-polynomial/ Is there a function that takes in a polynomial and returns its degree? For example: suppose we have the ring `R = PolynomialRing(ZZ, 'x')`, and the polynomial `p = (x-1)*(x-2)`. The degree function I'm looking for should return 2 when applied to `p`. Does such a function exist??Blob1234Tue, 30 Mar 2021 23:05:53 +0200https://ask.sagemath.org/question/56440/Set of polynomial under a certain degreehttps://ask.sagemath.org/question/55842/set-of-polynomial-under-a-certain-degree/ Hello everyone,
My question is the following : how to define the set of the polynomial with degree less or equal than a certain number ?
In my program I want to explore all the polynomial over a finite field with a degree less or equal than d.
For now, what I do is :
R.<x> = PolynomialRing(GF(2^4))
R.random_element(5)
But If I want to go through all these elements I can't use that since I get all of them...
Does someone have an idea of what I could do ?
Thank you in advance
CamilleIsomorphismTue, 23 Feb 2021 18:43:33 +0100https://ask.sagemath.org/question/55842/how 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 10:46:56 +0200https://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 11:54:06 +0200https://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 11:53:04 +0200https://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 07:07:55 +0200https://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 19:37:26 +0200https://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 18:27:48 +0200https://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 10:26:04 +0100https://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 23:43:08 +0200https://ask.sagemath.org/question/8994/