Ask Your Question

how to sage a .sage file

asked 2018-03-15 12:27:18 -0500

kate_l196 gravatar image

updated 2018-03-15 20:52:23 -0500

tmonteil gravatar image

I am having sage installed on a windows 10. Sage file example.sage.sage which is generated by sagetex is situated in K:\sageexample folder. How to run sage on this file. All references are full of jargonism and don't explain anything at all or give examples. I run sage shell and prompt: run ('K:sageexample\example.sage.sage') but no result. I run load command load ('K:sageexample\example.sage.sage') no example. I don't want to install linux for one program. How to "sage" a file from notebook interface?

edit retag flag offensive close merge delete



How did you install Sage ? On Windows, there are currently two possibilities :

  • installing the Sage virtual appliance (= a Linux virtual machine) and running it in Virtualbox.

  • Installing Erik Bray's installer (which creates a minimal Cygwin tree).

Both of these are mainly oriented to the interactive use of Sage from either a Jupyter worksheet or a "Sage console". Running Sage from the command line to compile example.sagetex.sage is a third (marginal) case, for which you need to be at a terminal :

  • A Linux terminal in the first case

  • A Cygwin terminal in the second case.

So tell us how you did install Sage...

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2018-03-17 04:27:13 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2018-03-27 04:17:25 -0500

Iguananaut gravatar image

updated 2018-03-27 04:18:07 -0500

Assuming that you installed the Windows native version of Sage, run the "SageMath Shell" which opens a command-prompt, and run

sage 'K:\sageexample\example.sage.sage'

at the prompt (for example, based on the filename in the question). Note that this a a bash (Unix-like) shell, where the backslashes used in Windows paths imply an escape character normally, which might have been your problem. So it's necessary to enclose the path in single-quotes for it to be interpreted correctly.

Alternatively you can use forwardslashes instead of backslashes like

sage K:/sageexample/example.sage.sage

This will be interpreted correctly as a Windows path as long at it starts with a valid drive letter.

edit flag offensive delete link more

answered 2019-03-22 16:53:46 -0500

On windows, open Sagemath shell and navigate to the folder where your file is placed. You should use "cd" command. Be carefull with folders with spaces. In that case write folder name between ' '

tu process the file you should write load('file.sage') (file is the name of your file)

edit flag offensive delete link more

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: 2018-03-15 12:27:18 -0500

Seen: 223 times

Last updated: Mar 27 '18