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, 01 Dec 2020 19:28:27 +0100How do you load a file to the SageMath 9.1 Console?https://ask.sagemath.org/question/54419/how-do-you-load-a-file-to-the-sagemath-91-console/ I am trying to follow the Loading and Attaching Sage files tutorial. I am working on Windows 10. I created an `example.sage` file by simply writing a .txt file and changing the extension to .sage, and put it on my desktop, located at
`C:/Users/vika/Desktop/example.sage`.
In the SageMath 9.1 Console, I get the following issues depending on the type of slash
sage: load("C:/Users/vika/Desktop/example.sage")
OSError: did not find file 'C:/Users/vika/Desktop/example.sage' to load or attach
sage: load("C:\Users\vika\Desktop\example.sage")
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Where am I supposed to put this file in order to load it? I know that sage is installed at `C:/Users/vika/AppData/Local/SageMath 9.1` if that matters.vikahdv@gmail.comSat, 28 Nov 2020 05:57:44 +0100https://ask.sagemath.org/question/54419/Downloading thousands of plots from a server sage notebook?https://ask.sagemath.org/question/54495/downloading-thousands-of-plots-from-a-server-sage-notebook/Hello! I made a few thousand 2D plots on an online sage notebook (legacy notebook, not jupyter). They are stored in a list. The computation took over a week and I'd like to avoid having to rerun.
What's the best way to download all of these plots as PNG files?
In the past, I have hacked it by looping over the list and .show()'ing the plots, downloading the notebook's HTML file, and cutting the plots from the directory (don't laugh). Usually showing a few hundred plots takes a while to show and I'm worried it may run out of memory and crash in this case.
Thanks in advance!
Edit: I should also mention I am not an admin on the server.TheHiggsBozoTue, 01 Dec 2020 19:28:27 +0100https://ask.sagemath.org/question/54495/Eliminating string after readinghttps://ask.sagemath.org/question/51304/eliminating-string-after-reading/ Suppose I have a file called data.cvs which is
3;2
2;1
1;0.1
0.01;-0.9
I can read it by
import csv
data=list( csv.reader(open('data3.csv','r')) )
but for SM it will had the structure af a matrix of string
[['3;2'], ['2;1'], ['1;0.1'], ['0.01;-0.9']]
How could I eliminate the quotes and replace `;` by `,` ? In passing `import` is not a word in the documentation .CyrilleWed, 06 May 2020 22:36:16 +0200https://ask.sagemath.org/question/51304/Cocalc in problem - files disappearinghttps://ask.sagemath.org/question/43366/cocalc-in-problem-files-disappearing/Just now I was working on cocalc and several files suddenly disappeared.
Could anyone tell me what is happening?
I don't need quite a certain answer, I just want some advice.pizzaMon, 13 Aug 2018 19:08:34 +0200https://ask.sagemath.org/question/43366/Where does save( , '') save to?https://ask.sagemath.org/question/41887/where-does-save-save-to/Sorry if this is a stupid question but where to does save( , '') go to? how do I find the file location?standardtrickynessFri, 06 Apr 2018 16:35:58 +0200https://ask.sagemath.org/question/41887/Nauty x SageMathhttps://ask.sagemath.org/question/35312/nauty-x-sagemath/I generated a txt file with all connected graphs (11 vertices) using nauty. I want to upload this file to SageMath cloud and to SageMath notebook (with ubuntu).
In first case, I can't because the size of file is greather than 30mb or something like this and SageMath cloud ask for some special type of upload.
In second case, although SageMath notebook says it is allowed to upload txt files I just can't do it since SageMath notebook says there is some problem with the file. I alreadt generated other txt files using nauty and I am totally sure there is no problem with this,celsomjrMon, 31 Oct 2016 12:41:36 +0100https://ask.sagemath.org/question/35312/How to print a text file containing multiple tuples from a functionhttps://ask.sagemath.org/question/26710/how-to-print-a-text-file-containing-multiple-tuples-from-a-function/ I am trying to use Sagemath Cloud to create a text file with multiple columns of data. Each column is the input or output value of the variables of a system of functions being evaluated with for loops. I am very new to Python, and when I try to do this, I either get an error message or I get a text file with only one line, and that line is constantly overwritten by a new value of the function. On my own laptop with its standalone version of Sage, I can easily generate what I want simply by telling Sage to print the values of the variables of the function for each iteration of the for loops. The standalone version even creates an output text file that I can save. How do I do this with the cloud version?C. ThompsonMon, 04 May 2015 01:42:46 +0200https://ask.sagemath.org/question/26710/loading a worksheethttps://ask.sagemath.org/question/26171/loading-a-worksheet/I have a worksheet that stores a number of functions that I want to use. I'm having trouble importing it on the sage math cloud. I followed [this guide](https://www.youtube.com/watch?v=Xj5-WKeecns&spfreload=10). I'm still having trouble. My file is "NPS_lib.sagews."
Anytime I try to do something like:
> os.path.abspath('.')
> %load /projects/1fb765dd-blah-blah-blah/NPS_lib.sagews
I get the following error:
IOError: [Errno 2] No such file or directory: u'/projects/1fb765dd-blah-blah-blah/NPS_library.sagews.sobj'
I've tried using load('/path/file') format as well and still get the same error. In particular it always seems to be appending "sobj" to the end of my string, which doesn't look right. What is going on here?
In the guide link, it looks like changing the extension to .sage makes it work however if I try this it messes up some of the code, particularly comments.alexrThu, 12 Mar 2015 21:18:21 +0100https://ask.sagemath.org/question/26171/where are notebook files ?https://ask.sagemath.org/question/10955/where-are-notebook-files/Hello,
I am working with ubuntu on two computers and I use unison to synchronize them.
If I understand well, the notebook files are hidden in .sage/sage_notebook.sagenb/home/admin/
every worksheet give a new folder called 0/ 1/ 2/ where you can find files like
"cells data snapshots worksheet_conf.pickle worksheet.html"
The thing I write and my worksheet are written in the file "worksheet.html".
Is it possible to change these names 0/ 1/ to have a real file like interplation.sws ?
thank a lot for some explanations
Etienne
etienneThu, 23 Jan 2014 07:16:42 +0100https://ask.sagemath.org/question/10955/delele files and select multiple files in Sage Cloudhttps://ask.sagemath.org/question/10298/delele-files-and-select-multiple-files-in-sage-cloud/Hi experts!
1. How can I select multiple files simultaneously in Sage Cloud (for download it)?
2. How can I delete multiple files simultaneously in Sage Cloud?
Waiting for your answers.
Thanks a lot!mresimulatorFri, 15 Nov 2013 09:18:48 +0100https://ask.sagemath.org/question/10298/Vector-graphic graphs of small sizehttps://ask.sagemath.org/question/10720/vector-graphic-graphs-of-small-size/I'm doing some computations related to BSD, and saving the resulting graphs as PDFs. Here is the script right now:
<pre><code>
ds = [1,5,34,1254,29274]
pis = [[1.0] for d in ds]
primes = [1.0 for d in ds]
def ell_data(p,d):
if 2*d % p == 0: # curve is singular
return long(p)
else:
return long(EllipticCurve(GF(p),[0,0,0,-d^2,0]).cardinality())
for i in range(30000):
p = Primes().unrank(i)
for j in range(len(ds)):
pis[j].append(pis[j][-1] * ell_data(p,ds[j]) / p)
primes.append(log(long(p)))
ell_data = [zip(primes, pi) for pi in pis]
ell_log_data = [[(log(p),log(pi)) for (p,pi) in data] for data in ell_data]
p = sum([scatter_plot(e[1:], markersize=2, xmin=1) for e in ell_log_data])
p.save('bsd-plot.pdf')
</code>
</pre>
The details aren't very important - what matters is that I'm creating a pretty big data set and plotting it. The problem is, if I save the plot as a PDF, the PDF is *very large* (around 30mb). Is there any way of creating a vector-graphics data plot that is reasonably sized?Daniel MillerSun, 10 Nov 2013 16:42:21 +0100https://ask.sagemath.org/question/10720/Adding some *.py files to sagemath notebook?https://ask.sagemath.org/question/10099/adding-some-py-files-to-sagemath-notebook/Ok I have spent hours going thru online docs for such a simple question but now give up, so now I am asking:
I am running the sage appliance in virtual box ( sage5.1 ) under windows 7.
I have some python file, but no setup.py file for them.
I would like to add them to sage so in the notebook I can import them.
Can anyone tell me where to put them, hopefully without expecting me to know my well very well around linux ( I can copy move make directories, and modify some access rights, but I do not want to learn bash scripting ) If you could give command on a close to cut and paste basis that would be wonderful.russ_henselTue, 07 May 2013 20:38:16 +0200https://ask.sagemath.org/question/10099/Generating a unique file name for each graphhttps://ask.sagemath.org/question/10040/generating-a-unique-file-name-for-each-graph/I am writing a function whose input is a graph and some other data. I would like to store the computations that this program does each time it is run in a file with one file for each graph, so that, the next time it is run, it need not recalculate the calculations it has already done. In order to do this, I would like to assign a unique file name to each graph. I was thinking of using the hash function of the combinatorial object constructed from the graph to generate file names: `CombinatorialObject(G).__hash__()`
I have two questions:
1. Will this always work (the function taking a graph to this hash is well-defined and injective)?
2. Is there a better way to do this?
AmriFri, 19 Apr 2013 05:52:38 +0200https://ask.sagemath.org/question/10040/File IO in Notebookhttps://ask.sagemath.org/question/9583/file-io-in-notebook/Hi,
I'm using the Sage Notebook in Windows, with Sage running on a virtual machine. I want read/write files on my Windows machine within Sage. Is this possible?
Thanks.
EthanIowaWed, 28 Nov 2012 21:21:24 +0100https://ask.sagemath.org/question/9583/I don't find my Sage files?https://ask.sagemath.org/question/9173/i-dont-find-my-sage-files/Hi,
I wrote a program which does some computations on SAGE 5.0. I used Virtualbox Manager and my laptop has windows 7. Some days ago, my laptop fell and its hard disk broke. Furtunately, I am able to recover my files (by an external cable connecting the hard disk to a PC). But I couldn't find my program in SAGE.
I bought a new hard disk and installed SAGE 5.0 on it. I created a new file test, but I am even not able to see where this file is saved on my laptop.
Where are the SAGE files saved on PC? How can I recover or find my file in the broken hard disk?
Thank you for your help!sezar543Mon, 23 Jul 2012 14:31:24 +0200https://ask.sagemath.org/question/9173/Integrated data upload.https://ask.sagemath.org/question/9046/integrated-data-upload/I'd like to have something like the [single cell server](http://aleph.sagemath.org/) has when you click the 'advanced' button. I tried simply copying the html from the save/upload data page, but I get the error:
Error uploading file (missing url arg).
I can't seem to find the necessary html/javascript on the single cell server.
What I tried to use, except with <'s and \n\'s deleted:
html('div>
form method="POST" action="do_upload_data"
name="upload" enctype="multipart/form-data">
div>
label for="file">Browse your computer to select a file to upload:</label>
input size="50" type="file" name="file" />
</div>
div>
label for="name">What do you want to call it? (if different than the original name)</label>
input size="50" type="text" name="name" />
</div>
button type="submit">Upload or Create Data File</button>
</form>
</div>')ooglybooglyFri, 08 Jun 2012 12:46:58 +0200https://ask.sagemath.org/question/9046/how does a network operate and what controls have to be in place to share fileshttps://ask.sagemath.org/question/8476/how-does-a-network-operate-and-what-controls-have-to-be-in-place-to-share-files/sage - network systemsdeborahTue, 15 Nov 2011 08:00:38 +0100https://ask.sagemath.org/question/8476/