Solving Monte Carlo Method Smoluchowski Equation Problem

  • Thread starter Thread starter Feynman
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around a programming issue related to implementing the Monte Carlo method for solving the Smoluchowski equation using Maple. Participants are examining the code provided by the original poster to identify why the positions of particles are not changing as expected.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • The original poster describes a problem where the positions of particles, represented by the array z[], are not updating as intended in their Maple code.
  • Some participants suggest that the assignment operator used in the code may be incorrect, specifically questioning the use of := versus = for updating values in the array.
  • There is a query regarding the nature of the object z(t+dt) and whether it is intended to update the z[] array directly.
  • One participant expresses confusion about the logic in the code, particularly the conditions under which the positions are updated.

Areas of Agreement / Disagreement

Participants have not reached a consensus on the correct implementation of the code, and there are differing views on how to properly update the particle positions. The discussion remains unresolved regarding the specific corrections needed for the program.

Contextual Notes

There are potential limitations in the code logic, particularly concerning the assignment operations and the handling of the z[] array. The exact behavior of z(t+dt) is also unclear, which may affect the intended functionality.

Who May Find This Useful

Individuals interested in computational methods in physics, particularly those working with Monte Carlo simulations and the Smoluchowski equation, may find this discussion relevant.

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
 
Physics 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
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 1 ·
Replies
1
Views
5K