17 Jun 2003 chaoticset   » (Apprentice)

Okay, now I'm actively angry.

This is a really simple thing and I cannot figure/remember how to do it.

I have a set of points which provide me with a really jagged "curve". I need to calculate the point on the X axis that, if a line were drawn through it parallel to the Y axis, it would bisect this "curve" into two curves of equal area.

Now, I can imagine a series of approximation algorithms to calculate this, but I have strong suspicions that optimizing them for speed will be long, hard, and ultimately solve the problem more slowly. I cannot help but get the feeling that some sort of algebraic solution exists that I'm not aware of.

I could see using the known values of parts of the curve (because I do have the curve sectioned into between 5 and 4 sections) and determining first which section the bisect would occur in, then trying a few values and eventually narrowing it down. This is, frankly, not easy to comprehend and even more difficult to imagine coding.

Next, it occurs to me that the sections can be divided into triangles, and each section is composed of possibly three identical triangles (only in the zero case, where the sides of all triangles is zero) or two identical and one non identical (where the non identical one OR the two identical have area, at least one but not necessarily both.) This doesn't simplify anything, as far as I can tell, though.

So I have a set of points, I have the area, and I have the average value of the curve. I have no way to convert any of this into the value I NEED, the bisection point, that I am aware of.

Anybody with advice about this, please, help.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!