2019-06-02 00:47:14 -0500 asked a question How to sum or product of two elements of two different fields? I would like to sum of product two elements from different fields and the resultant operation should be in the bigger field. I have used the following codes, but it gives errors. R. = PolynomialRing(GF(2)) F = GF(2^3, name='x', modulus=x^3 + x^2 + 1) G = GF(2^8, name='x', modulus=x^8 + x^5 + x^3 + x + 1) print F.fetch_int(3) print G.fetch_int(5) #F.fetch_int(3) => x + 1 #G.fetch_int(5) => x^2 + 1 #print F.fetch_int(3)*G.fetch_int(5) print (x^2 + 1)*(x + 1)  2019-06-01 05:29:34 -0500 commented question How to handle elements of two different Galois fields simultaneously? @FrédéricC I have used different names, but this also gives error: raise ValueError("the degree of the modulus does not equal the degree of the field") ValueError: the degree of the modulus does not equal the degree of the field 2019-06-01 03:45:13 -0500 asked a question How to handle elements of two different Galois fields simultaneously? I would like to operate the elements of two different fields simultaneously. I have used the following codes, both are not working at the same time whereas only one work at a time. G. = GF(2^8, name='x', modulus=x^8 + x^5 + x^3 + x + 1) F. = GF(2^3, name='x', modulus=x^3 + x^2 + 1) for i in range(2^3): print G.fetch_int(i).integer_representation(), '=', G.fetch_int(i) print F.fetch_int(i).integer_representation(), '=', F.fetch_int(i)  2019-05-28 02:24:38 -0500 received badge ● Popular Question (source) 2019-04-10 00:33:28 -0500 asked a question How to access serial number corresponding to each element in $GF(2^3)$? I would like to access serial number corresponding to each element in $GF(2^3)$? Corresponding to each serial number, I can access the element in $G(2^3)$ as follows: F. = GF(2^3, name='x', modulus=x^3 + x^2 + 1) for i in range(2^3): print i,'=>',F.fetch_int(i)  This provides : 0 => 0 1 => 1 2 => x 3 => x + 1 4 => x^2 5 => x^2 + 1 6 => x^2 + x 7 => x^2 + x + 1  I would like to get the reverse process which will provide seral number corresponding to each element in $(2^3)$, that is, 0 => 0 1 => 1 x => 2 x + 1 => 3 x^2 => 4 x^2 + 1 => 5 x^2 + x => 6 x^2 + x + 1 => 7  Is there any such way? 2019-04-09 21:08:20 -0500 asked a question How to access index value of an element in $GF(2^3)$? I would like to access the index value of the corresponding element in $GF(2^3)$. The following code generates all the elements with a unique index value, but if the field size is very large, then it takes a very long time to generate all the elements with their corresponding index value. So I don't like to generate all the elements at a time. When I call a particular element this will return the corresponding index value of this particular element. F. = GF(2^3, modulus=x^3 + x^2 + 1) for i,a in enumerate(F): print "{} {}".format(i, a) #Output: 0 0 1 x 2 x^2 3 x^2 + 1 4 x^2 + x + 1 5 x + 1 6 x^2 + x 7 1  Suppose, If an element $p(x)$ is in enumerate(F), then it should return the corresponding index value of $p(x)$. How can I do this? 2019-04-06 21:11:02 -0500 asked a question How to access element from finite field in run time I would like to access index value corresponding to an element and conversely access element corresponding to an index value in GF(2^24) in run time. In the following code it does the exact thing what I want. But It takes too long time. So I would like to do in run time. How is it possible? F. = GF(2^24, modulus=x^24 + x^4 + x^3 + x^1 + 1) NP={} # Dictionary- indexvalue : polynomial PN={} # Dictionary- polynomial : indexvalue for i,a in enumerate(F): #print("{} {}".format(i, a)) NP[i]=a PN[a]=i.  As for example, for a polynomial p(x), PN[p(x)]=n, then conversely NP[n]=p(x). 2019-03-02 11:34:07 -0500 received badge ● Editor (source) 2019-03-02 11:24:11 -0500 asked a question How to plot ellipsoid with interact? I would like to plot ellipsoid $\dfrac{x^2}{a^2}+\dfrac{y^2}{b^2}+\dfrac{z^2}{c^2}=1$ in SageMath, where the parameters $a,b,c$ can be changed interactively. I found it what I want here https://www.geogebra.org/m/cqtAE6Sm. But I want to do the same in Sage. How can I do it? 2019-01-26 18:28:47 -0500 commented answer How to solve a system of three polynomial equations over $GF(2^8)$ @rburing thank you so much for your answer. One more question. If the right side of my given equation generates from a loop like b0,b1,b2, then what will be the code? 2019-01-26 10:58:31 -0500 asked a question How to solve a system of three polynomial equations over $GF(2^8)$ I would like to solve the following system of three equations of three variables $a0,a1,a2$ over GF(2^8, name='x', modulus=x^8 + x^5 + x^3 + x + 1) : a0+a1*x+a2*x^2=x^7+x^6+x^5+x^2+x a0+a1*x^2+a2*x^4=x^7+x^6+x^5+x^2 a0+a1*x^3+a2*x^6=x^7+x^3+x^2+1  How can I do this? 2018-10-11 09:41:08 -0500 commented answer How to convert an integer to fixed length binary string in Sage? @eric_g I appreciate your answer. It woks fine. 2018-10-11 08:20:46 -0500 asked a question How to convert an integer to fixed length binary string in Sage? I want to get (192,14,100)=>8bit binary of 192 || 8bit binary of 14 ||8bit binary of 100 => 110000000000111001100100 => 12586596 (equivalent decimal of the 24bits binary sting).  I have written python code to do this, but this code does not work in sage. Here is the code : L=(192,14,100) a=0 for i in range(3): a=(a << 8) ^ (L[i]) print a print bin(a)  What is the best way to do so in Sage? 2018-10-11 07:28:44 -0500 commented answer How to edit pixel values of color image in SageMath? @eric_g thank you very much for your answer. 2018-10-11 07:28:05 -0500 received badge ● Scholar (source) 2018-10-11 06:33:40 -0500 asked a question How to edit pixel values of color image in SageMath? I would like to change pixel values in a color image with Sagemath. I can do the same in python, but my program contains some parts which can not be done with python. Here are the codes for SageMath: MWE: from PIL import Image img=Image.open('image.pgm') pxl=img.load() #pxls=img.getdata() print pxl[0,0]  When I compile thse codes with sage, error occurs : " File "smmm.sage.py", line 8, in print pxl[_sage_const_0 ,_sage_const_0 ] TypeError: an integer is required "  How can I fix this? 2018-08-18 09:06:03 -0500 commented question Error occurs Compiling with sage “SystemError: new style getargs format but argument is not a tuple” @pizza This is a part of my whole program. The whole program consists of a system of linear congruence equations which can not be solved by python. I can solve this system of linear congruence equation easily in sage. So I need to use sage. 2018-08-18 01:35:18 -0500 asked a question Error occurs Compiling with sage “SystemError: new style getargs format but argument is not a tuple” When the following codes are compiling with python everything is good, there is no error, but when I compile with sage it occurs the error : "SystemError: new style getargs format but argument is not a tuple" Here is my code from PIL import Image file=Image.open('/home/mks/Desktop/Shamir_VSIS/si.jpeg') file2=file.convert("L") pix = file2.load() colsize,rowsize=file2.size for i in range(rowsize): for j in range(colsize): if pix[j,i]>250: pix[j,i]=250 file2.save('/home/mks/Desktop/Shamir_VSIS/si.pgm')  How can I fix this issue? 2018-08-17 22:40:38 -0500 commented question How to fix "IOError: decoder jpeg not available" @slelievre I have installed Sage using the following terminal commands : sudo apt-add-repository -y ppa:aims/sagemath sudo apt-get update sudo apt-get install sagemath-upstream-binary  2018-08-17 22:36:27 -0500 commented answer How to fix "IOError: decoder jpeg not available" @sleliere the Sage installation directory is : /usr/lib/sagemath, But there is no file "SAGE_ROOT/build/pkgs/pillow/spkg-install". Here is the list through terminal command mks@mks-H81M-S:/usr/lib/sagemath/build\$ ls make  2018-08-09 23:11:00 -0500 received badge ● Supporter (source) 2018-08-09 23:08:43 -0500 commented answer How to fix "IOError: decoder jpeg not available" @tmonteil First of all thank you for your answer. According to you I have installed the (ubuntu) package libjpeg-dev, but the problem still remains. I have not found "https://git.sagemath.org/sage.git/tree/build/pkgs/pillow/spkg-install" in my OS. 2018-08-09 09:35:01 -0500 received badge ● Student (source) 2018-08-09 06:33:06 -0500 asked a question How to fix "IOError: decoder jpeg not available" I have stuck when I compile these code in SageNotebook: from PIL import Image img=Image.open("/home/pmath/Music/im1.jpg") img2=img.convert("L") img2.save("/home/pmath/Music/secretimage.pgm") img=Image.open("/home/pmath/Music/secretimage.pgm") pix=img.load() print pix  The following errors occur : Traceback (click to the left of this block for traceback) ... IOError: decoder jpeg not available  But when I compile these codes with python on the same OS(ubuntu32bit 16.04) it works well. The problems occur only on Sage. How can i fix this issue?