answersLogoWhite

0


Best Answer

from:

http://local.wasp.uwa.edu.au/~pbourke/other/determinant/

/*

Recursive definition of determinate using expansion by minors.

*/

double Determinant(double **a,int n)

{

int i,j,j1,j2;

double det = 0;

double **m = NULL;

if (n < 1) { /* Error */

} else if (n j1)

continue;

m[i-1][j2] = a[i][j];

j2++;

}

}

det += pow(-1.0,1.0+j1+1.0) * a[0][j1] * Determinant(m,n-1);

for (i=0;i<n-1;i++)

free(m[i]);

free(m);

}

}

return(det);

}

//New Answer By Shaikh SOHIAL Hussain form Pakistan

#include<stdio.h>

#include<conio.h>

void main ()

{ clrscr();

int a[10][10],row,i=0,j=0,result,w,x,y,z;

printf("This Program made 4 solve matrix determintae\n");

scanf("%d",&row);

while(i<row)

{printf("\n");

for(j=0;j<row;j++)

{ printf("Enter the value of %d%d\n",i,j);

scanf("%d",&a[i][j]);

}

i++;

}

i=0;

while(i<row)

{ printf("\n");

j=0; while( j<row)

{printf("%d",a[i][j]);

printf(" ");printf(" ");

j++;}

i++;

}

if(row==2)

{

result=(a[0][0]*a[1][1])-(a[0][1]*a[1][0]);

printf("The answer is\t %d",result);

}

else if(row==3)

{ result=(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])));

printf("\nThe answer is \t %d",result);

}

else if(row==4)

{

w=a[0][0]*(a[1][1]*(a[2][2]*a[3][3]-a[2][3]*a[3][2])-a[1][2]*(a[2][1]*a[3][3]-a[2][3]*a[3][1])+a[1][3]*(a[2][1]*a[3][2]-a[2][2]*a[3][1]));

x=a[0][1]*(a[1][0]*(a[2][2]*a[3][3]-a[2][3]*a[3][2])-a[1][2]*(a[2][0]*a[3][3]-a[2][3]*a[3][0])+a[1][3]*(a[2][0]*a[3][2]-a[2][2]*a[3][0]));

y=a[0][2]*(a[1][0]*(a[2][1]*a[3][3]-a[2][3]*a[3][1])-a[1][1]*(a[2][0]*a[3][3]-a[2][3]*a[3][0])+a[1][3]*(a[2][0]*a[3][1]-a[2][1]*a[3][0]));

z=a[0][3]*(a[1][0]*(a[2][1]*a[3][2]-a[2][2]*a[3][1])-a[1][1]*(a[2][0]*a[3][2]-a[2][2]*a[3][0])+a[1][2]*(a[2][0]*a[3][1]-a[2][1]*a[3][0]));

result=w-x+y-z;

printf("\n The answer is \t %d", result);

}

else{ printf("Determinate Limit is 4*4 max\n");

getch();

}

User Avatar

Wiki User

โˆ™ 2011-01-23 19:37:00
This answer is:
User Avatar
Study guides

Algebra

20 cards

A polynomial of degree zero is a constant term

The grouping method of factoring can still be used when only some of the terms share a common factor A True B False

The sum or difference of p and q is the of the x-term in the trinomial

A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

โžก๏ธ
See all cards
3.75
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
844 Reviews

Add your answer:

Earn +20 pts
Q: Calculate determinants of a nxn matrix in C programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How to write a c programme to calculate determinants of a nxn matrix without using pointers?

You can find the answer of this questions from this link. Also, you can find the related answers to c programming. http://study-for-exam.blogspot.com/2013/04/write-c-progrm-to-find-determinant-of.html#.UXiMc4Jbwxg"


What is leontief inverse matrix?

(I-A)-1 is the Leontief inverse matrix of matrix A (nxn; non-singular).


Is Inverse of the inverse matrix the original matrix?

