Not Yet Answered # How To Find determinant of a metrix using c#???

Momerath 1,327 Discussion Starter Manswab ddanbe 2,467 samson_zed -2 samson_zed -2 Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

0

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.

0

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

0

So 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. :)

-2

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 5 Years Ago by samson_zed*: n/a

0

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 5 Years Ago by samson_zed*: n/a

This article has been dead for over six months. Start a new discussion instead.

Recommended Articles

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

```
public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}
```

the function that I created to find the ...