Sign in to follow this  

S = f(distance) that creates points of equilibrium (Help please)

This topic is 3860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need a function that makes particles move but stabilize at regular distances. Having two particles, each exerts a force over the other. I want the particles to stabilize at regularly spaced positions. It would seem that a simple thing should work: F = cos(x); S = S0 + F; Where S is the new position, S0 the old one and x the distance to the other particle. However, the particles keep moving back and forth (between to tops) or keep closing or separating if they started with some speed. I need some way of "damping" the function so particles tend to stay in the points where F = 0. Any idea?

Share this post


Link to post
Share on other sites
If I understand correctly, we have an discrete, autonomous, iterative model:

pi+1 = g(pi)
(in your terms, g(x) = x + f(x))

for real valued pj. Right? With a little care, we can define exactly which values of p will be fixed and if they'll be stable. For this, we'll need some linear stability analysis:

First note that there is a fixed point at any p for which

p = g(p)

Linearising about this point, we can write a new variable qi = p + ri. Now ri is very small. Using a Taylor expansion, we can show:

qi+1 = g(qi)
qi+1 = g(p + ri)
qi+1 = g(p) + ri*g'(p)/1! + ri2*g''(p)/2! + ...
qi+1 = p + ri*g'(p)/1! + ri2*g''(p)/2! + ...
p + ri+1 = p + ri*g'(p) + ri2*g''(p)/2! + ...
ri+1 = ri*g'(p) + ri2*g''(p)/2! + ...

Since r is small, it is safe can ignore terms of order r2 or above. This leads us to the approximation:

ri+1 = rig'(p)

This equation says that |r| will increase (i.e. the particle will move further away) if the RHS is greater in magnitude than 1. Similarly, the particle will return to its original position if |RHS| is less than one. It's only a approximate linearised model, but it's remarkably accurate for well-behaved functions g.

So here's how to put the theory into practice:

If you want a fixed point at x, make sure that g(x) = 0;
If you want this point to be stable, make sure that |g'(x)| < 1.

So, for equally-spaced 'attractor nodes', we could take your cosine model, remove that x term, and squash it a little so that |dg/dx| < 1.

g(x) = 0.8 * cos(x) would do the trick, as every zero-crossing has derivative ±0.8. Eventually, all points will settle down to their homes. (In your notation, f(x) = 0.8 * cos(x) = x).

On the other hand, g(x) = 1.1 * cos(x) would have unstable points at every cosine root, and no particle would ever stabilise.

I hope this helps.
Admiral

Share this post


Link to post
Share on other sites
First of all, that was beyond greatness. Thank you very much.

Quote:
Original post by TheAdmiral
g(x) = 0.8 * cos(x) would do the trick, as every zero-crossing has derivative ±0.8. Eventually, all points will settle down to their homes. (In your notation, f(x) = 0.8 * cos(x) = x).


Each iteration, I apply a force radiating from each particle to the other... waaaait a second.

I was about to post a nice log with the positions and asking for help because the particles vibrated wildly. And then I understood. < 1 was the limit total force but I'm applying the force from both the particles to each other. With .4 it all works.

Then I've tried with more particles and I've seen when they accumulate enough force to become unstable and make one pass to the next x=0.

Then I've turned the 0.8 to 0.1 to allow for more particles.

And then I've turned it all into
0.8 / number_of_particles * Cos(d * Math.PI)

Which works just about perfect.


Anyway, you made me understand, so now I can keep exploring unhampered.

Thank you really very much.

Share this post


Link to post
Share on other sites

This topic is 3860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this