Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Wondering if someone can help me with this or help me start it off because there

ID: 3535301 • Letter: W

Question

Wondering if someone can help me with this or help me start it off because there are more things to do, I just don't know how to start it.


Write a program in which you define a class Mat2By2 that models some of the behaviors of a 2×2 matrix. The program should meet these requirements.

A. Your class must consist of four data members, of type double, topLeft, topRight, botLeft, and botRight, representing the four entries of a 2×2 matrix. It will contain the following functions:

/**

* default constructor that sets all entries of the matrix to 0

*/

Mat2By2()

/**

a parameterized constructor that sets the topLeft to topLeftVal,topRight to topRightVal, bottomLeft to bottomLeftVal and bottomRight to bottomRightVal.

@param topLeftVal - the value of the top-left entry.

@param topRightVal - the value of the top-right entry.

@param bottomLeftVal - the value of the bottom-left entry.

@param bottomRightVal - the value of the bottom-right entry.

*/

Mat2By2(double topLeftVal, double topRightVal,double bottomLeftVal,double bottomRightVal)

/**

* This function adds two 2 x 2 matrices.

* @param rhs a 2 x 2 matrix object to be added to this matrix.

* @return a new matrix object that represents the sum of

* this matrix and the rhs matrix object.

*/

Mat2By2 add(const Mat2By2& rhs) const

/**

* This function subtracts two 2 x 2 matrices.

* @param rhs a 2 x 2 matrix object to be subtracted from this matrix.

* @return a new matrix object that represents the difference of

* this matrix and the rhs matrix object.

*/

Mat2By2 subtract(const Mat2By2& rhs) const

/**

* This function multiplies two 2 x 2 matrices.

* @param rhs a 2 x 2 matrix object to be mulitplied by this matrix.

* @return a new matrix object that represents the product of

* this matrix and the rhs matrix objects.

*/

Mat2By2 multiply(const Mat2By2& rhs) const

/**

* computes the determinant of this 2 x 2 matrix.

* @ return the determinant

*/

double determinant() const

/**

* determines whether this matrix and the specified matrix

* equal.

* @param rhs a 2 x 2 matrix

* @ return true if corresponding entries are equal; otherwise,

* false;

*/

bool equal(const Mat2By2& rhs) const

/**

* This function computes the inverse of this two 2 x 2 matrices

.

* @return a new matrix object that represents the inverse of

* this matrix.

* @throw logic_error when the determinant of this matrix is 0

*/

Mat2By2 inverse() const

/**

* This function computes the transpose of this two 2 x 2 matric

es.

* @return a new matrix object that represents the transpose o

f

* this matrix.

*/

Mat2By2 transpose() const

/**

* @return a string representation of this matrix

* in the form {{topLeft,topRight},{bottomLeft,bottomRight}},

* where topLeft is the top-left entry of the matrix, topRight

* is the top-right entry of the matrix, bottomLeft is the

* bottom-left entry of the matrix, and bottomRight is the

* bottom-right entry of the matrix.

*/

string str()



Your program should compute the following expressions:

(a) m1+ m3 =?

(b) m3(m1−m2) x inv(m3−m2) =

(c) (m_3)^6=?

(d) inv(m1x inv(m2)) x (m3+m2)

(e) ∆(inv(m3×m1)) =?

(f) (m3 +m1)×(m3 +m2) =?.

(g)tr(m1 +inv(m2)) = ?.

(h) Your program should answer this question:

Is inv(m1×m2) =inv(m2)×inv(m1)? Yes/No

(i) Your program should answer this question:

Is tr(m1 +m2) =tr(m1) +tr(m2)? Yes/No

Run you program for various values of the matrices m1, m2, and m3 including

cases in which there are divide-by-zero errors and cases in which there are

not any. Make sure that all of the arithmetic operators work properly and

that all matrices are displayed in their in-line form.

Explanation / Answer

You can find my code here: It contains all the operations you need :) http://www.speqmath.com/tutorials/matrix/matrix.html Please rate with 5 stars :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote