səhifə 18/24 tarix 10.05.2023 ölçüsü 117,5 Kb. #110606
dep-materiallar-varaq (1)
Double s = 0;
int k1, i, j;
if (q == 1)
{
a = K; b = F;
x = new Double[2 * n];
//for (k1 = 0; k1 < n; k1++) listBox1.Items.Add(b[k1]);
//================ UCHBURCHAKKA KELTIRISH ======
for (k1 = 0; k1 < 2 * n; k1++)
for (i = k1 + 1; i < 2 * n; i++)
{
if (a[k1, k1] != 0) s = a[i, k1] / a[k1, k1];
for (j = k1; j < 2 * n; j++)
a[i, j] = a[i, j] - s * a[k1, j];
b[i] = b[i] - s * b[k1];
}
//============== TESKARI YOLI ================
for (i = 2 * n - 1; i >= 0; i--)
{
s = b[i];
for (j = i + 1; j < 2 * n; j++)
s = s - a[i, j] * x[j];
x[i] = s / a[i, i];
}
Console.WriteLine();
Console.WriteLine();
for (k1 = 0; k1 < 2 * n; k1++)
Console.Write("x[{0}]={1:f4} ", k1, x[k1]);
}
else
{
a = S; b = F;
x = new Double[n];
//for (k1 = 0; k1 < n; k1++) listBox1.Items.Add(b[k1]);
//================ UCHBURCHAKKA KELTIRISH ======
for (k1 = 0; k1 < n; k1++)
for (i = k1 + 1; i < n; i++)
{
if (a[k1, k1] != 0) s = a[i, k1] / a[k1, k1];
for (j = k1; j < n; j++)
a[i, j] = a[i, j] - s * a[k1, j];
b[i] = b[i] - s * b[k1];
}
//============== TESKARI YOLI ================
for (i = n - 1; i >= 0; i--)
{
s = b[i];
for (j = i + 1; j < n; j++)
s = s - a[i, j] * x[j];
x[i] = s / a[i, i];
}
Console.WriteLine();
Console.WriteLine();
for (k1 = 0; k1 < n; k1++)
Console.Write("x[{0}]={1:f4} ", k1, x[k1]);
}
return x;
}
public void Epsilon(bool pech)
{
double xx, yy, Ni, Nj, Nk, r, Ri, Rj, V, rt, zt;
double[] b = new double[3], c = new double[3], fe = new double[6], fh = new double[6], a = new double[3];
// listBox1.Items.Add("**************************************");
// listBox1.Items.Add("\t\t NN");
for (int i = 0, t0 = 0; i < 2 * n; i += 2, t0++)
{
NN[t0, 0] = U[i];
NN[t0, 1] = U[i + 1];
s = "";
s += String.Format("{0:f5} {1:f5} ", NN[t0, 0], NN[t0, 1]);// / 133333.333);
// listBox1.Items.Add(s);
}
uint[] mi = new uint[3];
listBox1.Items.Add("**************************************");
listBox1.Items.Add("\t\t Eps");
///////////////////////////////////////
for (int e = 0; e < m; e++)
{
a[0] = MK[MN[e].j - 1].x * MK[MN[e].k - 1].y - MK[MN[e].k - 1].x * MK[MN[e].j - 1].y;
a[1] = MK[MN[e].k - 1].x * MK[MN[e].i - 1].y - MK[MN[e].i - 1].x * MK[MN[e].k - 1].y;
a[2] = MK[MN[e].i - 1].x * MK[MN[e].j - 1].y - MK[MN[e].j - 1].x * MK[MN[e].i - 1].y;
b[0] = MK[MN[e].j - 1].y - MK[MN[e].k - 1].y;
b[1] = MK[MN[e].k - 1].y - MK[MN[e].i - 1].y;
b[2] = MK[MN[e].i - 1].y - MK[MN[e].j - 1].y;
c[0] = MK[MN[e].k - 1].x - MK[MN[e].j - 1].x;
c[1] = MK[MN[e].i - 1].x - MK[MN[e].k - 1].x;
c[2] = MK[MN[e].j - 1].x - MK[MN[e].i - 1].x;
xx = (MK[MN[e].i - 1].x + MK[MN[e].j - 1].x + MK[MN[e].k - 1].x) / 3;
yy = (MK[MN[e].i - 1].y + MK[MN[e].j - 1].y + MK[MN[e].k - 1].y) / 3;
rt = xx; zt = yy;
Dostları ilə paylaş: