# Older blog entries for chaoticset (starting at number 4)

Well, there's good news and bad news.

Good news: Last night I figured out how to solve my problem (thanks again for the help, but my knowledge of calculus is miniscule, so I'd end up researching a lot more of those terms than with this homebrew which is, probably, the same damn formula. I don't eschew knowledge, I just want to finish this thing ASAP) by scribbling all over a piece of paper for several hours. I got to bed around 5.

Other good news: Flare, for one, because I honestly think it could have some interested repercussions. Lots of neat stuff could be done with Flare that would have a natural storage solution with XML data storage, and lots of neat stuff could be done with existing XML data as Flare data structures, IMHO.

I'm not smart enough to do it -- yet -- but I will be, dammit. Flare. I can't say it enough.

So, my next step here is to code the rest of the solution I whanged out last night and then start refactoring, assuming I can make the solution work immediately. My main problem is one that I believe was discussed in the assistance one diary entry provided, that of curves with two intersections with the average point and no more. (The two "end" intersections don't count for my purposes, so I need to figure out how to make sure there's a middle, and my model doesn't cover what to do if there isn't one.) I'm considering a few attempts at proving it's possible, just to make sure that this is something I should be worrying about. (With my incoming data, it probably isn't. The truly worrisome case I could see is where there are MULTIPLE points past two, seven or eight averages in the middle that I need to worry about. Sigh.)

So if this doesn't pan out then I'm going to take the tougher plan and figure out a way to bisect it, which should provide the results I need no matter how many "average" points there are. Goddamn modes.

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.

It occurs to me that a Perl module built to provide a simple interface for turning text files into "Note Pad" files on Palm OS would be really handy for me. The further thought continues that, since it might be handy for me, it could be handy for others, and if that's the case, there's a 50% chance someone already built it. (And if someone didn't write the exact thing I'm thinking of, there are 20% odds that something in there is 80% of what I need.)

Whew. All these percentages!

Anyway, that's on the back burner until I get the fuzzy stuff done. I just wanted to note it while I was thinking about it.

Currently, still working on my fuzzy module. I don't have the faintest clue if this is going to sound coherent, but I'll try.

You have one set of rules defining a set of input ranges. You have another set of rules defining a set of output ranges. A third set of rules links the inputs to the outputs. If an input is contained within a single input range, it is measured according to where it is contained within that single range and proportionally translates to a single value in the output range that corresponds to that input.

If it is inside two inputs, the degree to which it is contained within both is measured, and then both outputs are used to proportionally produce a single value that corresponds to both output ranges.

This is a relatively simple concept that I think people would like to be able to plug into their Perl. (It's meant to provide an interface to any two things that are meant to be a feedback loop, like the temperature in a room and the speed of your air conditioner motor, or the dirtiness of your clothes and the amount of soap your washing machine uses.) I mean, I could see this kind of thing performing code optimization for you on the fly (say, rating incoming datasets on sortedness and then picking a good sorting algorithm) if it's fast enough.

Key: IF it's fast enough.

Right now the code is a damn mess, like worse than most things I've recently written. I'm trying to get it down as quickly as I can, which is probably part of the issue -- most of my design was on the interface, and that went smooth as silk. The guts, well, I thought I had a nice clear math model to work with, but it turns out I didn't understand it correctly.

The second I figured that out, I should have stopped, ripped everything out but the interface, and started over after a few days of rereading the details.

Instead, I plugged along, and now I'm determined to make this thing work, dammit.

Anyway, today is hopefully the last day of writing new code. The rest of my time with this thing will be documentation and refactoring (not necessarily in that order).

I have almost everything. I have the dataset describing the points that describe the "curve" needed in this model. Today I write the part that determines the average height of that curve and then determines the point of average height in the curve. (I keep hoping that some insight will make me realize that I have some sort of simple algebraic model, but I can't find it, so I'm going to forge ahead with this monstrosity of math.)

I'm not really a programmer yet. I'm not really a mathematician. If I were either, this would be going so much easier.

Anybody who knows how to implement Bart Kosko's SAM off the top of their head, please, let me know.

This is a test. Had this been an actual diary entry, I would be displaying my meager knowledge of programming here. This is only a test.