Contours with equal area changing system

Let’s say I have a system with 3 particles in 2d system a,b,c with the following positions

a = [0.1,0.0]
b = [-0.1,0.0]
c = [0.0,0.1]

each particle is described by Gaussian function, therefore the system function is as followed:

σ = 0.08
f(x,y) = exp(-((x-a[1])^2+(y-a[2])^2)/(2(σ^2)))+exp(-((x-b[1])^2+(y-b[2])^2)/(2(σ^2)))+exp(-((x-c[1])^2+(y-c[2])^2)/(2(σ^2)))

I draw the initial system shape

x = range(-0.5,stop=0.5,length=50)
y = range(-0.5,stop=0.5,length=50)
contour(x,y,f,levels=[1.0],aspect_ratio=:equal)

InitialShapeStackOverFlowQuestion
using Plots package. After a while the particles move to other positions,for instance:

a = [0.1,-0.05]
b = [-0.1,0.0]
c = [0.05,0.1]

which changes the shape of the contour according to the same f(x,y) function (with the same sigma). I need to produce a closed contour that keep the same area for the new particle positions. How do I do that? or How can I find the “level” to reach the same area? This was an example, in fact I have many particles in my function. The Domain Astro/Space might also able to contribute

Please cross-reference your posts if you’re also asking on StackOverflow, this question appears here.

I saw your question on SO but couldn’t work out what you’re actually trying to achieve. What is the “level”? Can you provide an example of what your desired output looks like?

1 Like

I don’t think this is particularly easy to do. I guess what you want to find is something like a level set b such that A = \int \{f(x,y) ≤ b\} dxdy. I gave it some thought, figuring that since f was a sum of gaussians, the integral of it can be found analytically, but ultimately didn’t come up with anything too helpful. That’s not to say that it can’t be done…

Edit:
You can also maybe pose it as an optimization problem over the variable b and try to approach it that way.

in “level” I mean to levels=[1.0] inside the contour command. In this example, initially it would be 1.0, what would be the next value after the system evolvement?