1
$\begingroup$

I'm simulating a particle movement following a normal distribution. How this is done:

My particle has a constant speed v and every step the particle move, I calculate an angle teta for then, calculates the next position using Pythagoras making v the hypotenuse. That means that each step size is v.

enter image description here

teta is calculated using a normal random numbers generator. For a fixed standard deviation std and an initial mean, I calculate an angle and for each step, I set the mean as the angle calculated.

enter image description here

The red lines length is always v which is the same of the distance between position_n and position_n+1. A code to help explain better:

mean = get_mean_value()
std = get_std_value()
v = get_speed_value()

for each step, do:
    teta = random_normal_number(mean, std)
    actual_pos = particle.get_position()
    particle.move(teta, actual_pos)
    mean = teta

QUESTION:

Every step lasts 1 second, in other words, going from position_n to position_n+1 lasts 1 second. When the world, where the particle is, is very small, 1 step/second is very big. So a created a divider variable that halves that 1 step/second:

divider = 1 yields 1 step/second
divider = 2 yields 2 step/second
divider = 3 yields 3 step/second
...

The problem is when I increase this divider, the curvature of this movement reduces. Look the image of the particle track for two different experiments:

enter image description here

I'd like to keep the curvature always the same being possible to variate the divider. I know that I have to start wrapping the divider with the standard deviation of the gaussian, because when It's small, the width of the normal curve is smaller and then the particle movement is less curved because I randomly choose a angle closer of the mean.

I'd like to know if you guys have some ideas or hints for how can I wrap divider and std to keep the curvature of the movement even changing the divider for different experiments.

(I don't know if it's a Physics or Math question.)

$\endgroup$
2
  • 3
    $\begingroup$ I think this is a (two-dimensional) Brownian motion. Even though the concept derives from physics, mathematicians (and economists) have done a lot with it. Given the (unnatural) 'steps', I'd think they (the mathematicians) would be better at it. I believe the continuous case is called a en.wikipedia.org/wiki/Wiener_process. $\endgroup$
    – Řídící
    Dec 20, 2014 at 17:55
  • 1
    $\begingroup$ I erased my answer, I do not know what is happening. $\endgroup$
    – user65081
    Dec 20, 2014 at 19:00

1 Answer 1

4
$\begingroup$

A thought experiment: after N steps, each of which create a change in angle $\Delta \theta$, we should end up with a normal distribution of angles with a standard deviation of $\frac{\sigma}{\sqrt{N}}$. When you change the step length, you therefore need to scale the standard deviation by the square root of that change, so that after moving the same distance (albeit with a different number of steps), you end up with the same normal distribution (standard deviation) of the direction - and, I assume, the curvature.

Here is a bit of Matlab code to test this:

% 2D random motion
N0 = 1000;
sigma = 1.0;
step = 1;
theta = 0;

div = [1,5,20];
figure

for jj = 1:numel(div)
    divider = div(jj);
    N = N0 * divider;
    X=zeros(1,N);
    Y=zeros(1,N);
    theta = 0;
    dTheta = (rand(1,N)-0.5)*sigma/sqrt(divider);
    x=0; y=0;

    for ii=1:numel(dTheta)
        theta = theta + dTheta(ii);
        dx = step * cos(theta)/divider;
        dy = step * sin(theta)/divider;
        x = x + dx;
        y = y + dy;
        X(ii)=x;
        Y(ii)=y;
    end

    subplot(1,numel(div),jj)
    plot(X,Y)
    title(sprintf('divider = %d',divider))
    xlim([-100 100])
    ylim([-100 100])
    axis equal
end

Which produces the following images:

enter image description here

Having changed the step size by 20x, I find it sufficiently convincing.

$\endgroup$
3
  • $\begingroup$ very nice!! But I just didn't understand well why sigma/sqrt(divider)... $\endgroup$ Dec 20, 2014 at 20:40
  • $\begingroup$ All I did was consider the distribution of angles after N steps: when you add N random variates with standard deviation $\sigma$ you end up with a distribution with standard deviation $\sqrt{N}\sigma$. So if you want the same distribution of angles after you have traveled a certain distance, then you need to scale the size of the step accordingly. And that's what I did... $\endgroup$
    – Floris
    Dec 20, 2014 at 20:45
  • 1
    $\begingroup$ That's very very nice! Worked here and I understood the idea. Thanks!! $\endgroup$ Dec 20, 2014 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.