Thank you for your answer! Marco
On 11 Giu, 08:01, Robert Bradshaw <rober...@math.washington.edu> wrote: > On Jun 10, 2010, at 12:22 PM, Christian Stump wrote: > > > > >> m=[0.6158, 0.5893, 0.5682, 0.51510, 0.4980, 0.4750, 0.5791, > >> 0.5570,0.5461, 0.4970, 0.4920, 0.4358, 0.422, 0.420] > >> m.count > > > len(m) does the job, you should probably look into the tutorial at > >http://www.sagemath.org/doc/tutorial/for this kind of questions... > > > m.count is a function returning the number of times some element > > appears in the list, so [1,2,3,2,2,4].count(2) returns 3 > > >> Another similar thing, i want to multiply the all the elements for > >> 10^-6 > > > if you want to apply a function to every element in a list, you can do > > that by [ f(i) for i in your_list ]. > > > e.g., [ 2*i for i in [1,2,3] ] returns 2,4,6 > > Or, you might want an actual vector. > > sage: m = vector([0.6158, 0.5893, 0.5682, 0.51510, 0.4980, 0.4750, > 0.5791, 0.5570,0.5461, 0.4970, 0.4920, 0.4358, 0.422, 0.420]) > sage: len(m) > 14 > sage: m * 10^-6 > (6.15800000000000e-7, 5.89300000000000e-7, 5.68200000000000e-7, > 5.15100000000000e-7, 4.98000000000000e-7, 4.75000000000000e-7, > 5.79100000000000e-7, 5.57000000000000e-7, 5.46100000000000e-7, > 4.97000000000000e-7, 4.92000000000000e-7, 4.35800000000000e-7, > 4.22000000000000e-7, 4.20000000000000e-7) -- 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