--- greg heil <[EMAIL PROTECTED]> wrote:
> Maybe it needs to be built in. Perhaps fit could have a fit.-) Dunno,

I thought I could have a fit, too. :)

It turns out there are different types of tolerance
or use cases. It was referred earlier as relative
and absolute.

Relative tolerance is the model adopted in J.
It is good for the scale domain, that is comparing
sizes. There is an inverted cone in space, with its
origin at zero: if we fit our objects just under the
wall of the cone, we can compare them with ones close
to each other. Manufacturing screws you can compare
with small identity radius, but for carrier hull the
same tolerance will be scaled to a radius propotional to
the larger object.

However, for some mystical reasons J implementation
does not allow the tolerance (factor of the radius)
to grow above 2^_34, thus, as pointed out by Roger Hui
  http://www.jsoftware.com/jwiki/Essays/Tolerant_Comparison
The reason is probably to remove the tolerance code at all
from integer branch, but still so that it behaves the
same as reals. This may be limiting for those applications,
with smaller scale 0.001 to 1000 for example, to which
this integer argument is not applicable: it manifests
on values >~2^31. This is also why it's hard to grasp
this limitation concept.

Moreover, the relative model for now clear natural reasons
makes non sense for comparing with zero, formally shown by
Roger Hui.


Absolute tolerance is good for comparing locations,
for example, target hitting. Though, there will be
different radii for bullets and cruise missiles,
they will not depend on location of the hit.
One proposed solution was, by Henry Rich

  tol >:!.0 |@-  or  (*:tol) >!.0 (*+)@:-

and a variation for reals, consequence from Devon McCormick

  tol >: >. - <.

The problem with them is that they do not generalize
to other fitted verbs, such as -.

Alternative approach is tranforming the domain while
employing regular verbs was studies by me: 
"if we cannot modify the verb, we modify the data".
This is good for bounded domains, esp. which include zero.
The idea is to move the domain far enough from zero
so that deviations of the radius is properly proportional
to the original range of the domain (tolerance of tolerance
as Greg Heil said, or paramter n).

However, in it's simplest form, which is readily used
with other tolerance fitted verbs is "under shift"

  unshift=: 2 : 'u&.:(+&n)'

   _1e_10 0 1e_10 (-.unshift 10000) 0

   _1e_10 0 1e_10 (-.unshift 1000) 0
_1.00044e_10 1.00044e_10

To overcome the fit limitation 2^_34, the under
can also include scale, making it a linear transform,
which nicely underizes as follows:

   (1000 + 0.25 * ]) b. _1
4 * _1000 + ]

   _1e_10 0 1e_10 -.&.:(1000 + 0.25 * ]) 0

   _1e_10 0 1e_10 -.&.:(100 + 0.25 * ]) 0
_9.99876e_11 9.99876e_11



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to