commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Glas <>
Subject Re: [math] "equals" in "Vector3D"
Date Wed, 29 Apr 2009 09:04:46 GMT
Gilles Sadowski schrieb:
>>> L1 norm: equals(a, b, tolerance) = sum(abs(a-b)) < tolerance
>>> L2 norm: equals(a, b, tolerance) = sqrt(sum((a-b)^2)) < tolerance
>>> L-infinity norm: equals(a, b, tolerance) = max(abs(a-b)) < tolerance
>>> All are useful.
>> I'll guess for 3D vector the L2-norm is the more useful as it is
>> invariant when physical orthonormal frames are changed.
>> I'll check in the variant you prefer.
> [Cf. my other reply.]
> Should I still create an issue?

I'm currently not invovled in commons-math, but I've written substatntial amount
of numeric software.

My thought on this point is, that it is generally more feasible to implement a
bunch on distance methods like

  a.distance1(b)   ... L1-Norm
  a.distance(b)    ... L1-Norm (this is usually what the user wants as default)
  a.distanceInf(b) ... L∞-Norm

and have the user decide on what is equal in his particular situation.

There is a very good article on ieee754 equality under

which contains an excessive discussion about various "equality" approaches.

IMHO it should be moreover considered to include the "AlomostEquals2sComplement"
method of this paper into commons-math if not done so far.

  Best regards,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message