Dear Genaro,
Thanks for the interest in Sage!

On Dec 16, 10:38 am, Gennaro Alphonse <gena...@gmail.com> wrote:
> Sorry, i'm new using Sage, i'm currently using the version 4.2.1. A
> question I have, How can i save a file or worksheet to an .sage
> extension file from the notebook?? I see that I only can save to .sws
> file.

Hmm, unfortunately this is not implemented:

1) Because a .sage file is really just a bunch of Python commands plus
Sage pre-parsing, so it can't necessarily contain all the fun things
like the *output* of those commands and the text/TeX commenting one
can do in the notebook.  So in some sense this isn't possible.

2) Because we don't (yet, but soon should) have an easy download
option for just the HTML/text of the worksheet.  However, if you want
to get it, you can click "Edit" and then just select all the text!  I
don't know if there is any way to get only the commands without
deleting other stuff, though.

I hope this helps, and please ask more if it doesn't!

> Another question is to use a .sage file, i need to define it with a
> function with the def command, or I can use the function command?
>

This question is less clear.  The function command creates a symbolic
function
sage: f = function('f',x)
sage: f(3)
f(3)
(at least I think it will do this).  If you want to make a callable
function the usual way to do it is:
sage: f(x)=x^2
but if you need something more complicated (that is, non-mathematical
but logical), you will need to create a Python function using def.
sage: def f(x):
....         if x>5:
....            return x^3
....         else:
....            return "nope, not what I wanted"
....

I'm not sure if this answers your question, though.

- kcrisman

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to