Path: news.mathworks.com!newsfeed-00.mathworks.com!newscon02.news.prodigy.net!prodigy.net!news.glorb.com!news.aset.psu.edu!news.cse.psu.edu!elk.ncren.net!newsflash.concordia.ca!canopus.cc.umanitoba.ca!not-for-mail
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Newsgroups: comp.soft-sys.matlab
Subject: Re: particle interaction
Date: Fri, 8 Feb 2008 17:17:16 +0000 (UTC)
Organization: National Research Council Canada - Conseil national de rechereches Canada
Lines: 37
Message-ID: <foi2qs$q4v$1@canopus.cc.umanitoba.ca>
References: <fo6o84$mcu$1@fred.mathworks.com> <fo7jd0$hsh$1@canopus.cc.umanitoba.ca> <fohsjn$4pu$1@fred.mathworks.com>
NNTP-Posting-Host: origin.ibd.nrc.ca
X-Trace: canopus.cc.umanitoba.ca 1202491036 26783 192.70.172.160 (8 Feb 2008 17:17:16 GMT)
X-Complaints-To: abuse@cc.umanitoba.ca
NNTP-Posting-Date: Fri, 8 Feb 2008 17:17:16 +0000 (UTC)
Originator: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Xref: news.mathworks.com comp.soft-sys.matlab:450191


In article <fohsjn$4pu$1@fred.mathworks.com>,
matias nordin <matias.nordin@gmail.com> wrote:

>Assume you have N particles.
>Spread the particles equally on a line (with symmetrical
>boundaries).

>Then apply a function (some well defined function) that
>distorts the distance between the particles. The function is
>scaled so that particles don't come too close or too far
>apart. So you can choose that "in that area  the particles
>are at this distance from each other". So I want this:

>equally spread on [1 25] as [1  5  10 15 20]

>apply a function --->

>not equally spread on [1 25] as for example [1 2 3 15 20].

I still don't see how you are going to define this in terms
of a function that could be positive or negative, such as
in your example f(x) = sin(x) .

If you restrict your function to non-negative values, and you
ignore the boundaries for a moment, you could set the element
positions at

  X1 + (X1-X0) * Int(f(t),t=X0 to x) / Int(f(t),t=X0 to X1)

where X0 and X1 are the boundary positions.

Expressed in discrete terms,

  X1 + (X1-X0) * (cumsum(f(x)) - f(X0)) / (sum(f(x)) - f(X0))

-- 
   "History is a pile of debris"                     -- Laurie Anderson