Search Result

Collapse
2 results in 0.0013 seconds.
Keywords
Members
Tags
matrices
  •  

  • basic python question about lists and matrices

    I'm learning python through the "How to think like a computer scientist" book. There is a certain exercise that multiplies a matrix m by a scalar n:

    Code:
    def scalar_mult(n, m):
     """
    	>>> a = [[1, 2], [3, 4]]
    	>>> scalar_mult(3, a)
    	[[3, 6], [9, 12]]
    	>>> b = [[3, 5, 7], [1, 1, 1], [0, 2, 0], [2,2, 3]]
    	>>> b
    	[[3, 5, 7], [1, 1, 1],
    ...
    See more | Go to post
    Last edited by bvdet; Jan 4 '11, 12:53 PM. Reason: fixed indentation

  • jeckstrom
    started a topic Subtract value from column

    Subtract value from column

    This is my code thus far:

    Code:
    #! /usr/local/bin/python
    
    import sys
    import numpy
    
    A = numpy.matrix([[3.8351274705,  -0.1448460097,   5.8649306918],
                 [3.0383950010,   0.4744278528,   6.3044376843],
                 [4.5435746933,   0.5586559729,   5.4015817017]])
    What I need to be able to do is subtract the value of A(0,0) from the entire column 0. Unfortunately, I have...
    See more | Go to post
Working...