Could use the map command:

sage: a(n)=n^2
sage: map(a,[1,2,3])
[1,4,9]

Cheers
Jamie

On Wed, Nov 2, 2011 at 9:52 AM, A. Jorge Garcia <[email protected]> wrote:
> My discrete math class was playing with sequences today.
>
> Example 1)
> a(n)=1/n**2
> for I in range(1,10):
>    show(a(I))
>
> Example 2)
> [a(n) for I in range(1,10)]
>
> These methods work fine. I'm confused on how to write function for
> a(n) where I can just input a list, process the list and output a new
> list with the sequence evaluated.
>
> So, if a(n)=n**2 and the input is [1,2,3] the output should be
> [1,4,9].
>
> TIA,
> A. Jorge Garcia
> http://shadowfaxrant.blogspot.com
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-edu" group.
> 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-edu?hl=en.
>
>



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jamie Mulholland, Ph. D.            e: [email protected]
Dept. of Mathematics                  t:  778-782-7655
Simon Fraser University              f:  778-782-4947
8888 University Drive
Burnaby, B.C. V5A 1S6
Canada
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
You received this message because you are subscribed to the Google Groups 
"sage-edu" group.
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-edu?hl=en.

Reply via email to