: -

: -

-

-

:

:

, 2009


1.

1.1

1.2 n .

1.3 8

1.4

2.

2.1 .

2.2

2.3 .


, . :

12 .

:

1)  .

2)  .

3)  .

:

1)  ++ Fortran .

2)  , .

3)  .

C++. Borland C++ Builder Enterprises .


1.

 

1.1

- 1949 , . . - , . , , , .

. , , , , .

, , . , , .

, . . . :

. (1)

.

.

, .

 

1.2 n .

n

. (2)

, , . , n : .

, : .

n , :

,

- , , - : .

, , :

(3)

, (2)

. (4)

n . , .

n- , : , .

(5)

, :

. (6)

:

(7)

.

, n- :

(8)

, . n , , , , . .

, (9)

,

,

- , .

(9) I:

. (10)

. ( ):

. (11)

:

. (12)

, (11) , :

. (13)

, (12) :

. (14)

 

1.3 .

( 3). \4\.

( . spline - , ) , . :

. (15)

.

:

, (16)

,

.

 

1.4

:

1)  , ;

2)  (, ) ; , ;

3)  (13) (14) ;

4)  20%

5)  1;

6)  .


2.

 

2.1 .

. .

 

2.2

\3\:

, (17)

=8192,

=67101323.

, , ++. . (0,1) .

 

2.3 .

χ2 \2\.

3 , 1, 1001, 1000000 300000.

(0,1) 50 (. 1).

. 1

1.

1

1 1001 1000000
- 44.0533333333333 45.007 48.618
df 50 50 50
p- 0.709735881642893 0.673522612551685 0.528941919633451

, 5%.


, . ++ , ( 1); ( 2); Borland C++ Builder Enterprises 7.0 CarloS, ( 3).


1.  . ., . . . .: , 2001. 368 .

2.  ., ., . . .: , 1982. 278 .

3.  - . . .: , 1988. 208 .

4.  Baranger J. Analyse numérique. Hermann, 1991.

5.  . . . .: , 1968., .287.

6.  .. .: , 2003


1

1

void integral ()

