Re: calculation on lists

Discussion in 'Python' started by Vlastimil Brom, Dec 19, 2012.

  1. 2012/12/19 loïc Lauréote <>:
    > hi,
    > I
    > have a question,
    > is there a tool to calculate on list ?
    >
    > something like :
    >
    >>a= [1,1,1,1]
    >>b = [5,9,8,4]
    >>c = a+b*a
    >>print c
    >>[6,10,9,5]

    >
    > Thx
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >


    Hi,
    I guess, if you are interested in effective and more complex matrix
    computations, you might have a look at numpy:
    http://www.numpy.org/
    Is the following the result you expect? (it seems so, based on the
    (added) output of your posted code, but its incompatible with the
    example in the first post).

    >>> import numpy
    >>> a=numpy.array([4,5])
    >>> b=numpy.array([6,7])
    >>> b*b+a

    array([40, 54])
    >>>


    hth,
    vbr
     
    Vlastimil Brom, Dec 19, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    448
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  2. loïc Lauréote

    calculation on lists

    loïc Lauréote, Dec 19, 2012, in forum: Python
    Replies:
    0
    Views:
    120
    loïc Lauréote
    Dec 19, 2012
  3. Vlastimil Brom

    Re: calculation on lists

    Vlastimil Brom, Dec 19, 2012, in forum: Python
    Replies:
    0
    Views:
    124
    Vlastimil Brom
    Dec 19, 2012
  4. loïc Lauréote

    calculation on lists

    loïc Lauréote, Dec 19, 2012, in forum: Python
    Replies:
    0
    Views:
    132
    loïc Lauréote
    Dec 19, 2012
  5. Tim Chase

    Re: calculation on lists

    Tim Chase, Dec 19, 2012, in forum: Python
    Replies:
    0
    Views:
    129
    Tim Chase
    Dec 19, 2012
Loading...

Share This Page