Ask Your Question

zqcm's profile - activity

2023-07-16 19:49:07 +0200 received badge  Nice Question (source)
2021-02-22 13:13:54 +0200 received badge  Nice Question (source)
2018-12-27 17:26:06 +0200 received badge  Famous Question (source)
2018-03-21 17:16:09 +0200 received badge  Famous Question (source)
2017-10-05 17:00:08 +0200 received badge  Popular Question (source)
2017-10-05 17:00:08 +0200 received badge  Notable Question (source)
2017-01-27 16:16:19 +0200 received badge  Notable Question (source)
2017-01-27 16:16:19 +0200 received badge  Popular Question (source)
2016-03-09 18:34:20 +0200 received badge  Supporter (source)
2016-03-09 13:04:12 +0200 asked a question Using Sage with TensorFlow

I've written something in TensorFlow that makes use of some nice group theory functions that work very easily in Sage (and seem prohibitively difficult to code from scratch). However, I can't get TensorFlow and Sage to work together. Each works on its own, but I think they rely on different Python versions and therefore won't run together. I think Sage uses Python 2.6 and TensorFlow 2.7.

Specifically, I can make a small Python script test.py that uses some Sage functions and run it using

sage --python test.py

and it runs with no problem. But trying to import the TensorFlow module in test.py throws an error saying the tensorflow module doesn't exist. Similarly, I get errors trying to import sage.all inside my .py script that uses TensorFlow. So I can neither add TensorFlow to Sage nor add Sage to Tensorflow.

I first encountered this problem in Sage 6.10 and upgrading to Sage 7.0 hasn't helped.

I'm not sure if this is relevant, but if I fire up normal Python (the kind TensorFlow uses), I get this:

from sage.env import SAGE_LOCAL

SAGE_LOCAL

which outputs '$SAGE_ROOT/local'.

However if I fire up Sage first I get this:

sage SAGE_LOCAL

which outputs ''/usr/lib/sagemath/local'.

Any possible workaround?

Thanks!

2015-10-11 20:46:59 +0200 received badge  Scholar (source)
2015-10-11 20:24:54 +0200 received badge  Student (source)
2015-10-11 19:28:46 +0200 received badge  Editor (source)
2015-10-11 17:42:26 +0200 asked a question Multiplicative group of integers mod n?

I'm guessing this is pretty basic, but I'm also new to Sage and can't find anything about it.

I know how to work with the ring of integers mod n. Is there something analogous for the multiplicative group of integers mod n?

Something like:

G = Mult_Integers(5)
list(G)
[1, 2, 3, 4]

Googling has been surprisingly fruitless.

Thanks!

EDIT: @Nathann: right, but I'm not talking about {0, 1, 2, . . ., n-1}, but {1, 2, 3, . . ., n-1}, which is a group with multiplication.