On 9/17/07, Peter G. Doyle <[EMAIL PROTECTED]> wrote:
>
> I have recently discovered SAGE, which I think is really quite amazing.
>
> I am contemplating introducing the students in our honors calculus course
> here at Dartmouth to SAGE.  I'm a bit leery about this, since I'm new to
> SAGE
> myself.  I'm wondering if you can suggest materials (e.g. sample
> worksheets)
> I could crib from.


The time might not quite by right for doing this, since there isn't very
much
written about using SAGE for calculus beyond the reference manual chapter,
which you already know about. I will teach calculus 1 year from now, and
have
my own very nice notes (which I made by sitting in on the best calculus
teacher's
class at UCSD), and will change them to use SAGE.  But that project is a
year away.  I'm not aware of anybody else creating extensive notes on using
SAGE for calculus yet.  (I'm cc'ing this to sage-devel -- if anybody there
has
any comments, please make them.)

That said, one of the main longterm goals of SAGE is to provide a viable
alternative
to Maple, Mathematica, Matlab, and Magma, and for that to happen being up
to snuff for calculus teaching is very important.  (For me longterm means
"about
a year".)

Some observations about SAGE.
>
> --  It would be great to have a short, simple description of
> how to save and retrieve worksheets.  And maybe there could be an
> `Open Worksheet' option on the file menu, right below `New Worksheet',
> where it usually comes.  It took be the longest time to find the `Home'
> button!



I agree. This has bugged me too.  This is now trac ticket #682:

http://trac.sagemath.org/sage_trac/ticket/682


--  It's still far from clear to me what `downloading' and `uploading' are
> supposed to mean.



It's supposed to be exactly the same as "save" and "open".  Maybe I should
change the names to "save" and "open"?  Right now the terminology just
follows Google Documents (which inspired much of the notebook's layout).


> --  When I install an updated version of SAGE, my old worksheets aren't
> available.  I've been finding them, opening them with a text editor, and
> copying the text into a new worksheet.  I bet there is a better way.


That's very weird.
There was some slight change in the root account versus admin account
that might be responsible for this.  It never happen again in the future.

--  I think that the Python convention of not including the upper bound
> in a sum is a real problem.
>
> sage: sum(i for i in range(1,10))
> 45
>
> I understand this is a fundamental convention in Python, and that it is
> very
> natural for people used to malloc(), but I worry that this will be a
> constant
> headache for students (and professors!).


Indeed, this is perhaps one of _the_ fundamental conventions.

SAGE understands that I want to
> include the upper limit when I ask for a taylor series:
>
> sage: taylor(exp(x),x,0,3)
> 1 + x + x^2/2 + x^3/6


Maybe that is a bug? :-)


> But in a sum it pretends not to understand what I mean.  I guess I could
> define `myrange' to include the upper bound.  But I think it would be
> better
> if you could come up with a nice, clean way to protect users from
> this aspect of Python, as you have protected us from other aspects
> (like ^, /, long integers).


it would be easy to do this:

sage: import __builtin__; range = lambda a,b: __builtin__.range(a,b+1)
sage: range(1,10)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

However, I am pretty sure people would complain about that way way
more than they complain about the current situation, especially because
a huge amount of code from books on Python wouldn't work anymore.
There is a good reason range is defined the way it is in Python.
With the above, you have to do funny things like this, i.e., put
in len(v)-1, which is equally unnatural:

sage: v = [1,5,17]
sage: for i in range(0,len(v)-1): print v[i]
....:
1
5
17


A better solution would, as you suggest, to define a function like
range -- but not called range -- that includes both endpoints.
One possibly nasty possibility would be to allow Magma-like
notation:
  sage: [1..4]
  [1, 2, 3, 4]

I can't think of any situation where .. (not in a string) is valid Python,
so the above might be a reasonable option.

How does one specify an integer range in Maple, Mathematica, Maxima?

--  Speaking of long integers, I think this is probably a bug:
> sage: sum(i for i in xrange(10^6))
> 499999500000L


That is not a bug.  Python's native long integer type has the unfortunately
very annoying property that it prints with an L suffixed. You can make it
back into a regular SAGE integer by doing the following:

sage: Integer(sum(i for i in xrange(10^6)))
499999500000

Some remarks:
   * Small Python integers (like in the sum above) are much faster for
arithmetic
than SAGE's large integer type (Integer).
   * SAGE's large integer type is vastly faster than Python's integers when
the
integers are big.  It's based on GMP.
   * You could do the sum above entirely with SAGE GMP integers using the
xsrange command, but it would be much slower:
sage: time sum(i for i in xrange(10^6))
CPU times: user 0.10 s, sys: 0.01 s, total: 0.11 s
Wall time: 0.11
499999500000
sage: time sum(i for i in xsrange(10^6))
CPU times: user 2.96 s, sys: 0.03 s, total: 2.98 s
Wall time: 3.01
499999500000
   Part of the problem is that xsrange is in pure python -- it's not
optimized at all.


> --  The response to `latex?' seems to be out of date.
>
>         %latex
>         The equation y^2 = x^3 + x defines an elliptic curve.
>         We have 2006 = SAGE{factor(2006)}.
>
> I thought it was a great credit to SAGE that when I edited the sample
> input
> in what seemed the obvious way, enclosing the math in $$ and changing SAGE
> to \sage, that it worked as expected.



Ah, you've found a bug.  What happens is that all SAGE documentation
is de-texed before displaying in the notebook (in plain text format).
Unfortunately
this detexing makes the documentation for latex appear completely
wrong!


The solution is probably to come up with a notation to tell SAGE not
to do the detexing.  This is now trac #683.


--  Regarding latex, it would be great to have a simple description of
> how to use the notebook interface to produce a paper in latex
> incorporating
> sage input and output,


It would be great if it were possible to do that.  Creating a "save as
latex"
option in the notebook has been on the todo list for a long time.  I have
some "big plans" along these lines (in both directions)...

--  I haven't yet figured out how to run consistency tests (making sure
> that examples have the correct output) within a sage notebook.


This is also not implemented.  If the code doesn't take to long to compute,
I usually just click "Evaluate All" under Action.  Then the output you see
is definitely what SAGE produced.

Another thing you can do -- if foo.tex is a tex file that contains
SAGE sessions in verbatim environments, then you can type
  sage -t foo.tex
to make sure they work as claimed.  The SAGE sessions
have to be like from the command line -- which you can get by clicking
"Text" in the notebook, which will reformat a notebook session to
look like a command line session (though it doesn't work for things
that don't make sense at the command line, e.g., %latex).
Also, if one verbatim block depends on the results of another
you have to do this:

\begin{verbatim}
sage: a = 5
\end{verbatim}%link


....

%link
\begin{verbatim}
sage: print a
5
\end{verbatim}



 -- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to