5. Write a c program to find out transport of a matrix.
6. Write a c program for scalar multiplication of matrix.
7. C program to find inverse of a matrix
8. Lower triangular matrix in c
9. Upper triangular matrix in c
10. Strassen's matrix multiplication program in c
11. C program to find determinant of a matrix
12. Big list of c program examples
6. Write a c program for scalar multiplication of matrix.
7. C program to find inverse of a matrix
8. Lower triangular matrix in c
9. Upper triangular matrix in c
10. Strassen's matrix multiplication program in c
11. C program to find determinant of a matrix
12. Big list of c program examples
19 comments:
i am new to programming.can anyone pls explain this to me.offer ur help as soon as possible
Program above prints transpose of inverse.
see below revised code
printf("\nInverse of matrix is: \n\n");
// for(i=0;i<3;i++){
// for(j=0;j<3;j++)
for(j=0;j<3;j++){
for(i=0;i<3;i++){
printf("%.2f\t",((a[(i+1)%3][(j+1)%3] * a[(i+2)%3][(j+2)%3]) -
(a[(i+1)%3][(j+2)%3]*a[(i+2)%3][(j+1)%3]))/ determinant);
}
printf("\n");
}
what about 2by2 ??
instead of 3 use 2 . yu need to replace dem by 2!
and also dont forget to initialise st[2]
Is program correctly work or not ?
yes corectly work thanks ritesh:)
Good, but for a matrix it is also important that its determinant must be non-zero for existence of inverse.
Thus it will be good to include one more condition so it will immediately tell whether the matrix entered is valid or not.
Rest of the things are okay :)
i want 2*2 programme now! pleaseeeeee.
It does some approximations making it useless. 0.04 gets rounded to zero. 0.06 gets rounded to 0.1
if u want higher accuracy in the digits, then replace %.2f with %.10f and you will have 10 digits of accuracy instead of 2
it works i tried it
HOW ABOUT 6X6 MATRIX?
why you use %3 finding determinant
write a c program to display the elements in the matrix from any starting point it should travel upside down and also want to end at starting point.
pls help me @ richardprasanna@outlook.com
hello ever one
I can't understand why u used %3 in the code written above is it possible to write the code without %3
IMPROVED PROGRAM::ONLY FOR DETERMINANTS != 0 To Find Inverse Of A Matrix
#include <studio.h>
#include <conio.h>
int i,j,k,l,m,n,p,z;
float temp,temp2,c[3][3],d[3][3],a[4],temp3[3];
void inverse()
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(i==j)
{
temp=c[i][j];
for(k=0;k<3;k++)
{
c[i][k]/=temp*(1.0);
d[i][k]/=temp*(1.0);
}
}
}
for(l=0;l<3;l++)
{
if(l!=i)
{
for(m=0;m<3;m++)
{
temp2=c[l][i];
for(n=0;n<3;n++)
{
c[l][n]=c[l][n]-(c[i][n]*temp2);
d[l][n]=d[l][n]-(d[i][n]*temp2);
}
}
}
}
}
}
void enter()
{
printf("Enter the elements of the matrix: \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("Enter the ement at c[%d][%d]",i,j);
scanf("%f",&c[i][j]);
if(i==j)
{
d[i][j]=1;
}
else
{
d[i][j]=0;
}
}
}
}
void print()
{
for(i=0;i<3;i++)
{
printf("\n");
for(j=0;j<3;j++)
{
printf("%f \t",d[i][j]);
}
}
}
float determinant()
{ z=0;
for(j=0;j<3;j++)
{ p=0;
for(m=1;m<3;m++)
{
for(n=0;n<3;n++)
{
if(n!=j)
{
a[p]=c[m][n];
printf("\na[%d]=%f\n",p,a[p]);
p++;
}
}
}temp3[z]=c[0][j]*(a[0]*a[3]-a[1]*a[2]);z++;
}
return(temp3[0]-temp3[1]+temp3[2]);
}
void main()
{
float g;
enter();
g=determinant();
printf("%f \n",g);
if(g!=0)
{
inverse();
print();
}
else
{
printf("Can't Be Inversed");
}
getch();
}
I want to read two matrices A and B and find if A is the inverse of B... someone please help me out
Very helpful article
Tnxxx a lot
http://www.networkking4u.com
Post a Comment