MathGroup Archive 2011

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

Search the Archive

How to compute a recurrence in 2D using mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118471] How to compute a recurrence in 2D using mathematica?
  • From: Carlos <ccaicedo at princeton.edu>
  • Date: Fri, 29 Apr 2011 07:31:28 -0400 (EDT)

Dear all, 
I am having the following problem:

I have a compact region (which we should call D from now on) in the plane (assume for simplicity is a square with main diagonal having coordinates {-L,-L},{L,L}).   I have N points in the interior of D, call them p1,... pN; where pi=(xi,yi).  

This is what I want to do: Around each point, I build a gaussian (e^(-a(x-xi)^2-b(y-yi)^2)).  So, if you superimpose all of them, you get a field in your square with a bunch of "peaks".  Let's say, for simplicity, that at point (x,y), the value of the field is the maximum of all the induced gaussians.  We will call this F(0,x,y) (i.e. 0 for initial time, (x,y) for the location).

Now, suppose we know F(k,x,y) for k>=0, we want F(k+1,x,y).  The N points, are now going to be in positions p1(k+1),p2(k+1),....,pN(k+1).  Just as in the case k=0, we build a field (which we would call G(k+1,x,y)), that at point x,y is the maximum of the induced gaussians.  We then make F(k+1,x,y)=F1(F(k,x,y),G(k+1,x,y)) where F1 is some operator (for instance, .9F+G; or FG, or Abs(F-G) or something like that... I want to be able to tune it, so I am not compromising for a specific one). 

My question is: How do I implement this in Mathematica? If I were working on a discrete grid it would be easy to do, but I want the value for each x,y; and that is when Mathematica doesn't like it... I have been able to do something like: 

Test[1] := Simplify[ValueField[1, x, y]];
Test[k_] := 
  Simplify[[Sort[Append[SensorPrints[k, x, y], .9  Test[k - 1]], 
       Greater][[1]] + (1 - 
        Sort[Append[SensorPrints[k, x, y], .9  Test[k - 1]], 
          Greater][[1]]) WeightedAverage[
       Sort[Append[SensorPrints[k, x, y], .9  Test[k - 1]], 
         Greater][[2 ;; All]]]]];


But that takes FOREVER to compute (I want to know the value of the field for, let's say, 150 steps), so that is clearly NOT the way of doing it.

Suggestions/comments are extremely appreciated.

Thanks,
Carlos


  • Prev by Date: Re: Limit[f[x], x->a] vs. f[a]. When are they equal?
  • Next by Date: Re: Limit[f[x], x->a] vs. f[a]. When are they equal?
  • Previous by thread: Re: and color via PlotStyle
  • Next by thread: Integer Linear Programming