Hi Francois!

Sorry that I can't answer all of your questions, but I hope that
others will step in.

On 15 Okt., 14:27, Francois Maltey <fmal...@nerim.fr> wrote:
[...]
> And a second question : I don't find any example in python documentation
> for list with .. as  [1..100].
>
> Is it a standard python or a sage feature ?

You noticed something about preparser in your comments about 'timeit'.
In fact, Sage uses a preparser to make working on the command line a
bit easier. So, [1..100] is a Sage feature.

But as Sage builds upon Python, you can easily find out about the
preparser:
1. Autocompletion:
  sage: prep<TAB key>
yields the possible completions "preparse" and "preparser".

2. Documentation:
  sage: preparse?
yields

        EXAMPLES:
            sage: preparse("ZZ.<x> = ZZ['x']")
            "ZZ = ZZ['x']; (x,) = ZZ._first_ngens(1)"
            sage: preparse("ZZ.<x> = ZZ['y']")
            "ZZ = ZZ['y']; (x,) = ZZ._first_ngens(1)"
         ...

So, if you want to see how Sage processes [1..100], just try it:
  sage: preparse("[1..100]")
  sage: preparse("[1..100]")
  '(ellipsis_range(Integer(1),Ellipsis,Integer(100)))'

ellipsis_range is no python built-in, but again you can find out more
by putting a question mark after it.

> Is sage a huge library over a standard python ? or has sage any syntax
> feature ?

I think it is both. All Python-2.6 stuff is valid in Sage, but Sage
has a preparser, and of course (if you want to do real programming) it
has Cython.

> I discover the *arg in defined function by def (in sage and the usual
> python)
> But I don't find any factorial by n! nor lambda function defined with a
> arrow +-> or ->

There was some recent discussion about allowing "n!", but IIRC the
idea was dropped because, though "n!" might be convenient, it is not
easy to tell what 7!! is supposed to be: 1*3*5*7 (double factorial) or
factorial(factorial(7)) (huge number)?

There is, of course
  sage: f = lambda x: x^2
  sage: f(5)
  25
but I don't think there is arrow notation.

Best regards,
Simon

--~--~---------~--~----~------------~-------~--~----~
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