Re: Fuzzy comparison
- From: "Abstract Dissonance" <Abstract.Dissonance@xxxxxxxxxxx>
- Date: Thu, 6 Jul 2006 19:49:14 -0500
"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.
.
- Follow-Ups:
- Re: Fuzzy comparison
- From: Michael Jørgensen
- Re: Fuzzy comparison
- From: William Elliot
- Re: Fuzzy comparison
- References:
- Fuzzy comparison
- From: Abstract Dissonance
- Re: Fuzzy comparison
- From: William Elliot
- Fuzzy comparison
- Prev by Date: Re: Properly combining a Rotation and Translation matrix? (linear algebra)
- Next by Date: Manners (was Re: exponent is even or odd????? please answer! ---)
- Previous by thread: Re: Fuzzy comparison
- Next by thread: Re: Fuzzy comparison
- Index(es):
Relevant Pages
|