Advertisement
punidota

Untitled

Mar 23rd, 2016
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace lab1tab1
  4. {
  5.     internal class Program
  6.     {
  7.         private static void Main()
  8.         {
  9.             var tab1x1 = new[] { 0.46, 0.46, 0.46 };
  10.             var tab2x1 = new[] { 0.3, 0.3, 0.3 };
  11.             var tab3x1 = new[] { 0.4, 0.4, 0.4 };
  12.             var tab4x1 = new[] { 0.37, 0.37, 0.37 };
  13.             var tab5x1 = new[] { 0.34, 0.34, 0.34 };
  14.  
  15.             var tab1x4 = new[] { 0.38, 0.375, 0.365 };
  16.             var tab2x4 = new[] { 0.36, 0.363, 0.37 };
  17.             var tab3x4 = new[] { 0.34, 0.35, 0.345 };
  18.             var tab4x4 = new[] { 0.38, 0.375, 0.34 };
  19.             var tab5x4 = new[] { 0.355, 0.36, 0.36 };
  20.  
  21.             var del1t1 = new[] { 5.079, 5.675, 5.708 };
  22.             var del2t2 = new[] { 4.778, 4.762, 4.640 };
  23.             var del3t3 = new[] { 4.645, 4.369, 4.290 };
  24.             var del4t4 = new[] { 3.770, 3.58, 4.072 };
  25.             var del5t5 = new[] { 3.407, 3.375, 3.436 };
  26.  
  27.             double del1x4 = 0, del2x4 = 0, del3x4 = 0, del4x4 = 0, del5x4 = 0, x2 = 0, R = 0.085,
  28.                    del1t4 = 0, del2t4 = 0, del3t4 = 0, _del4t4 = 0, del5t4 = 0, x0 = 0.47,
  29.                    x3 = 0.03, full1form2 = (del1x4 / 3 - x0) / (2 * x3 - (x0 + del1x4 / 3)),
  30.                    full2form2 = (del2x4 / 3 - x0) / (2 * x3 - (x0 + del2x4 / 3)),
  31.                    full3form2 = (del3x4 / 3 - x0) / (2 * x3 - (x0 + del3x4 / 3)),
  32.                    full4form2 = (del4x4 / 3 - x0) / (2 * x3 - (x0 + del4x4 / 3)),
  33.                    full5form2 = (del5x4 / 3 - x0) / (2 * x3 - (x0 + del5x4 / 3)),
  34.                    dela1 = 0, dela2 = 0, dela3 = 0, dela4 = 0, dela5 = 0,
  35.                    delb1 = 0, delb2 = 0, delb3 = 0, delb4 = 0, delb5 = 0;
  36.             double[] a1 = new double[3], a2 = new double[3], a3 = new double[3], a4 = new double[3], a5 = new double[3],
  37.                 b1 = new double[3], b2 = new double[3], b3 = new double[3], b4 = new double[3], b5 = new double[3],
  38.                 sqrtx1 = new double[3], sqrtx2 = new double[3], sqrtx3 = new double[3], sqrtx4 = new double[3], sqrtx5 = new double[3];
  39.             for (var i = 0; i < 3; i++)
  40.             {
  41.                 del1x4 += tab1x4[i];
  42.                 del2x4 += tab2x4[i];
  43.                 del3x4 += tab3x4[i];
  44.                 del4x4 += tab4x4[i];
  45.                 del5x4 += tab5x4[i];
  46.             }
  47.             Console.WriteLine(@"<x4> = {0:0.###}|{1:0.###}|{2:0.###}|{3:0.###}|{4:0.###}", del1x4 / 3, del2x4 / 3, del3x4 / 3, del4x4 / 3, del5x4 / 3);
  48.             for (int i = 0; i < 3; i++)
  49.             {
  50.                 del1t4 += del1t1[i];
  51.                 del2t4 += del2t2[i];
  52.                 del3t4 += del3t3[i];
  53.                 _del4t4 += del4t4[i];
  54.                 del5t4 += del5t5[i];
  55.             }
  56.             Console.WriteLine("<delt> = {0:0.###}|{1:0.###}|{2:0.###}|{3:0.###}|{4:0.###}", del1t4 / 3, del2t4 / 3, del3t4 / 3, _del4t4 / 3, del5t4 / 3);
  57.             for (var i = 0; i < 3; i++)
  58.             {
  59.                 sqrtx1[i] = Math.Sqrt(Math.Abs(tab1x1[i] - x0));
  60.                 sqrtx2[i] = Math.Sqrt(Math.Abs(tab2x1[i] - x0));
  61.                 sqrtx3[i] = Math.Sqrt(Math.Abs(tab3x1[i] - x0));
  62.                 sqrtx4[i] = Math.Sqrt(Math.Abs(tab4x1[i] - x0));
  63.                 sqrtx5[i] = Math.Sqrt(Math.Abs(tab5x1[i] - x0));
  64.                 Console.WriteLine("sqrt1(x1-x0) = {0:0.###}\nsqrt2(x1-x0) = {1:0.###}\nsqrt3(x1-x0) = {2:0.###}\nsqrt4(x1-x0) = {3:0.###}\nsqrt5(x1-x0) = {4:0.###}", sqrtx1[i], sqrtx2[i], sqrtx3[i], sqrtx4[i], sqrtx5[i]);
  65.        
  66.             }
  67.             Console.WriteLine("fla = {0:0.###}|{1:0.###}|{2:0.###}|{3:0.###}|{4:0.###}", full1form2, full2form2, full3form2, full4form2, full5form2);
  68.             for (var i = 0; i < 3; i++)
  69.             {
  70.                 a1[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab1x1[i] - x0)), 2)) / Math.Pow(del1t1[i], 2);
  71.                 a2[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab2x1[i] - x0)), 2)) / Math.Pow(del2t2[i], 2);
  72.                 a3[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab3x1[i] - x0)), 2)) / Math.Pow(del3t3[i], 2);
  73.                 a4[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab4x1[i] - x0)), 2)) / Math.Pow(del4t4[i], 2);
  74.                 a5[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab5x1[i] - x0)), 2)) / Math.Pow(del5t5[i], 2);
  75.                 Console.WriteLine("a1 = {0:0.###}\na2 = {1:0.###}\na3 = {2:0.###}\na4 = {3:0.###}\na5 = {4:0.###}", a1[i], a2[i], a3[i], a4[i], a5[i]);
  76.                 dela1 += a1[i];
  77.                 dela2 += a2[i];
  78.                 dela3 += a3[i];
  79.                 dela4 += a4[i];
  80.                 dela5 += a5[i];
  81.             }
  82.             Console.WriteLine("<a> = {0:0.###}|{1:0.###}|{2:0.###}|{3:0.###}|{4:0.###}", dela1 / 3, dela2 / 3, dela3 / 3, dela4 / 3, dela5 / 3);
  83.             for (var i = 0; i < 3; i++)
  84.             {
  85.                 b1[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab1x1[i] - x0)), 2)) / (R * Math.Pow(del1t1[i], 2));
  86.                 b2[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab2x1[i] - x0)), 2)) / (R * Math.Pow(del2t2[i], 2));
  87.                 b3[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab3x1[i] - x0)), 2)) / (R * Math.Pow(del3t3[i], 2));
  88.                 b4[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab4x1[i] - x0)), 2)) / (R * Math.Pow(del4t4[i], 2));
  89.                 b5[i] = (2 * Math.Pow(Math.Sqrt(Math.Abs(x2 - x0)) - Math.Sqrt(Math.Abs(tab5x1[i] - x0)), 2)) / (R * Math.Pow(del5t5[i], 2));
  90.                 Console.WriteLine("b1 = {0:0.###}\nb2 = {1:0.###}\nb3 = {2:0.###}\nb4 = {3:0.###}\nb5 = {4:0.###}", b1[i], b2[i], b3[i], b4[i], b5[i]);
  91.                 delb1 += b1[i];
  92.                 delb2 += b2[i];
  93.                 delb3 += b3[i];
  94.                 delb4 += b4[i];
  95.                 delb5 += b5[i];
  96.             }
  97.             Console.WriteLine("<b> = {0:0.###}|{1:0.###}|{2:0.###}|{3:0.###}|{4:0.###}", delb1 / 3, delb2 / 3, delb3 / 3, delb4 / 3, delb5 / 3);
  98.         }
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement