[Jprogramming] i.!.1e_7~
Raul Miller
rauldmiller at gmail.com
Mon Jan 16 23:06:29 HKT 2012
First: I like Roger Hui's response. And, in essence, it's doing
exactly what you suggest. However, this requires comparing every
number in the left list with every number in the right list. I am
currently pondering algorithms which rely on I. so that when the lists
are long computation times are still reasonable (perhaps with 100000
members in each list).
Second: I would want the three PI values in my original message to be
treated as equal. I want to be able to specify a magnitude of
acceptable difference which is greater than any of the differences in
that data sample.
FYI,
--
Raul
(P.S. I am also planning on responding to Linda Alvord's messages, but
I do not fully understand them yet, and my responses probably belong
in a different thread.)
On Mon, Jan 16, 2012 at 9:21 AM, Devon McCormick <devonmcc at gmail.com> wrote:
> Is there any reason you can't look at the differences directly and compare
> those? I.e.
>
> 2-/\PIs,{.PIs
> _2.38419e_7 4.76837e_7 _2.38419e_7
>
> Here we see that the third one is the odd man out with twice the
> difference. For more than three items, you would probably want to sort
> them first.
>
> On Mon, Jan 16, 2012 at 12:11 AM, Raul Miller <rauldmiller at gmail.com> wrote:
>
>> Let's suppose that I have some low precision floating point numbers:
>>
>> require 'dll'
>> PIs=: _1 fc a.{~ 219 15 73 64 220 15 73 64 218 15 73 64
>> PIs
>> 3.14159 3.14159 3.14159
>>
>> I would like to be able to recognize that some of these values are
>> close to each other
>> i.!.3e_7~ PIs
>> |domain error
>>
>> I can't use comparison tolerance on i. for this purpose, because i.
>> throws a domain error when I try to specify the precision I want to
>> use.
>>
>> I also can't use ": because I can't rely on the numbers not being "off
>> by one" when formatted -- but I can rely on them being close enough
>> that if they were slightly different they would format the same.
>>
>> --
>> Raul
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list