Solving Monte Carlo Method Smoluchowski Equation Problem

  • Thread starter Thread starter Feynman
  • Start date Start date
AI Thread Summary
The discussion revolves around a programming issue with the Monte Carlo method applied to the Smoluchowski equation using Maple. The user is experiencing a problem where the positions of particles, represented by the array z[], are not changing as expected. Key suggestions include correcting the assignment operator from "=" to ":=" for updating particle positions and clarifying the intended use of the z(t+dt) object. There is confusion regarding how to properly update the z[] array, indicating a need for clearer coding practices. The conversation highlights the importance of proper syntax and understanding data structures in programming.
Feynman
Messages
152
Reaction score
0
Hi every body,
i've a simple question in the programation for a certain methode called Monte Carlo method for Smoluchowski equation:
i programe this method in maple but the problem is that the positions of particules z[l]is not changing ( it most be changed ): can anyone tell me where is the problem?
this is the method:

//calculate natural random numbers
test:=proc(N)
local a,i,L;
L:=[];
a:=rand(1..N):
for i from 1 to N do L:=[op(L),a()] od;
L;
end:
\\z is the position of particules
z:=test(10);

pi:=test(10);
\\ calculate uniform random numbers U[0,1]

r:=stats[random, uniform](10):for i from 1 to 10
do
printf("r[%d]=%f\n",i,r);
od;

\\ position of particules at time t+dt=t+1/20

for i from 1 to 10
do
if
r>1/(20*z) or r=1/(20*z)
then
z(t+dt)=z:
end if;
if
r<1/(20*z)
then
z(t+dt)=z+z[pi]:
end if;
od:
thankx verry much
 
Mathematics news on Phys.org
I couldn't help myself...

LUIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII IIIIIIIIIII
Inta SCOTEEEEEEEEEEEEEEEEEEEEEEEEEEEE
 
Code:
\\ position of particules at time t+dt=t+1/20

for i from 1 to 10
 do
     if 
         r[i]>1/(20*z[i]) or r[i]=1/(20*z[i])
           then
             z(t+dt)[i]=z[i]: 
           end if;
     if 
         r[i]<1/(20*z[i])
            then 
               z(t+dt)[i]=z[i]+z[pi[i]]:
            end if;       
 od:

These lines look strange to me:
z(t+dt)=z:
z(t+dt)=z+z[pi]:

First, the := means assignment.
So, you might have meant:
z(t+dt) := z+z[pi]:

Second, what kind of maple object is z(t+dt)?
Do you mean to "update" the z[] array, e.g.
z := z+z[pi]:
?
 
so please correct me this program please
Thanks
 
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...

Similar threads

Back
Top