MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: weighting CA neighbors by distance

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29913] Re: weighting CA neighbors by distance
  • From: "Orestis Vantzos" <atelesforos at hotmail.com>
  • Date: Wed, 18 Jul 2001 02:08:53 -0400 (EDT)
  • Organization: National Technical University of Athens, Greece
  • References: <9iomeb$i0u$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

ListCorrelate[{{1/Sqrt[2], 1, 1/Sqrt[2]}, {1, 0, 1}, {1/Sqrt[2], 1,
1/Sqrt[2]}}, A, {2, -2}, 0]
does what you want.
The first argument is the "negihbors matrix" you have, with 1/Sqrt[#.#]&
mapped to its elements.
The third argument {2,-2} took half an hour of unsuccesfull attempts to get
right!
A is the CA matrix ofcourse.
Orestis
PS.The documentation on ListConvolve and ListCorrelate leaves a lot to be
desired , for such devilishly usefull functions.

"Brent Pedersen" <bpederse at nature.berkeley.edu> wrote in message
news:9iomeb$i0u$1 at smc.vnet.net...
> I am doing some variations of cellular automata.
> Using only the actual value of the neighbors in determining the value of
> the current cell, I can use:
>
> Apply[Plus, Map[RotateRight[mat1, ##] &, nbrs]];
>
> where mat1 is the matrix of values for whatever the CA is modelling.
> and nbrs is a list of pairs (eg.
> {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},
> {1,1}} for the 8 cell moore neighborhood.)  defining the neighborhood I
> am interested in.
>
> The line above sums all neighbors as they are but, I wish to weight the
> neighbors
> according to their distance (eg. {-1,-1} is farther away than {-1,0}
> when using the
> RotateRight function.
> I think I may be able to do this with ListConvolve, or Inner but I can't
> figure it out.
> Anyone have any ideas?
>
>




  • Prev by Date: Re: Printing Large Base-n Numbers
  • Next by Date: Re: Re: Re: Thread and MapThread
  • Previous by thread: Re: weighting CA neighbors by distance
  • Next by thread: 1) Numerical precision, 2) Bug in Plot?