[Numpy-discussion] floating point arithmetic issue
Guillaume Chérel
guillaume.c.cherel@gmail....
Fri Jul 30 11:59:02 CDT 2010
On Fri, Jul 30, 2010 at 6:15 PM, Christopher Barker
<Chris.Barker@noaa.gov> wrote:
> Guillaume Chérel wrote:
>> As for the details about my problem, I'm trying to compute the total
>> surface of overlapping disks. I approximate the surface with a grid and
>> count how many points of the grid fall into at least one disk.
>
> That is a highly approximate way to do it - which may be fine, but I
> doubt any floating point errors you get are going to make it worse.
>
It is a problem in my algorithm because it modifies the number of
points that are considered inside a given disk (namely, the points
that are at the very boundary of the disk), and results in something
like an "index out of bounds" error later.
> > if you
>> know of another good way to compute the surface of overlapping disks,
>> I'd be glad to know.
>
> Are these "disks" exactly round? If so -- use coordinate geometry to
> calculate it exactly (or as exactly as floating point allows ;-) )
>
> I just googled: "area of intersecting circles"
>
> And got a bunch of hits.
Originally, I was looking to solve my problem quickly, and a rough
approximation was (and is) enough. There are indeed solutions for
computing the area of 2 intersecting disks, but my problem may involve
many more than 2 disks at a time, which makes things a lot more
complicated (to me, at least).
More information about the NumPy-Discussion
mailing list