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

Make a program with ( VISUAL STUDIO /C) that takes in matrices A, B and X. and f

ID: 3875409 • Letter: M

Question

Make a program with ( VISUAL STUDIO /C) that takes in matrices A, B and X. and find the solution for X=inv(A) * B using CRAMER'S RULE 1. you have to take in matrices A B and X in the main function The size of Matrix A may vary from 2x2 to 5x5 and so does size of B and X 2. A and B can be float/double numbers 3. X is a vector with all inputs as characters 4. Use Cramer's rule to find the solution. make a separate function for finding determinant of the matrix. check if det(A)==0 to determine the solution is possible or not. display your results for the characters in vector X

Make a program that takes in matrices A, B and X and find the solution for X-inv(A) B using CRAMER'S RULE Project BASIC REQUIREMENTS 1. you have to take in matrices A B and X in the main function The size of Matrix A may vary from 2x2 to 5x5 and so does size of B and X 2. A and B can be float/double numbers 3 Xis a vector with all inputs as characters 4 Use Cramers rule to find the solution make a separate function for finding determinant of the matrix. check if det(A)--0 to determine the solution is possible or not. display your results for the characters in vector X ai di ci C1 as bs C as ba Cs as bs c BONUS 1. instead of inputting the elements of A B and X the inputs are taken as the equations in the form of STRINGS the elements of A B and X are extracted from the input strings in this case the characters input for each element of A and B are in the from of sTTTTWW where, s is -for negative number and+for positive number T are digits before decimal V are digits after decimal the equation entered MUST be like +1023-557a-22.005A +2.0M 0.004 2 make separate RECURSIVE FUNCTION for finding determinant of the matrices

Explanation / Answer

#include<iostream>

using namespace std;

int main()

{

int det(int matA[3][3]);

int Trans(int matA[3][3]);

int cofactor(int mat[3][3]);

int inv(int matA[3][3]);

int solve(int matA[3][3],int b[3]);

int x,A[3][3],B[3][3],b[3],C[3][3];

cout<<"Do you want to solve an equation in the form Ax=b?" <<endl;

cout<<"Enter your matrix A";

cin >>A[3][3];

cout<<"Enter your vector b";

cin>>b[3];

cout<<"The solution is"<<inv(A)*b[3];

}

int det(int matA[3][3]);

{

return (A[0][0]*((A[1][1]*A[2][2])-(A[1][2]*A[2][1])))-(A[0][1]*((A[1][0]*A[2][2])-(A[1][2]*A[2][0]))+(A[0][2]*((A[1][0]*A[2][1])-(A[1][1]*A[2][0]))));

}

int Trans(int matA[3][3]);

{

int i;int j;

for (int i=0;i<3;i++)

for(int j=0;j<3;j++)

B[i][j]=A[j][i];

return B[i][j];

}

int cofactor(int matB[3][3]);

{

return;

{

C[0][0]=B[1][1]*B[2][2]-B[2][1]*B[1][2];

C[0][1]=-(B[1][0]*B[2][2]-B[2][0]*B[1][2]);

C[0][2]=B[1][0]*B[2][1]-B[2][0]*B[1][1];

C[1][0]=-(B[0][1]*B[2][2]-B[2][1]*B[0][2]);

C[1][1]=B[0][0]*B[2][2]-B[2][0]*B[0][2];

C[1][2]=-(B[0][0]*B[2][1]-B[2][0]*B[0][1]);

C[2][0]=B[0][1]*B[1][2]-B[1][1]*B[0][2];

C[2][1]=-(B[0][0]*B[1][2]-B[1][0]*B[1][2]);

C[2][2]=B[0][0]*B[1][1]-B[1][0]*B[0][1];

}

}

int inv(int matA[3][3]);

{if (det<=0)

cout<<"the inverse does not exist";

else return (Trans(cofactor(A)))/det;

}

int solve(int matA[3][3],int vectb[3]);

{

return inv(A)*b[3];

}

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