double ru = double.Parse(TB_RT.Text);
gam1 = a1 * 2 * dt / (h * h);
gam2 = a2 * 2 * dt / (h * h);
bet1 = a1 * dt / (h * h);
bet2 = a2 * dt / (h * h);
double[] bet = new double[(nx + 1) * (nt + 1)];
double[] gam = new double[(nx + 1) * (nt + 1)];
double kl = 0;
int kll = 0;
for (; kl < double.Parse(TB_L1.Text); kl += h, kll++)
{
bet[kll] = bet1;
gam[kll] = gam1;
}
for (; kl < double.Parse(TB_L1.Text) + double.Parse(TB_L2.Text); kl += h, kll++)
{
bet[kll] = bet2;
gam[kll] = gam2;
}
for (; kl < double.Parse(TB_L1.Text) + double.Parse(TB_L2.Text) + double.Parse(TB_L3.Text); kl += h, kll++)
{
bet[kll] = bet1;
gam[kll] = gam1;
}
for (; kl <= L; kl += h, kll++)
{
bet[kll] = bet2;
gam[kll] = gam2;
}
for (int i = nx + 1, j = 0; i < gam.Length; i++)
{
bet[i] = bet[j];
gam[i] = gam[j];
if (j == nx)
j = 0;
else
j++;
}
//задаем начальные условия в вектор b
for (int i = 0; i < nx + 1; i++)
{
b[i] = nu;
}
if (!checkBox1.Checked)
{
//задаем граничные условия в вектор b
for (int i = nx + 1; i < b.Length; )
{
b[i] = lu;
i += nx;
b[i] = ru;
i++;
}
}
for (int i = 0; i < (nx + 1) * (nt + 1) - (nx + 1); i++)
{
if (i < nx + 1)
{
u[i, i] = 1;
}
else
if (i % (nx + 1) == 0)
{
if (checkBox1.Checked)
{
u[i, i] = (double.Parse(tb_h.Text) * h - double.Parse(TB_lam.Text)) / double.Parse(TB_lam.Text);//-(((double.Parse(tb_h.Text) * h) / double.Parse(TB_lam.Text)) + 1);
u[i, i + 1/*nx+1*/] = 1;
b[i] = (double.Parse(tb_h.Text) * h * double.Parse(TB_LT.Text)) / double.Parse(TB_lam.Text);
}
else
u[i, i] = 1;
}
else if ((i + 1) % (nx + 1) == 0)
{
if (checkBox1.Checked)
{
u[i, i] = -1;
u[i, i + 1/*nx+1*/] = 1;
b[i] = -(double.Parse(TB_RT.Text)*h)/double.Parse(TB_lam.Text);
}
else
u[i, i] = 1;
}
else
{
u[i, i] = 2 * gam[i];
u[i, i + 1] = -gam[i];
u[i, i - 1] = -gam[i];
u[i, i - (nx + 1)] = -1;
u[i, i + (nx + 1)] = 1;
}
}
if (checkBox1.Checked)
{
u[u.GetLength(0) - nx - 1, u.GetLength(0) - /*2 * nx - 2*/ nx - 1] = (double.Parse(tb_h.Text) * h - double.Parse(TB_lam.Text)) / double.Parse(TB_lam.Text);
u[u.GetLength(0) - nx - 1, u.GetLength(0) - nx - 2] = 1;
b[u.GetLength(0) - nx - 1] = (double.Parse(tb_h.Text) * h * double.Parse(TB_LT.Text)) / double.Parse(TB_lam.Text);
}
else
u[u.GetLength(0) - nx - 1, u.GetLength(0) - nx - 1] = 1;
if (checkBox1.Checked)
{
u[u.GetLength(0) - 1, u.GetLength(0) - /*1 - nx - 1*/2] = 1;
u[u.GetLength(0) - 1, u.GetLength(0) - 1] = -1;
b[u.GetLength(0) - 1] = -(double.Parse(TB_RT.Text) * h) / double.Parse(TB_lam.Text);
}
else
u[u.GetLength(0) - 1, u.GetLength(0) - 1] = 1;
for (int i = u.GetLength(0) - nx; i < u.GetLength(0) - 1; i++)
{
u[i, i - (nx + 1)] = -1;
u[i, i] = 1 + 2 * bet[i];
u[i, i - 1] = -bet[i];
u[i, i + 1] = -bet[i];
}
string heder = "<?xml version=\"1.0\"?> \n<?mso-application progid=\"Excel.Sheet\"?>\n<Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"\n xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\"\n xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\" \n xmlns:html=\"http://www.w3.org/TR/REC-html40\"> \n <DocumentProperties xmlns=\"urn:schemas-microsoft-com:office:office\">\n <Author>Igor</Author>\n <LastAuthor>Igor</LastAuthor> \n<Created>2012-02-17T22:38:42Z</Created> \n<LastSaved>2012-02-17T22:50:27Z</LastSaved> \n <Version>14.00</Version> \n</DocumentProperties> \n<OfficeDocumentSettings xmlns=\"urn:schemas-microsoft-com:office:office\"> \n<AllowPNG/> \n</OfficeDocumentSettings> \n<ExcelWorkbook xmlns=\"urn:schemas-microsoft-com:office:excel\"> \n<WindowHeight>7995</WindowHeight> \n<WindowWidth>20115</WindowWidth> \n<WindowTopX>240</WindowTopX> \n<WindowTopY>75</WindowTopY> \n<ProtectStructure>False</ProtectStructure> \n<ProtectWindows>False</ProtectWindows> \n</ExcelWorkbook> \n<Styles> \n<Style ss:ID=\"Default\" ss:Name=\"Normal\"> \n<Alignment ss:Vertical=\"Bottom\"/> \n<Borders/> \n<Font ss:FontName=\"Calibri\" x:CharSet=\"204\" x:Family=\"Swiss\" ss:Size=\"11\" \nss:Color=\"#000000\"/> \n<Interior/> \n<NumberFormat/> \n<Protection/> \n</Style> \n</Styles> \n<Worksheet ss:Name=\"Лист1\"> \n";
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.