ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 25 Aug 2020 17:17:09 +0200Modifying packages/libraries source codehttps://ask.sagemath.org/question/53174/modifying-packageslibraries-source-code/I was looking at the source of one of the libraries (libbraiding) that Sage uses and was interested in making a few small changes and testing the result.
I have no experience with compiling/packaging such code; I was wondering whether it is easy to download the source of the Sage package, make a couple of minor changes to it and then force Sage to install/compile it? If yes, can someone please point me in the right direction?
bksadieTue, 25 Aug 2020 17:17:09 +0200https://ask.sagemath.org/question/53174/import sage packages in pythonhttps://ask.sagemath.org/question/9302/import-sage-packages-in-python/An easy way to use sage in python files is demonstrated in the [Sage Tutorial](http://www.sagemath.org/doc/tutorial/programming.html).
#!/usr/bin/env sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
Well, what if I don't want to import *all* of sage as shown above using:
from sage.all import *
Instead of this command above, I just want to import the following:
1. Matrix -> type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'
2. vector -> type 'sage.modules.vector_integer_dense.Vector_integer_dense'
3. ZZ -> type 'sage.rings.integer_ring.IntegerRing_class'
4. MixedIntegerLinearProgram -> type 'sage.numerical.mip.MixedIntegerLinearProgram'
So I should be able to write something like this in python
from sage.library.package.for.Matrix import *
from sage.library.package.for.vector import *
from sage.library.package.for.ZZ import *
from sage.library.package.for.MixedIntegerLinearProgram import *
I just don't know what they are. Any help is appreciated.
Thanks.MaelstromYamatoThu, 06 Sep 2012 13:29:57 +0200https://ask.sagemath.org/question/9302/