Thanks a lot Vincent. It also works.

On Mon, 3 Feb, 2020, 1:46 PM Vincent Delecroix, <[email protected]>
wrote:

> The command
>
> sage: P.<x0,x1,x2,x3> = GF(2)[]
>
> is *not* declaring variables x0, x1, etc to be elements in GF(2)
> but rather *assigns* x0, x1, etc to be generators of a poynomial
> algebra.
>
> sage: P.<x0,x1,x2,x3> = GF(2)[]
> sage: (x0 * x1 + x3 + 1)^2
> x0^2*x1^2 + x3^2 + 1
>
> If you want to use elements of GF(2) simply do
>
> sage: K = GF(2)
> sage: x3 = K(0)
> sage: x2 = K(1)
> sage: x1 = K(0)
> sage: x0 = K(1)
>
> Then
>
> sage: s1= x0*x2*x3 + x0*x2 + x0 + x1*x2 + x2
> sage: s0= x0*x1*x3 + x0*x2 + x0*x3 + x1 + 1
> sage: print(s1,s0)
> 1 0
>
> Vincent
>
> PS: the command
>
> sage: x3 = 0
>
> assigns x3 the number 0 (which is an integer). There is no such thing as
> "typing a variable" in Python. You can do
>
> sage: x3 = 0          # defines x3 as an integer
> sage: x3 = [0, 1, 3]  # redefines x3 as a list
> sage: x3 = "hello"    # redefines x3 as a string
>
>
> Le 03/02/2020 à 08:31, Samanta a écrit :
> > I have defined the input variables in characteristic 2. But when I
> assign a
> > particular value to the input, output gives the result in simple algebra
> > not in characteristic 2. Here is my code:
> > sage: P.<x0,x1,x2,x3> = GF(2)[]
> > ....: x3=0
> > ....: x2=1
> > ....: x1=0
> > ....: x0=1
> > ....: s1= x0*x2*x3 + x0*x2 + x0 + x1*x2 + x2
> > ....: s0= x0*x1*x3 + x0*x2 + x0*x3 + x1 + 1
> > ....: print s1,s0
> > ....:
> > 3 2
> >
> > Here I want s1, s0 as 1,0. If I don't assign any value to the input, the
> > output will gives value in charateristic 2 like
> > sage: P.<x0,x1,x2,x3> = GF(2)[]
> > ....: print x0+x1+x0
> > ....:
> > x1
> > Can anyone guide me how to get the output values in characteristic 2 if I
> > assign a value to the input?
> > Thanks in advance
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/5afdc622-f081-5f0e-8707-83098d94df5b%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAN3kT1JLUst4a%3DHLJyJVRMjchu2uEB4ErRhcD5zGU0mQhg4EFQ%40mail.gmail.com.

Reply via email to