Afonso Henriques Silva Leite wrote:
> I am studying documentation, but also am in a hurry! I need to create a
> 1000x2 matrix, and apply a function to the second column. It is possible
> to do this? I think map function is a good candidate to do that but
> didn't find out a good example of it...
> Thanks in advance.
> 

One way:

sage: a=matrix(5,2,range(10))
sage: a

[0 1]
[2 3]
[4 5]
[6 7]
[8 9]
sage: a[:,1]=[[i^2] for i in a[:,1].list()]
sage: a

[ 0  1]
[ 2  9]
[ 4 25]
[ 6 49]
[ 8 81]

Or you could just use a for loop...

Jason


--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to