Re: Fuzzy comparison




"William Elliot" <marsh@xxxxxxxxxxxxxxxxxx> wrote in message
news:Pine.BSI.4.58.0607060239220.3435@xxxxxxxxxxxxxxxxxxxx
On Thu, 6 Jul 2006, Abstract Dissonance wrote:

I'm trying to come up with a simple function that will allow me to
compare
two real numbers in a "fuzzy" way. That is, I don't if a < b or b < a as

What do you mean when you say
I don't if .. or .. as ...

I meant that I don't care if that is true because I'm only care if a ~= b.


long as they are within some tolerance but I also want the function to
"act"
like the normal comparison in most respects(i.e., g(x) = x).

Actually, for my purposes I want a function f(x) to have the properties
for
two real numbers a and b,

if |b - a| < e then 0 <= f(b - a)

If |x| < e =~ 2.718..., then 0 <= f(x).


e is the tolerance... which should be quite clear.

if a <(>) b then f(a-b) <=(>=) f(b-a)

Bah, the <(>) is redundant

huh?

it is not necessarily true that if a < b then f(a-b) <= f(b-a) is equivilent
to a > b ==> f(a-b) >= f(b-a). Just take an even function.

if a < b, then f(a-b) <= f(b-a)
if 0 < x, then f(-x) <= f(x)
if 0 > x, then 0 < -x, f(--x) <= f(-x)
f(-x) >= f(x), same as the (>).


huh? are you assuming something about f(x)? if a < b then f(a - b) <=
f(b-a) only if f is increasing. (which was one of my hypothesis but I am
restating it here).


if a > b, then f(a-b) >= f(b-a)
if 0 > x, then f(-x) >= f(x)

f'(x) >= 0 for all x
f(x) ~= x for large x.
I'd also like to have f'(0) = 0 or ~= 0.

f(x) = x if e <= |x|
f(x) = 0 if |x| < e


Nope. I don't want f(x) = 0. It needs to be at some positive "height". f(0)
= h. The reason is that I want b - a and a - b to be both positive(after
applying f(x)) if they are "close".


In effect its very similar to what Han de Bruijn gave except I want f(x) not
to return a percentage but a value that is ~= b - a except if b ~= a then it
will return f(b - a) ~= h with the properties I stated.


.



Relevant Pages

  • JCAHO Quality Check site
    ... Quality Check is a comprehensive guide to the more than 15,000 Joint ... An improved search function displays the sites of care and the parent ... A new function allows individuals to compare up to six Joint ... Perform a search, for example, hospitals in Illinois. ...
    (sci.med.transcription)
  • Re: TVs
    ... Not really, cause it'll still be in another room, and I won't care. ... I already have 4 PCs. ... OK, so I have 2 working PCs, a ... Never compare yourself to the best others can do, ...
    (rec.games.computer.ultima.dragons)
  • Re: That Mark Mangino
    ... pre-Mangino and then using that to compare to the tone in Lawrence at ... They care about football now, ...
    (rec.sport.football.college)
  • Re: Is anyone clean?
    ... football stars in the newspaper archives from maybe 10-15 years ... Compare them to those from the most recent season. ... Let the outrage fester for a little bit. ... Then see how much you care. ...
    (rec.bicycles.racing)
  • Re: Bavarias.
    ... > (Do you care about the size of the winches? ... (Barrett Executive Starter Home or tumbledown(tumblehome;-) ... > unseaworthy - depending on what you compare it with - comparing it ... So long as nobody sees you off-loading something from Ikea. ...
    (uk.rec.sailing)

Quantcast