**How To Find determinant of a metrix using c#???**

How to find determinant of a metrix using C #.Please give me the complete coding in C# to find determinant of a metrix.i want to do this problem in console application..expecting reply thank you

Manswab
0
Newbie Poster

**How To Find determinant of a metrix using c#???**

How to find determinant of a metrix using C #.Please give me the complete coding in C# to find determinant of a metrix.i want to do this problem in console application..expecting reply thank you

Edited
by Manswab because:
*
n/a *

Jump to PostAt the top of the forum it says:

" Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well."

…

Jump to PostSo what have you tried for yourself?

Even if the code you tried seems ridiculous and bad,don't mind. Send it, it shows us you have done some effort. :)

Momerath
1,327
Nearly a Senior Poster
Featured Poster

At the top of the forum it says:

" Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well."

So put some effort into it first.

Manswab
0
Newbie Poster

At the top of the forum it says:

" Also, to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well."

So put some effort into it first.

I tried alot for this ..After that only i started this thread..i want to do this problem with out using function..please help me

ddanbe
2,724
Professional Procrastinator
Featured Poster

Even if the code you tried seems ridiculous and bad,don't mind. Send it, it shows us you have done some effort. :)

samson_zed
-2
Newbie Poster

Hi Manswab

Enjoy!!!! My code works on gauss elimination method.....Try using recursion function to solve by Cramer's method, that is more simple

```
private void GElimination(ref float[,] A, ref float[] B, ref float[] re, int cb) {
// ----Check For Uncertainity :)
if (((WA2dt.Mem.Count - 1)
<= 0)) {
return;
}
float Triangular_A;
float line_1;
float temporary_1;
float multiplier_1;
float sum_1;
float[,] soln;
for (n = 0; (n <= cb); n++) {
for (m = 0; (m <= cb); m++) {
Triangular_A[m, n] = A(m, n);
}
}
// .... substituting the force to triangularmatrics....
for (n = 0; (n <= cb); n++) {
Triangular_A[n, (cb + 1)] = B(n);
}
// ...............soving the triangular matrics.............
for (k = 0; (k <= cb); k++) {
// ......Bring a non-zero element first by changes lines if necessary
if ((Triangular_A[k, k] == 0)) {
for (n = k; (n <= cb); n++) {
if ((Triangular_A[n, k] != 0)) {
line_1 = n;
}
break;
// Finds line_1 with non-zero element
}
// ..........Change line k with line_1
for (m = k; (m <= cb); m++) {
temporary_1 = Triangular_A[k, m];
Triangular_A[k, m] = Triangular_A[line_1, m];
Triangular_A[line_1, m] = temporary_1;
}
}
// ....For other lines, make a zero element by using:
// .........Ai1=Aij-A11*(Aij/A11)
// .....and change all the line using the same formula for other elements
for (n = (k + 1); (n <= cb); n++) {
if ((Triangular_A[n, k] != 0)) {
// if it is zero, stays as it is
multiplier_1 = (Triangular_A[n, k] / Triangular_A[k, k]);
for (m = k; (m
<= (cb + 1)); m++) {
Triangular_A[n, m] = (Triangular_A[n, m]
- (Triangular_A[k, m] * multiplier_1));
}
}
}
}
// ..... calculating the dof value..........
// First, calculate last xi (for i = System_DIM)
soln[(cb + 1)] = (Triangular_A[cb, (cb + 1)] / Triangular_A[cb, cb]);
// ................
for (n = 1; (n <= cb); n++) {
sum_1 = 0;
for (m = 1; (m <= n); m++) {
sum_1 = (sum_1
+ (soln[(cb + (2 - m))] * Triangular_A[(cb - n), (cb + (1 - m))]));
}
soln[(cb + (1 - n))] = ((Triangular_A[(cb - n), (cb + 1)] - sum_1)
/ Triangular_A[(cb - n), (cb - n)]);
}
for (n = 0; (n <= cb); n++) {
re(n) = soln[(n + 1)];
}
```

Rgrds

Sam

Edited
by samson_zed because:
*
n/a *

Ketsuekiame
commented:
Please do not spoon-feed people like this.
-2

samson_zed
-2
Newbie Poster

Hey manswab

I forgot, the above is for solving eqns

Ax = B

All u have to do is when the above code completes eliminating like below

**|A1 A2 A3.....An|
|0 B2 B3 ..... Bn|
|0 0 C3 ..... Cn|
|..................|
|0 0 0 0 Yn-1 Yn|
|0 0 0 0 0 0 Zn|**

Use diagonal multiplication from A1 till end for the determinant of the triangular matrix.

So you got some work to do before using the above code.

Rgrds

Sam

Edited
by samson_zed because:
*
n/a *

Manswab
0
Newbie Poster

Thanks for your replyy

Manswab
0
Newbie Poster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.

Broken Link

**You're trying to visit a URL that doesn't currently exist on the web.**
Most likely, a member posted a link a long time ago to a web page that has since been removed.
It's also possible that there was a typo when posting the URL.
We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.