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

βˆ™ 13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 11y ago

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"

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 12y ago

void main()

{

int

This answer is:
User Avatar

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
Continue Learning about Engineering

How do you write a C program to print the diagonal element of a NxN matrix?

#include&lt;stdio.h&gt; #include&lt;conio.h&gt; void main() { int a[3][3],b[3][3],c[3][3],r,c; for(r=0;r&lt;=3;r++) { for(c=0;c&lt;3;c++) { printf("\n enter the value="); scanf("%d%d",&amp;a[r][c],&amp;b[r][c]); } } printf("\n first matrix=\n"); for(r=0;r&lt;=3;r++) { for(c=0;c&lt;3;c++) { printf("%d\t",a[r][c]); } printf("\n"); } printf("\n scond matrix=\n"); for(r=0;r&lt;=3;r++) { for(c=0;c&lt;3;c++) {printf("%d\t",b[r][c]); } printf("\n"); } printf("\n sum of given matrix=\n"); for(r=0;r&lt;=3;r++) { for(c=0;c&lt;3;c++) { c[r][c]=a[r][c]+b[r][c]; printf("%d\t",c[r][c]); } printf("\n"); } getch(); }


What is analyze pedigrees to identify patterns of inheritance for common genetic disorders?

Look at the phenotypes given in the pedigree to work forwards and backwards and figure out the genotypes to the best of your abilities (they can't always be figured out, but they can usually be narrowed down). Common genetic disorders have several patterns of inheritance. They can be dominant/recessive and then X-linked or Y-linked or autosomal. If they are codominant then it will be very obvious as there will be three possible conditions: normal, diseased, and half-diseased half-normal. Let D=disease, N=no disease, and O=no allele on the chromosome at all. Autosomal is easier to identify. If D is recessive, the following rules can help identify the genotypes. If D is dominant, the above rules can be modified to apply again. Just think of N as the disease and D as the normal condition. DxN=half D, half N--&gt;DDxND DxN=all N--&gt;DDxNN NxN=quarter D, others N--&gt;NDxND NxN=all N--&gt;NNxNN or NNxND (Obviously) DxD--&gt;all D--&gt;DDxDD Sex-linked is more difficult. Know that if a male expresses something, no matter whether it is dominant or recessive, that is his genotype (N or D). Females are still double-letter (NN, ND, DD). Write down the possible phenotypes of the parents and offspring. Then figure out which genotypes work, and then you can determine if D or N is recessive/dominant.


Related questions

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?

In quantum mechanics, the density matrix is a mathematical representation of the state of a quantum system that is used to describe mixtures of quantum states or states that have uncertainty. It provides a way to calculate the average values of observables and predict the outcomes of measurements on the system.


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.


Example of a sequence?

a sequence is a pattern of numbers that ascends or descends in a same way eg. 1,3,5,7,... you add 2 eg. 1,4,9,... you square the term nth term = nxn 1x1=1 2x2=4 3x3=9 there are many sequences and many formulas to calculate terms hope that helped