{

//

//

unsigned d_int=fun_dim;

//----- 3 d --------------------------------------------------------

//

unsigned plot_dim_max=10000;

//

pmatd xyz,xyz_tmp;

if (d_int==3) xyz=new matd(plot_dim_max,3);

//-------------------------------------------------------------------------

//

mcres.relok=Read1double("error_type.txt");

//

mcres.dlt_int=Read1double("error_value.txt");

// ( 0)

int nome_int=Read1double("error_omega.txt");

//

unsigned long b=m_rng*m_rng-d_rng,c,r,i,PSChunk;

// ""

mcres.rng_seed=Read1double("rng_seed.txt");

pmatd fun_b, fun_A, con_b, con_A, con_U, con_v, \

a_int, b_int, ba_int, x_int, xyz_top, xyz_bottom;

unsigned j,ii,jj,con_ok;

struct date dat;

struct time tim;

pspl2d sp_top,sp_bottom;

//

double omegas_int[6]={0.9,0.95,0.99,0.999,0.9999,0.99999};

double zs_int[6]={1.64485362695147,1.95996398454005,2.5758293035489, \

3.29052673149191, 3.89059188641317, 4.4171734134667};

mcres.omega_int=omegas_int[nome_int];

mcres.z_int=zs_int[nome_int];

double fun_cd,con_wd,fu_int,con_sum,sum1_int,sum2_int;

//

// 0 -

// 1 -

// 2 -

mcres.fun_type=Read1double("fun_kind.txt");

//

// 0 ( )

// 1 -

// 2 -

// 3 -

mcres.con_type=Read1double("con_type.txt");

//

switch (mcres.fun_type)

{

case 2: fun_A=new matd("fun_A.txt");

case 1: fun_b=new matd("fun_b.txt");

case 0: fun_cd=Read1double("fun_c.txt");

}

//

switch (mcres.con_type)

{

case 3: // -

//

xyz_top=new matd("xyz_top.txt");

//

xyz_bottom=new matd("xyz_bottom.txt");

//

sp_top=new spl2d(xyz_top);

sp_bottom=new spl2d(xyz_bottom);

break;

case 2: //

con_U=new matd("con_U.txt");

con_v=new matd("con_v.txt");

con_wd=Read1double("con_w.txt");

break;

case 1: //

con_b=new matd("con_b.txt"); con_A=new matd("con_A.txt");

}

//

a_int=new matd("con_xmin.txt");

b_int=new matd("con_xmax.txt");

//

ba_int=new matd;

ba_int=&(*b_int - (*a_int));

//

x_int=new matd(d_int,1);

//

mcres.V0_int=1;

for (j=1; j <= d_int; j++)

{

if (_p(ba_int,j,1) <= 0)

{

DbBox(" \

",j);

goto clean_exit;

}

mcres.V0_int=mcres.V0_int*_p(ba_int,j,1);

}

//

mcres.n1_int=10000;

//

// ,

mcres.n_ite=0;

getdate(&dat); gettime(&tim); mcres.t_start=dostounix(&dat,&tim);

WaitForm->Show();

while (1)

{

mcres.n_ite++;

WaitForm->Edit1->Text=mcres.n_ite;

WaitForm->Edit2->Text=mcres.n1_int;

WaitForm->ProgressBar1->Position=0;

WaitForm->Refresh();

//

sum1_int=0; sum2_int=0;

mcres.in_G_int=0;

PSChunk=long(mcres.n1_int/50.0);

//

r=mcres.rng_seed;

for (i=1; i < 3; i++)

{

c=int(r/m_rng);

r=b*c+m_rng*(r-m_rng*c);

if (r > d_rng) r=r-d_rng;

}

for (i=1; i <= mcres.n1_int; i++)

{

//

for (j=1; j <= d_int; j++)

{

//

c=int(r/m_rng);

r=b*c+m_rng*(r-m_rng*c);

if (r > d_rng) r=r-d_rng;

_p(x_int,j,1)=_p(a_int,j,1)+_p(ba_int,j,1)*double(r)/d_rng;

}

//

if (!(i % PSChunk))

{

WaitForm->ProgressBar1->Position=100.0*(i-1)/(mcres.n1_int-1);

WaitForm->Refresh();

}

//

con_ok=1;

switch (mcres.con_type)

{

case 3: //

if ((_p(x_int,3,1) < sp_bottom->f(_p(x_int,1,1), \

_p(x_int,2,1)))||(_p(x_int,3,1) > sp_top->f(_p(x_int,1,1),_p(x_int,2,1)))) con_ok=0;

break;

case 2: //

con_sum=0;

for (ii=1; ii <= d_int; ii++)

for (jj=1; jj <= d_int; jj++)

if (_p(con_U,ii,jj) != 0)

con_sum += _p(x_int,ii,1)*_p(con_U,ii,jj)*_p(x_int,jj,1);

for (ii=1; ii <= d_int; ii++)

if (_p(con_v,ii,1) != 0)

con_sum += _p(con_v,ii,1)*_p(x_int,ii,1);

if (con_sum > con_wd) con_ok=0;

break;

case 1: //

for (ii=1; ii <= con_A->nl; ii++)

{

con_sum=0;

for (jj=1; jj <= d_int; jj++)

con_sum += _p(con_A,ii,jj)*_p(x_int,jj,1);

if (con_sum > _p(con_b,ii,1)) { con_ok=0; break; }

}

}

fu_int=0;

if (con_ok != 0)

{

mcres.in_G_int++;

// 3d

if (d_int==3)

if (mcres.in_G_int <= plot_dim_max)

{

_p(xyz,mcres.in_G_int,1)=_p(x_int,1,1);

_p(xyz,mcres.in_G_int,2)=_p(x_int,2,1);

_p(xyz,mcres.in_G_int,3)=_p(x_int,3,1);

}

//

switch (mcres.fun_type)

{

case 2: //

for (ii=1; ii <= d_int; ii++)

for (jj=1; jj <= d_int; jj++)

if (_p(fun_A,ii,jj) != 0)

fu_int += _p(x_int,ii,1)*_p(fun_A,ii,jj)*_p(x_int,jj,1);

case 1: //

for (ii=1; ii <= d_int; ii++)

if (_p(fun_b,ii,1) != 0)

fu_int += _p(fun_b,ii,1)*_p(x_int,ii,1);

case 0: //

fu_int += fun_cd;

}

}

sum1_int+=fu_int; sum2_int+=fu_int*fu_int;

}

// .

mcres.f1_int=sum1_int/mcres.n1_int;

mcres.vari_int=(sum2_int-sum1_int*sum1_int/mcres.n1_int)/(mcres.n1_int-1);

//

if (mcres.relok==0)

{

//

mcres.deltar=mcres.V0_int*mcres.z_int*sqrt(mcres.vari_int/mcres.n1_int);

}

else

{

//

if (mcres.f1_int!=0)

{

mcres.deltar=mcres.z_int/fabs(mcres.f1_int)*sqrt(mcres.vari_int/mcres.n1_int);

}

else

{

//

mcres.inte_int=0;

mcres.deltar=0;

getdate(&dat); gettime(&tim); mcres.t_end=dostounix(&dat,&tim);

mcres.t_calc=mcres.t_end-mcres.t_start;

InfoBox(" = 0 ( . ), \

.");

ResultForm->Show();

WaitForm->Close();

goto clean_exit;

}

}

WaitForm->Edit3->Text=mcres.deltar;

WaitForm->Refresh();

if (mcres.deltar < mcres.dlt_int)

{

//

mcres.inte_int=mcres.V0_int*mcres.f1_int;

getdate(&dat); gettime(&tim); mcres.t_end=dostounix(&dat,&tim);

mcres.t_calc=mcres.t_end-mcres.t_start;

ResultForm->Show();

break;

}

//

if (mcres.relok==0)

{

// .

mcres.n1_int=ceil(mcres.vari_int*pow(mcres.V0_int*mcres.z_int/mcres.dlt_int,2));

}

else

{

// .

mcres.n1_int=ceil(mcres.vari_int*pow(mcres.z_int/mcres.dlt_int/mcres.f1_int,2));

}

//

//

mcres.n1_int=1.2*mcres.n1_int;

//

if (mcres.n1_int < 1000) mcres.n1_int=1000;

} //

WaitForm->Close();

// 3d

if (d_int==3)

{

if (mcres.in_G_int==0)

{

//

Zero_File("xyz.txt");

}

else

if (mcres.in_G_int < xyz->nl)

{

// ,

xyz_tmp=new matd(mcres.in_G_int,3);

for (i=1; i <= mcres.in_G_int; i++)

{

_p(xyz_tmp,i,1)=_p(xyz,i,1);

_p(xyz_tmp,i,2)=_p(xyz,i,2);

_p(xyz_tmp,i,3)=_p(xyz,i,3);

}

xyz_tmp->txprint("xyz.txt");

delete xyz_tmp;

}

else

{

//

xyz->txprint("xyz.txt");

}

} // d_int==3

clean_exit:

//

if (d_int==3) delete xyz;

switch (mcres.fun_type)

{

case 2: delete fun_A;

case 1: delete fun_b;

}

switch (mcres.con_type)

{

case 3: delete xyz_top,xyz_bottom,sp_top,sp_bottom; break;

case 2: delete con_U,con_v; break;

case 1: delete con_b,con_A;

}

delete a_int,b_int,ba_int,x_int;

} //integral

2

struct mcres_struct

{

//

int relok;

//

double dlt_int;

//

double deltar;

//

double omega_int;

// .

double z_int;

// ""

unsigned long rng_seed;

// ÷ ,

unsigned n_ite;

//

unsigned long n1_int;

//

unsigned in_G_int;

//

double inte_int;

//

double V0_int;

//

double f1_int;

//

double vari_int;

//

time_t t_start;

//

time_t t_end;

//

time_t t_calc;

//

int fun_type;

//

int con_type;

}; // mcres_struct


2

1 3- .

:

0.00001.

: 0.000034416630896 0.014749984670 %.

2-10

.

[1]

[2]

CarloS[3]

, %
2

3.1415926535897932385 3.1504 0.280346543342
3

4.1887902047863909846 4.2032 0.344008520578
4

4.9348022005446793096 4.98099547511312 .936071451118
5

5.2637890139143245968 5.18913116403891 -1.4183290720439
6

5.1677127800499700296 5.16153372226575 -.1195704569352
7

4.7247659703314011698 4.70163814726423 -.4895019819476
8

4.0587121264167682184 3.98117943332154 -1.9102782035357
9

3.2985089027387068695 3.30542485033746 .209668908064
10

2.5501640398773454440 2.55096385956571 .31363460384e-1

 


[1] [5], . 287.

[2] Maple (20 ).

[3] 2%


 
2011 , .