Ask Your Question

Where is the source code ?

asked 2017-05-10 07:54:08 -0500

wjansen gravatar image

Hello all,

I am using SageMath-7.5.1 on a Linux platform. Sometimes I am interested in the source code for studying implementation details. When asking for documentation or source code, e.g.

R.<x>=GF(61)[] ; p=x^3 + x^2 + 59*x + 60 ; p?

then the documentation may contain a line like:


But directory "~/.sage/temp/WJ1/6067" is empty! Neither does the SageMath installation directory "/usr/lib/sagemath" (recursively searched) contain a file "". So, where is the source code?

Thanks in advance

edit retag flag offensive close merge delete


In my case, after starting sage in a linux console, the path is correctly detected:

sage: p?
Type:           Polynomial_zmod_flint
String form:    x^3 + x^2 + 59*x + 60
File:           /usr/share/sage/source/sage/rings/polynomial/polynomial_zmod_flint.pyx
Docstring:         Polynomial on ZZ/nZZ implemented via FLINT.
dan_fulea gravatar imagedan_fulea ( 2017-05-10 12:31:07 -0500 )edit

That's so in your case, not in mine.

wjansen gravatar imagewjansen ( 2017-05-11 03:32:58 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-05-10 08:03:52 -0500

kcrisman gravatar image

Yes, when it does that it just puts the things in a temp directory. But look for polynomial_zmod_flint.pyx. For me, when I'm in the Sage directory, it's

$ pwd
$ ls polynomial_zmod_flint.pyx 
edit flag offensive delete link more


My installation contains only one subdirectory of .../sage/src, namely doc. So it may be an installation issue. What can I do to install more subdirectories? I installed the compiled SageMath, not from source code.

BTW, I searched the installation directory for file names having two asterisks: "polynomial_zmodasterisk.pyasterisk" including the "pyx" files. Unfortunately, both asterisks were deleted in the formatted question you see (and, my failure, I did not look at it).

wjansen gravatar imagewjansen ( 2017-05-10 10:14:43 -0500 )edit

Hmm, then you might be installing it via some binary that explicitly is stripped down to make sure the size is small. Can you say precisely which SageMath you installed? Which exact binary or installation procedure? Hopefully someone else can answer once you provide that - I do not have a Linux install.

kcrisman gravatar imagekcrisman ( 2017-05-10 20:10:06 -0500 )edit

I used the installation procedure according to "", entry "Ubuntu PPA" (only the last of the three commands is relevant to find out what had been installed). The link points to version 7.6, but when I installed version 7.5.1 it was the same procedure. Well, I can try to upgrade to version 7.6 to see what happens.

Addendum 1: I did without success: "sagemath-upstream-binary" still provides version 7.5.1.

Addendum 2: Now, I installed version 7.6 from a tar.bz2 archive according to entry "Usage" in the link given above (i.e. no upgrade): the missing sources are there, hurrah! If the stripping down is really necessary to generate the PPA it may be wise to add a comment in entry "Ubuntu PPA".

wjansen gravatar imagewjansen ( 2017-05-11 03:40:48 -0500 )edit

Ah, the PPA was the culprit - as I suspected. Yes, I think we can add some info on that.

kcrisman gravatar imagekcrisman ( 2017-05-11 07:54:35 -0500 )edit
kcrisman gravatar imagekcrisman ( 2017-05-11 07:57:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2017-05-10 07:54:08 -0500

Seen: 63 times

Last updated: May 10