Ask Your Question
1

how to sage a .sage file

asked 2018-03-15 18:27:18 +0200

kate_l196 gravatar image

updated 2019-08-26 21:16:10 +0200

FrédéricC 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

Comments

1

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 10:27:13 +0200 )edit

3 Answers

Sort by » oldest newest most voted
4

answered 2018-03-27 11:17:25 +0200

Iguananaut gravatar image

updated 2018-03-27 11:18:07 +0200

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
0

answered 2019-03-22 22:53:46 +0200

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

Comments

Works absolutely fine in the Sage Shell, after landing in the the right file directory. Be careful with folder names with spaces ; in that case enclose the name with single quotation marks. No need for me to load the file, I just typed the command such as : Sage 'file name.sagetex.sage', got some other files and folders in the file directory, then recompile the *.tex document as said in other answers, and Bam ! All calculations and graphics done in the pdf (in my case PDF Latex is the compiler) obtained ! The compilation is like a formal machine ! Great.

Cinefou gravatar imageCinefou ( 2022-08-04 20:19:53 +0200 )edit
0

answered 2019-09-28 23:17:47 +0200

I was overjoyed to find that, on my Windows 10 PC, the sagemath 8.8 "shell" produced an ASCII terminal window.

The window understands vi (although the existent .exrc file has no effect).

And, from within a vi session, SEEMS to understand "!sage %" to run the current file.

Only thing: where's the sage-run output go?

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

Stats

Asked: 2018-03-15 18:27:18 +0200

Seen: 3,397 times

Last updated: Mar 27 '18