Re: [sage-support] Re: Output in characteristic 2

2020-02-03 Thread SUSANTA SAMANTA
Thanks a lot Simon. All solved now.

On Mon, 3 Feb, 2020, 1:54 PM Simon King,  wrote:

> Hi Samanta,
>
> On 2020-02-03, Samanta  wrote:
> > I have defined the input variables in characteristic 2.
>
> No, you haven't, see below.
>
> > 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. = GF(2)[]
>
> Here, you define P as multivariate polynomial ring over the field
> GF(2), the four generators being x0, x1, x2, x3.
>
> > : x3=0
> > : x2=1
> > : x1=0
> > : x0=1
>
> Here, you override the previous definition and assign to x0,...,x3 some
> integers. The ring P still knows how its variables are called, but after
> the re-definition x0 does not belong to P any more.
>
> > Can anyone guide me how to get the output values in characteristic 2 if
> I
> > assign a value to the input?
>
> It is not totally clear to me what you want to do, so, I'm giving two
> different answers.
>
> 1. If you want four variables x0, x1, x2, x3 with values in GF(2),
> then you should simply define them as such:
> sage: x0 = GF(2)(1)
> sage: x1 = GF(2)(0)
> sage: x2 = GF(2)(1)
> sage: x3 = GF(2)(0)
> There is no need at all to define P in the first place.
>
> 2. If you want to symbolically work with polynomial expressions over
> GF(2) in indeterminates x0,...,x3, and want to eventually insert
> special values into the expressions, you could do the following:
> sage: P. = GF(2)[]
> sage: f = ((x0+x1)^2+(x2+x3)^2)^2
> sage: f
> x0^4 + x1^4 + x2^4 + x3^4
> sage: f(x0=1, x1=0, x2=1, x3=0)
> 0
>
> Best regards,
> Simon
>
> --
> 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 sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/r18las%243nai%241%40ciao.gmane.io
> .
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAN3kT1LQ_VjZxog6ReZr4fFq8BXcjEjsMp2PMc6M_5kd5zSUrA%40mail.gmail.com.


[sage-support] Re: Output in characteristic 2

2020-02-03 Thread Simon King
Hi Samanta,

On 2020-02-03, Samanta  wrote:
> I have defined the input variables in characteristic 2.

No, you haven't, see below.

> 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. = GF(2)[]

Here, you define P as multivariate polynomial ring over the field
GF(2), the four generators being x0, x1, x2, x3. 

> : x3=0
> : x2=1
> : x1=0
> : x0=1

Here, you override the previous definition and assign to x0,...,x3 some
integers. The ring P still knows how its variables are called, but after
the re-definition x0 does not belong to P any more.

> Can anyone guide me how to get the output values in characteristic 2 if I 
> assign a value to the input? 

It is not totally clear to me what you want to do, so, I'm giving two
different answers.

1. If you want four variables x0, x1, x2, x3 with values in GF(2),
then you should simply define them as such:
sage: x0 = GF(2)(1)
sage: x1 = GF(2)(0)
sage: x2 = GF(2)(1)
sage: x3 = GF(2)(0)
There is no need at all to define P in the first place.

2. If you want to symbolically work with polynomial expressions over
GF(2) in indeterminates x0,...,x3, and want to eventually insert
special values into the expressions, you could do the following:
sage: P. = GF(2)[]
sage: f = ((x0+x1)^2+(x2+x3)^2)^2
sage: f
x0^4 + x1^4 + x2^4 + x3^4
sage: f(x0=1, x1=0, x2=1, x3=0)
0

Best regards,
Simon

-- 
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 sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/r18las%243nai%241%40ciao.gmane.io.