I need a lot of help...
Peter Otten
__peter__ at web.de
Sun Dec 25 03:13:50 EST 2016
Peter Otten wrote:
> raulmaqueda6398 at gmail.com wrote:
>
>> I do not know how to do this exercise, does anyone help me?
>>
>> Define the matrix_range (m) function that returns the range of an array
>> calculated by the Gaussian method.
>>
>> It should work with any number of rows and columns. No punctuation will
>> be given to deliveries that do not respect this requirement.
>>
>>
>> Operating example:
>>
>>>>> matrix_range ([[1,0,0], [0,1,0], [0,0,1]])
>> 3
>
> If this were not a homework problem you'd use numpy.linalg.matrix_range().
Of course Peter Pearson's hint applies to my answer. The above function
doesn't exist, it should be numpy.linalg.matrix_rank()
>>> numpy.linalg.matrix_rank([[1,0,0], [0,1,0], [0,0,1]])
3
which should not be confused with numpy.rank() that just returns the number
of dimensions:
>>> numpy.rank([[1,0,0], [0,1,0], [0,0,1]])
2
>>> numpy.rank([[[[[[]]]]]])
6
> In your case, however, your teacher wants you to implement the algorithm
> yourself.
>
> Do you know how to calculate the matrix range with pen and paper?
>
> Write down the steps in plain english and then try to implement them one
> after another in Python. Once you have some code and run into a problem
> you have something to show us, and we'll happily give you the hints
> necessary to fix it.
More information about the Python-list
mailing list