Home > Back-end > Computational physics solving the problem of random walk solving poisson equation c program debuggin
Computational physics solving the problem of random walk solving poisson equation c program debuggin
Time:09-22
# include # include # include # include # include # include using namespace std; Const int tempnx=11, tempny=11; Unsigned long I=1; Const unsigned long a=16807;//random multiplier with 16807 Unsigned long m=pow (31), 2-1;//linear with a residual method to the initial value setting Double z, num;//the desires of the random number
Double random ()//linear with the random Numbers produced by residual method algorithm function, random number range of 0.0000 ~ 1.0000 { If (I==m) I=m - 1; I=(a * I) % m; Z=I; Num=z/m; return num; }
Void main (void) { Int I=0, j=0, l=0; Double randnum; Int walkn=0, walki=0, stepi=0, stepj=0, step4=0;
Double \ [tempnx] [tempny]; Int tempv [tempnx] [tempny]; for (i=0; i{the for (j=0; j{ \ [I] [j]=0.0; Tempv [I] [j]=0; }}//initial j=0;//boundary for (i=0; i{ Tempv [I] [j]=1; } J=tempny - 1; for (i=0; i{ Tempv [I] [j]=1; } i=0; For (j=0; j{ \ [I] [j]=1.0; Tempv [I] [j]=1; } I=tempnx - 1; For (j=0; j{ \ [I] [j]=1.0; Tempv [I] [j]=1; } cout
CodePudding user response:
Qaq you trouble yourself non-computer majors to debug the code a little unfamiliar with the