Let A by an nxn non-singular matrix, then A-1 is the inverse of A. Now (A-1 )-1 =A So the answer is yes.


What is the determinant of a 2x3 matrix?

The determinant function is only defined for an nxn (i.e. square) matrix. So by definition of the determinant it would not exist for a 2x3 matrix.


What is the standard notation for a rotation?

The standard notation for a rotation in n-dimensional space is an nxn matrix.


What is density matrix in quantum mechanics?

It is a Hermitian positive-semidefinite matrix of trace one that describes the statistical state of a quantum system. Hermitian matrix is defined as A=A^(dagger). Meaning that NxN matrix A is equal to it's transposed complex conjugate. Trace is defined as adding all the terms on the diagonal.


What is the dimension of a skew symmetric matrix of order 3?

In a skew symmetric matrix of nxn we have n(n-1)/2 arbitrary elements. Number of arbitrary element is equal to the dimension. For proof, use the standard basis.Thus, the answer is 3x2/2=3 .


Prove that a matrix a is singular if and only if it has a zero eigenvalue?

Recall that if a matrix is singular, it's determinant is zero. Let our nxn matrix be called A and let k stand for the eigenvalue. To find eigenvalues we solve the equation det(A-kI)=0for k, where I is the nxn identity matrix. (&lt;==) Assume that k=0 is an eigenvalue. Notice that if we plug zero into this equation for k, we just get det(A)=0. This means the matrix is singluar. (==&gt;) Assume that det(A)=0. Then as stated above we need to find solutions of the equation det(A-kI)=0. Notice that k=0 is a solution since det(A-(0)I) = det(A) which we already know is zero. Thus zero is an eigenvalue.


How can you tell if a matrix is invertible?

An easy exclusion criterion is a matrix that is not nxn. Only a square matrices are invertible (have an inverse). For the matrix to be invertible, the vectors (as columns) must be linearly independent. In other words, you have to check that for an nxn matrix given by {v1 v2 v3 &acirc;&euro;&cent;&acirc;&euro;&cent;&acirc;&euro;&cent; vn} with n vectors with n components, there are not constants (a, b, c, etc) not all zero such that av1 + bv2 + cv3 + &acirc;&euro;&cent;&acirc;&euro;&cent;&acirc;&euro;&cent; + kvn = 0 (meaning only the trivial solution of a=b=c=k=0 works).So all you're doing is making sure that the vectors of your matrix are linearly independent. The matrix is invertible if and only if the vectors are linearly independent. Making sure the only solution is the trivial case can be quite involved, and you don't want to do this for large matrices. Therefore, an alternative method is to just make sure the determinant is not 0. Remember that the vectors of a matrix "A" are linearly independent if and only if detA&acirc;&permil;?0, and by the same token, a matrix "A" is invertible if and only if detA&acirc;&permil;?0.


Prove that trace of the matrix is invariant under similarity transformation?

The trace of an nxn matrix is usually thought of as the sum of the diagonal entries in the matrix. However, it is also the sum of the eigenvalues. This may help to understand why the proof works. So to answer your question, let's say A and B are matrices and A is similar to B. You want to prove that Trace A=Trace B If A is similar to B, there exists an invertible matrix P such that A=(P^-1 B P) Now we use the fact that Trace (AB)= Trace(BA) for any nxn matrices A and B.This is easy to prove directly from the definition of trace. (ask me if you need to know) So using this we have the following: Trace(A)=Trace(P^-1 B P)=Trace (BPP^-1)=Trace(B) and we are done! Dr. Chuck


In what year did Nuveen Insured New York Select Tax-Free Income Portfolio - NXN - have its IPO?

Nuveen Insured New York Select Tax-Free Income Portfolio (NXN)had its IPO in 1992.


What is the market cap for Nuveen Insured New York Select Tax Free Income Portfolio NXN?

As of July 2014, the market cap for Nuveen Insured New York Select Tax-Free Income Portfolio (NXN) is $53,091,381.75.

People also asked