Ask Your Question

Stockfish3709's profile - activity

2019-01-10 01:54:55 -0600 asked a question Is it possible to import machine learning libraries in Sage?

I'm doing a machine learning program in Sage and I wish to use Tensorflow or Scikit learn. However, I don't see any way to import the modules in Sage. I'm wondering if it is possible to import other modules outside of Sage into Sage, or if Sage is essentially a black box system that doesn't work with any other module.

2019-01-08 00:05:21 -0600 asked a question Sage Notebook IOPub data rate exceeded error?


Currently I'm running a very system intensive process on Sage and I'm getting this error.

IOPub data rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable

Current values:
NotebookApp.iopub_data_rate_limit=1000000.0 (bytes/sec)
NotebookApp.rate_limit_window=3.0 (secs)

From research, I am supposed to paste the below in my command prompt.

jupyter notebook --generate-config

But when I try to do so, it says that it is not recognised as an internal or external command.

How do I resolve this issue?

2019-01-07 07:35:09 -0600 commented question Any way to make Sage display large matrices all in 1 line?

Hi, thanks for the reply. My laptop in my office has Sage in it and is running on SageNB. However, I also use CoCalc online by starting a new Sage worksheet. Not sure if it makes a difference, but all the better if I can get both formats to display matrices correctly.

2019-01-07 06:27:00 -0600 asked a question Any way to make Sage display large matrices all in 1 line?

Hi all,

Currently I have this code that generates large matrices.

B = BooleanPolynomialRing(25,'x', order = 'degneglex')
from sage.rings.polynomial.toy_variety import coefficient_matrix
from brial import *
v = BooleanPolynomialVector()
l = [B.random_element(degree = 3, terms = 4) for j in range(25)]
_ = [v.append(e) for e in l]

from sage.rings.polynomial.toy_variety import coefficient_matrix
print l
%time A, v = Sequence(l,B).coefficient_matrix()
print A
print v

The matrix generated is big, so big that it takes 2 lines to display all of it. It is hard to visualise. Is there some way of making each row of the matrix inline together such that they are not separated into different lines?

2019-01-07 02:55:20 -0600 asked a question Is there a way to make sage print out all monomials of a Boolean Ring?

Hi all,

In a finite ring, is there a way to get Sage to print out all possible monomials of the ring? I have a method, but it's very crude. It's simply doing something like taking a random variable to mutiply with a random ring element from B.random_element(). But this is obviously not what I want.

Below is the ring I'm working with.

B = BooleanPolynomialRing(20,'x', order = 'lex')

Is there a Sage function to put every monomial of the ring into a list? I can't seem to find it in Sage documentation.

2019-01-04 20:55:09 -0600 received badge  Supporter (source)
2019-01-04 03:29:42 -0600 received badge  Student (source)
2019-01-03 22:55:43 -0600 received badge  Editor (source)
2019-01-03 22:54:41 -0600 asked a question Sage not detecting intergers in Boolean Polynomial Ring?

Hi all,

I'm trying to do a detecting system for terms in the equations used in a polynomial. I'm using Boolean Polynomials here.

Here's is my code. This prints all the terms of the equations.

P.<x,y,z> = BooleanPolynomialRing(3, order = 'lex')
equations = [x+y+z-1, y*z, x+z]
for i in range(len(equations)):
    for j in equations[i]:
        print j


As you can see, 1 appears in the output. However, when I implement this logic onto it, the output is empty.

for i in range(len(equations)):
    for j in equations[i]:
        if j == 1:
            print 'true'

It's not like the logic doesn't work, if I change '1' to 'x', my logic works.

for i in range(len(equations)):
    for j in equations[i]:
        if j == x:
            print 'true'


What am I doing wrong here?

2019-01-03 06:54:39 -0600 received badge  Scholar (source)
2019-01-03 02:20:02 -0600 asked a question Using SageMath to solve Simultaneous equations in a Boolean Ring

I'm trying to get SageMath to solve a system of equations in a Boolean Ring. Here is my code.

P.<x,y,z> = BooleanPolynomialRing(3, order= 'lex')
equations = [1+x+y+z, x+y, x*y+1, x+y]
zeros = [0,0,0,0]

I know that there are equation solvers for Sage, but I do not know how to have the answers of the equation be only in the Boolean Ring (ie. only 1 or 0). Obviously I can solve the equation by hand, but that's not the point here. Is there a way to have SageMath only output 0 or 1 as the answer?

2018-12-29 17:55:55 -0600 asked a question What is the .modulus() function doing?

I came across this tutorial from Sage that I couldn't get.

Below is the code.

k.<a> = GF(2^1024)
Output: x^1024 + x^19 + x^6 + x + 1

What is going on here?

I understand that the polynomials' coefficients are either 0 or 1, and the degree of the polynomial is not more than 1024, but how does Sage assign them? And also, what is the modulus of the polynomial? I have never came before such a term and I couldn't find any such concepts on the internet.

Thanks for the help in advance.