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

CodePudding user response:

The last line fprintf was written by you?

CodePudding user response:

Simple - Soft references 2 floor response:
is the last line fprintf you wrote?

The teacher PDF source program

CodePudding user response:

Simple - Soft references 2 floor response:
is the last line fprintf you wrote?

Comments too seems to be no problem

CodePudding user response:

Can put the wrong information to complete

CodePudding user response:

Simple reference 5 floor - Soft reply:
can complete the error information to

Is this a mistake qaq

CodePudding user response:

The last line to remove ah, should do

CodePudding user response:

reference 7 floor is Simple - Soft reply:
the last line to remove ah, should be done

Tried not to see other examples like array has a problem

CodePudding user response:

So you have complete the error screenshot

CodePudding user response:

# 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 (31), 2.0 m=pow - 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
  • Related