Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A matrix is symmetric if every element of the matrix at row i and column j is equal to theelement at row j and column

A matrix is symmetric if every element of the matrix at row i and column j is equal to theelement at row j and column i. A matrix can only be symmetric if it is a square matrix(that is, the matrix has the same number of rows as columns).  Your task is to construct a Python function called symmetric which expects one argument: a two-dimensional table representing a square matrix. Your function should return True if the matrix is symmetric and False otherwise. You may assume that the table passed as the argument will have the same number of rows as columns and that it will contain only numbers.  Here are some examples of how your function should behave:

>>> m1 = [[5, 4, 3], [4, 0, 7], [3, 7, -1]]

>>> m2 = [[5, 4, 3], [4, 0, 6], [3, 7, -1]]

>>> m3 = [[0, 0], [0, 0]]

>>> m4 = [[0, 0], [1, 0]]

>>> symmetric(m1)True

>>> symmetric(m2)False

>>> symmetric(m3)True

>>> symmetric(m4)False

Step by Step Solution

There are 3 Steps involved in it

Step: 1

You can create the symmetric function as follows def symmetricmatrix Check if ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

What are the benefits of using positive self-talk? (p. 151)

Answered: 1 week ago