Question about Intel Computers & Internet

# How to make program of finfing the determinant of m*n matrix in C coding

Posted by on

• Level 2:

An expert who has achieved level 2 by getting 100 points

MVP:

An expert that gotĀ 5 achievements.

Vice President:

An expert whose answer gotĀ voted for 100 times.

Sniper:

An expert who has posted more than 50 answers, of which 90% or more were rated as helpful.

• Expert

I solve your problem but there is a little mistake that I can't find but maybe you can so here what I wrote:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <math.h>

#define n 3

typedef struct
{
double A[n][n];
int size;
}Matrix;

double det(Matrix mat);
Matrix cut(Matrix mat, int x);
int main(void)
{
clrscr();
double d;
Matrix mat;
mat.size=n;
mat.A[0][0]=1;
mat.A[0][1]=2;
mat.A[0][2]=3;
mat.A[1][0]=4;
mat.A[1][1]=4;
mat.A[1][2]=6;
mat.A[2][0]=7;
mat.A[2][1]=8;
mat.A[2][2]=9;

d=det(mat);
printf("%d",d);
getch();
return 0;
}
double det(Matrix mat)
{
double d=0;
if(mat.size>2)

for(int i=0;i<mat.size;i++)

d+=pow(-1,i)*mat.A[0][i]*det(cut(mat,i));

else

d=mat.A[0][0]*mat.A[1][1]-mat.A[0][1]*mat.A[1][0];

return d;
}
Matrix cut(Matrix mat, int x)
{
Matrix cutmat;
cutmat.size=mat.size-1;
for(int i=0;i<cutmat.size;i++)
for(int j=0;j<cutmat.size;j++)
if(j<x)
cutmat.A[i][j]=mat.A[i+1][j];
else
cutmat.A[i][j]=mat.A[i+1][j+1];
return cutmat;
}
Rate me if it helped!
And if you find the mistake please tell me where thanks.

Posted on Jul 07, 2009

## 1 Suggested Answer

Hi,
a 6ya Technician can help you resolve that issue over the phone in a minute or two.
Best thing about this new service is that you are never placed on hold and get to talk to real repair professionals here in the US.
click here to Talk to a Technician (only for users in the US for now) and get all the help you need.
Goodluck!

Posted on Jan 02, 2017

×

my-video-file.mp4

Complete. Click "Add" to insert your video.

×

## Related Questions:

### Calculator error

What's the determinant of the numbers in matrix A? A singular matrix is a matrix whose determinant is zero.

Mar 06, 2014 | Texas Instruments TI-84 Plus Calculator

### L want to know an example of a4 by 4 matrix determinant

One example: the determinant of a 4x4 identity matrix is 1.

Use the matrix editor to create a 4x4 matrix with 1s along the main diagonal (upper-left to lower-right) and 0s elsewhere. Then use the det() function to calculate the determinant of this matrix.

Sep 07, 2013 | Texas Instruments TI-83 Plus Calculator

### How to find the determinant by Sharp ELW516 Scientific Calculator

Press the MODE key. and press 4 for MATRIX.
To enter a matrix press the MATH button and choose 2 for EDIT. Determine the size of your matrix by typing in the row x column value (maximum 4). Then press =. Type in the values in your matrix. After each value press = to move to the next part of the table. Once your matrix is complete press ON and then the MATH button. This time choose 4 for STORE. Select the matrix name you would like to store your matrix in - for example choose 0 for matA. Now press MATH and press the down arrow key once. Select 6 for CALC and choose 0 for det (determinant). Then input the matrix you want the determinant of by pressing MATH and 1 for MATRIX. Select the matrix you would like to work with eg, matA and press then press =.

Aug 22, 2012 | Sharp ELW516 Scientific Calculator

### How to find rank of matrix using casio991 es??

The FX-991ES offers simple matrix operations like basic arithmetic, plus the slightly more complex operations determinant and inversion. Furthermore, it is limited to matrices with a maximum size of three rows and three columns.

The rank of a matrix is defined as the number of linearly independent row or column vectors. You can perform a simple partial test for square matrices by calculating the determinant of the matrix:
1. Enter the matrix into matrix variable MatA.
2. Press [SHIFT] [4] [7] [SHIFT] [4] [3] [)] [=]
The display now should show det(MatA) and the determinant of the matrix in the result. If the determinant is not 0, the rank of the matrix equals the dimension of the matrix, otherwise the rank is less than the dimension.

Unfortunately, this is all support the calculator offers. For small matrices (i.e. 4x4 or smaller), you should familiarize yourself with the Gau? Elimination Method algorithm for solving linear equation systems. It is a two-step procedure where a matrix first is converted to its row echelon form, and second to row canonical form to solve the LES.
You need to follow the algorithm only through the first part, the number of non-zero rows after this step equals the rank of the matrix. With a little exercise you will be able to do it faster on paper than trying to do it with your calculator only.

For larger matrices I suggest to use a PC with more powerful math software (Maple, Mathematica, ...) or, if you know some basic computer programming, just write the necessary program yourself, which is also a very good exercise both in programming and understanding the algorithm.

Jan 16, 2011 | Casio FX-115ES Scientific Calculator

### When trying to find the determinant of a matrix when i press OPTN and then F2 the MAT option doesn't come up, as well as F3 with the Det option.

