Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

COBOL is for morons. -- E. W. Dijkstra


devel / comp.lang.xharbour / Re: Nearness of two number/

SubjectAuthor
* Nearness of two number/Mel Smith
`* Re: Nearness of two number/dlzc
 `* Re: Nearness of two number/Mel Smith
  `- Re: Nearness of two number/Ella Stern

1
Nearness of two number/

<65c68d1c-7749-42e6-8196-0a0f322c5a87n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16748&group=comp.lang.xharbour#16748

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ac8:44a8:: with SMTP id a8mr23063273qto.238.1628087766923; Wed, 04 Aug 2021 07:36:06 -0700 (PDT)
X-Received: by 2002:a05:620a:24ca:: with SMTP id m10mr7833312qkn.323.1628087766754; Wed, 04 Aug 2021 07:36:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Wed, 4 Aug 2021 07:36:06 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=96.52.125.244; posting-account=dQ0_awoAAABF2-Sui2Av5bZD8Vt8zYRC
NNTP-Posting-Host: 96.52.125.244
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <65c68d1c-7749-42e6-8196-0a0f322c5a87n@googlegroups.com>
Subject: Nearness of two number/
From: medsyntel@gmail.com (Mel Smith)
Injection-Date: Wed, 04 Aug 2021 14:36:06 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: Mel Smith - Wed, 4 Aug 2021 14:36 UTC

Hi All:
I'm working on a little Harbour program where my algorithm has to decide on the nearness of n sets of numbers. There are two integers in each set. I retain a measurement of of each set :

Here is the algo I am using to compute and save the 'nearness' of each set:

nVal := ABS(log(a)-log(b))

where a and b are the two numbers in each set. (Typical values of a and b will range up in the trillions.)
I will save/compare this nVal with many thousands of other nVals and decide with nVal is the smallest value, and so which set is 'nearest'.

I don't expect a and b to ever be identical, but, if they are, I would be delighted. But, first, I wish to find the nearest.

Question: Is there a better algo that you know off than the one I show above. ??
-Mel

Re: Nearness of two number/

<87d830f0-29b9-4d48-b114-fc2e7db7cd2dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16750&group=comp.lang.xharbour#16750

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a0c:c490:: with SMTP id u16mr6280qvi.26.1628089850117; Wed, 04 Aug 2021 08:10:50 -0700 (PDT)
X-Received: by 2002:a37:b6c5:: with SMTP id g188mr25187885qkf.92.1628089849994; Wed, 04 Aug 2021 08:10:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Wed, 4 Aug 2021 08:10:49 -0700 (PDT)
In-Reply-To: <65c68d1c-7749-42e6-8196-0a0f322c5a87n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=68.107.209.13; posting-account=7bF0GwoAAABMFHX6V4fON4-1F6LFJ834
NNTP-Posting-Host: 68.107.209.13
References: <65c68d1c-7749-42e6-8196-0a0f322c5a87n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <87d830f0-29b9-4d48-b114-fc2e7db7cd2dn@googlegroups.com>
Subject: Re: Nearness of two number/
From: dlzc1@cox.net (dlzc)
Injection-Date: Wed, 04 Aug 2021 15:10:50 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 29
 by: dlzc - Wed, 4 Aug 2021 15:10 UTC

Dear Mel Smith:

On Wednesday, August 4, 2021 at 7:36:07 AM UTC-7, meds...@gmail.com wrote:
....
> I'm working on a little Harbour program where my algorithm has to
> decide on the nearness of n sets of numbers. There are two integers
> in each set. I retain a measurement of of each set :
>
> Here is the algo I am using to compute and save the 'nearness' of each set:
>
> nVal := ABS(log(a)-log(b))

Why not just ABS(a-b)? Is {1,2} further apart than {10001,10002}? (0-0.30) vs. (4.00004-4.00009)

Plus log() involves lots of calculations... might be better off with ABS(a/b) or ABS( (a-b)/(a+b) ) if you really want "nearness" to be scaled by "average size". And if you want to stick with logs, just use ln(), slightly faster.

> where a and b are the two numbers in each set. (Typical values of a
> and b will range up in the trillions.) I will save/compare this nVal with
> many thousands of other nVals and decide with nVal is the smallest
> value, and so which set is 'nearest'.
>
> I don't expect a and b to ever be identical, but, if they are, I would be
> delighted. But, first, I wish to find the nearest.
>
> Question: Is there a better algo that you know off than the one I show
> above. ??

Form the "nearness" as you load the array, and have that be one of the terms in the array. Then sort.

David A. Smith

Re: Nearness of two number/

<bab772fd-6e06-4077-af7f-e3504191f22bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16751&group=comp.lang.xharbour#16751

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ac8:4783:: with SMTP id k3mr139882qtq.296.1628090598670;
Wed, 04 Aug 2021 08:23:18 -0700 (PDT)
X-Received: by 2002:ad4:4ee5:: with SMTP id dv5mr8517580qvb.3.1628090598497;
Wed, 04 Aug 2021 08:23:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Wed, 4 Aug 2021 08:23:18 -0700 (PDT)
In-Reply-To: <87d830f0-29b9-4d48-b114-fc2e7db7cd2dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=96.52.125.244; posting-account=dQ0_awoAAABF2-Sui2Av5bZD8Vt8zYRC
NNTP-Posting-Host: 96.52.125.244
References: <65c68d1c-7749-42e6-8196-0a0f322c5a87n@googlegroups.com> <87d830f0-29b9-4d48-b114-fc2e7db7cd2dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bab772fd-6e06-4077-af7f-e3504191f22bn@googlegroups.com>
Subject: Re: Nearness of two number/
From: medsyntel@gmail.com (Mel Smith)
Injection-Date: Wed, 04 Aug 2021 15:23:18 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mel Smith - Wed, 4 Aug 2021 15:23 UTC

Hi David:
Thanks for your alternate solutions. I will test and consider them.
I've been looking at 'nearness' for a couple of days now, and there seem to be several different thoughts/ways to measure.
-Mel

Re: Nearness of two number/

<a1c6a200-3810-4a7e-8b74-eae5928adc8fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16757&group=comp.lang.xharbour#16757

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a37:a303:: with SMTP id m3mr3049316qke.299.1628151077320; Thu, 05 Aug 2021 01:11:17 -0700 (PDT)
X-Received: by 2002:ac8:1487:: with SMTP id l7mr263481qtj.345.1628151077083; Thu, 05 Aug 2021 01:11:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.uzoreto.com!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Thu, 5 Aug 2021 01:11:16 -0700 (PDT)
In-Reply-To: <bab772fd-6e06-4077-af7f-e3504191f22bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.78.22.234; posting-account=H3ofRwoAAADbRxQ3Wi989fFKCMQ4Av_J
NNTP-Posting-Host: 82.78.22.234
References: <65c68d1c-7749-42e6-8196-0a0f322c5a87n@googlegroups.com> <87d830f0-29b9-4d48-b114-fc2e7db7cd2dn@googlegroups.com> <bab772fd-6e06-4077-af7f-e3504191f22bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a1c6a200-3810-4a7e-8b74-eae5928adc8fn@googlegroups.com>
Subject: Re: Nearness of two number/
From: ellailona@gmail.com (Ella Stern)
Injection-Date: Thu, 05 Aug 2021 08:11:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 11
 by: Ella Stern - Thu, 5 Aug 2021 08:11 UTC

On Wednesday, August 4, 2021 at 6:23:19 PM UTC+3, meds...@gmail.com wrote:
> Hi David:
> Thanks for your alternate solutions. I will test and consider them.
> I've been looking at 'nearness' for a couple of days now, and there seem to be several different thoughts/ways to measure.
> -Mel

In case the (x, y) sets are points in 2D, there is possible to calculate their distances to aka center of mass point, for example the (median_of_my_x_values, median_of_my_y_values) ...it depends on the distribution of your points (medium might work better than median, or just half of the difference between minimum and maximum etc.).

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor