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.Mon, 25 Jun 2018 16:33:56 +0200Offline vs CoCalchttps://ask.sagemath.org/question/42729/offline-vs-cocalc/ I am currently working with sage offline version (downloaded version). What difference does it make if I use CoCalc. Does offline version supports all features?mathjainMon, 25 Jun 2018 16:33:56 +0200https://ask.sagemath.org/question/42729/How do I share a library of Sage functionshttps://ask.sagemath.org/question/7501/how-do-i-share-a-library-of-sage-functions/My question concerns what other people usually do in this -- seemingly common -- scenario, which I have needed to think on quite a lot to accomplish. I would like to know whether my way of handling this is the envisioned one. Sorry for the question being long ;)
I am using the notebook for my day-to-day math exploration, but in order to share code between worksheets (and for overview of the individual worksheets), I place often-used code in .sage-files on a folder which I have added to the SAGE_PATH. I have a make-script to precompile these into .py-files which are then loaded at the top of each worksheet using
#auto
from sagelib import *
which works by creating an all.py file in the directory. The individual .sage files of course also need each other (in a non-cyclic way, naturally), so they also have lines like "from util import *" in the top.
The reason I'm using .sage files and not programming directly in .py should be obvious: I like the sage short-hands. Also, if I did that, I could not even use these short-hands inside the notebook, as I would have to refactor the code if I later wanted to move it to the library (which happens all the time).
The reason I'm then using Python's "import" and not Sage's "load" is for two reasons: One is the module system, so I can avoid stating every single library file in the top of each of my worksheets. The other is for efficiency: Let's say I have two files A.sage and B.sage, and B.sage uses A. If I load all first A and then B, the loading of B would cause A to be reloaded again. By this process, A can be reloaded an exponential number of times. I hope I am wrong, but it seems that this is not really handled in Sage's load. Lastly, I also like being able to use the module system once in a while, to not pollute the namespace overly.
Ok, so my Python recompiling-system works on my local machine, but then I would sometimes like to share code or run on some remote server. I can then put my .py or .sage files on a public server, like bitbucket, and in the top of the remote server's notebook worksheet, I wish to load this url. However, having used the Python module system as I mentioned above, I again cannot use Sage's "load" command, as B would have as it's first line "from A import *", but using Sage's load, module A does not exist. This can then be circumvented using code for dynamically loading modules and more manually (calling sage.misc.remote_file) retrieving the file and making sure it's imported properly (possibly precompiling it if it's a .sage file).
As I mentioned to begin with, this seems to actually work and be somewhat manageable. But the custom code I had to write for this makes me think this is not what other people do. But surely, every Sage user must amass a lot of library/commonly used code over time which needs to be loaded into worksheets? How do you handle this?jsrnThu, 03 May 2012 07:24:47 +0200https://ask.sagemath.org/question/7501/Sage Logo usagehttps://ask.sagemath.org/question/7668/sage-logo-usage/Hello Fellowers,
as I'm going to write a little howto for sage, my question now is if there is somewhere mentioned under what kind of license the Sage Logo is publict or in what context one is allowed to use it for puplications?
Greetings
golodhrimgolodhrimMon, 06 Sep 2010 22:12:13 +0200https://ask.sagemath.org/question/7668/