When you press the OPTN key you see Tabs at the bottom of the screen. The second one from the left should be the submenu for matrix operations.. When you press F2:MAT, the new tabs are Mat, M>L (Matrix to List), Det (command to calculate the determinant etc.

Here is a detailed account of how to calculate the determinant of a square matrix.

I assume you know how to define your matrix, but I will repeat it here for others who might not know. You can skip to Calculation
1.Turn Calculator ON. If there are no icons, press [MENU].

Data Entry

2.Use arrows to highlight [MAT] icon. Press [ENTER]
3.Highlight the first line where it says Mat A. Use the right arrow to enter the dimensions of Matrix A. Enter 3 and press [EXE]. The cursor moves to the second dimension. Press 3 and press [ENTER].
4. The matrix entry screen appears.
5. Enter first matrix coefficient a_11 and press [ENTER]
6. Enter a_12 and [ENTER]
.....
Key in last coefficient a_33 and press [ENTER]

Calculation
Press [MENU] and [RUN]
Press [OPTN][F2:MAT][F3:Det] Command echoes on screen as det
Press [F1:Mat] echoes on screen as Mat; screen shows det Mat
Press [ALPHA] A The screen displays det Mat A
Press [ENTER] to calculate the determinant.

If the matrix is not square, you cannot calculate its determinant.

Dec 13, 2010 | Casio FX-9750GPlus Calculator

### How to find determinant

Given a square matrix, you can find its determinant by using the determinant function available through SHIFT 4 7. SHIFT 4 brings up the matrix menu, and 7 selects the determinant function.

Refer to the "Matrix Calculations" section in the manual, beginning on page E-57, and items #096-105 in the appendix. If you've misplaced your manual and/or appendix, you can download them from
http://support.casio.com/manualfile.php?rgn=1&cid=004001004

Dec 12, 2010 | Casio FX-115ES Scientific Calculator

### I want to solve my determinent of matrix A

Assuming you have a square matrix in MatA, press SHIFT [MATRIX] 7 SHIFT [MATRIX] 3 EXE

[MATRIX] is the shifted function of the 4 key. MATRIX 7 invokes the determinant function and MATRIX 3 names MatA

Oct 23, 2010 | Casio FX-115ES Scientific Calculator

### How to find the determinant

First you must set Matrix calculation
[MODE][6:Matrix]. Then By entering one of the numbers [1:MatA] or [2:Matb] or [3:MatC] you get to choose the dimensions of the matrix
(mxn]. Once finished entering the matrix you clear the screen.

The operations on A SINGLE matrix are available by pressing [Shift][Matrix]. The choices are
[1:Dim] to change the dimension of a matrix (in fact redefining the matrix)
[2:Data] enter values in a matrix
[3:MatA] access Matrix A
[4:Matb] access Matrix B
[5:MatC] access matrix C
[6:MatAns] access the Answer Matrix (the last matrix calculated)
[7:det] Calculate the determinant of a matrix already defined
[8:Trn] The transpose of a matrix already defined

Once you have created a square matrix, for example matA.
You press
[Shift][Matrix] [7:det] [SHIFT][MATRIX][3:MatA], close the parenthesis and press [ENTER].

Aug 17, 2010 | Casio FX-115ES Scientific Calculator

### I need to know how to get to reduced row echelon form

Hello,
The matrix cell operations (row calculations, column operation) are accessed as follows:

Press [Menu] button. Highlight [MATRIX] icon and press [EXE]. The list of matrices is diplayed. If you already created the matrix, it will be listed and you can select it (using the arrows) and press [EXE].
Three menu items are displayed:
F1:R.OP (Swap, XRw,XRw->,Rw->
F2:ROW (Del, Ins, Add)
F3: COL (Del, Ins, ADD)

Matrix Operations are accessed in RUN screen by pressing [OPTN] and selecting [F2:MAT] . Availabble options ( they are commands) are
F1: Mat displays identifier Mat on screen
F2: M->L converts a matrix to a list
F3: Det Calclates the determinant
F4: Trn Calculates the transpose of a matrix
F5: Aug Augments a matrix
F6 -> accesses additional operations
F1:Iden Create an identity matrix with specified dimensions
F2:Dim
F3: Fill

In addition to the foregoing you have the matrix operations (+, -, x, square, inverse).
However there is an additional piece of software that performs the row echelon reduction on the CFX9850GBPlus. The information is available here (page 13: program ROWREDA)

The program can be downloaded from this site.

Hope it helps.

Aug 15, 2009 | Casio FX-9750GPlus Calculator

### I get a dimension error on my screen from my matrix

Hello,
You cannot calculate the inverse of an arbitrary matrix. It must be a square matrix (nxn) with non zero determinant. Make sure dimensions m and n are equal. (2x2), (3x3)

To calculate its determinant [Shift][MATRIX] [7:det] [SHIFT][MATRIX][3:MatA] close the right parenthesis and [=].
If determinant is different from zero then you can calculate its inverse.
If matrix MatA has already been defined, you calculate its inverse as follows;
[SHIFT][MATRIX][3:MatA] [X^-1][=]. Use the X to -1 power , the one under [MODE].
For well-behaved matrices you calculate the inverse directly without worrying about the determinant.
Hope it helps.

Apr 16, 2009 | Casio FX-115ES Scientific Calculator

## Open Questions:

#### Related Topics:

401 people viewed this question

## Ask a Question

Usually answered in minutes!

Level 3 Expert

Level 3 Expert