Ask Your Question

Revision history [back]

Can you please help me with this task in sage?

1) Enter the program function sum_quadrate() with matrix A.The function returns the sum of those matrix elements that are complete squares. The x is complete square if the command is_square (x) returns the True value.

          [4 1 6 ]

matrix A=[1 3 9 ] [2 7 25] ...

def sum_quadrate (A): m=A.nrows() n=A.ncols() True=0 for i in range (m): for j in range(n): if....??? I wrote this but from last row i dont know what goes next

PLEASE HELP

Can you please help me with this task in sage?

1) Enter the program function sum_quadrate() with matrix A.The function returns the sum of those matrix elements that are complete squares. The x is complete square if the command is_square (x) returns the True value.

  [4 1 6 ]

matrix A=[1 3 9 ] [2 7 25] ...

...

def sum_quadrate (A): m=A.nrows() n=A.ncols() True=0 for i in range (m): for j in range(n): if....???

I wrote this but from last row i dont know what goes next

PLEASE HELP