.


:




:

































 

 

 

 


. -15 .

2:

-

 

, (. 1) -. Excel.

 

 

1. .

2. .

3. , Excel.

 

rez.txt. Excel , .

 

 

. 1.

        0,01
        0,01
        0,01
        0,016
        0,01
        0,016
        0,02
        0,01
        0,01
        0,01
      -50 0,0125
        0,01
        0,01
        0,0125
        0,008

 

-

 

- . .

(1)

. - :

. (2)

.

(2) - :

(3)

:

. (4)

, :

. (5)

- .

(6)

, . 1- :

(7)

:

(8)

(9)

, :

(10)

 

:

-

24

. -15 ..

 

1. : -. Excel..

2. :

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.IO;

 

namespace ConsoleApplication_Lab2

{

class Program

{

 

static void Main(string[] args)

{

int i, n = 121;

double[] x = new double[n];

double[] y = new double[n];

double[] p = new double[n];

double K1, K2, K3, K4, L1, L2, L3, L4, h = 0.05;

 

FileStream u = new FileStream("rez.txt", FileMode.Create);

StreamWriter Wr = new StreamWriter(u);

 

//

x[0] = 0;

y[0] = 5;

p[0] = 0;

 

// y"+10y=0

for (i = 0; i < n - 1; i++)

{

K1 = h * p[i];

L1 = h * f(x[i], y[i], p[i]);

K2 = h * (p[i] + L1 / 2);

L2 = h * f(x[i] + h / 2, y[i] + K1 / 2, p[i] + L1 / 2);

K3 = h * (p[i] + L2 / 2);

L3 = h * f(x[i] + h / 2, y[i] + K2 / 2, p[i] + L2 / 2);

K4 = h * (p[i] + L3);

L4 = h * f(x[i] + h, y[i] + K3, p[i] + L3);

y[i + 1] = y[i] + (K1 + 2 * K2 + 2 * K3 + K4) / 6;

p[i + 1] = p[i] + (L1 + 2 * L2 + 2 * L3 + L4) / 6;

x[i + 1] = x[i] + h;

}

Console.WriteLine(" : rez.txt");

Console.ReadLine();

 

//

Wr.WriteLine(" i x y p");

for (i = 0; i < n; i++)

{

Wr.WriteLine("{0:D3} {1:F3} {2:F3} {3:F3}", i, x[i], y[i], p[i]);

}

 

Wr.Close();

u.Close();

}

 

//

static double f(double x, double y, double p)

{

return 0 * x - 10 * y + 0 * p;

}

}

}

.



<== | ==>
. . | -
:


: 2015-11-23; !; : 470 |


:

:

, , .
==> ...

1718 - | 1421 -


© 2015-2024 lektsii.org - -

: 0.018 .