← Back to team overview

yade-dev team mailing list archive

Re: [Yade-users] Be carefull with "normalize"

 

Hi all,

I've got just a comment:
a simple solution to avoid this (without modifying [mini]wm3) is to change the user units. I think yade computation can be done with any system of units as they are consistent. For example, one can use centimeters instead of meters and deca- Newtons instead of Newtons and so on. But we must pay particular attention to the parameter values, eg. Kn that was N/m becomes daN/cm. That is exactly what JJ Moreau was doing for his very high-precision computations on old apple. I think that people that perform MD simulations (with atom-sized particles) do the same.

vr

Le 5 févr. 09 à 08:33, Václav S(milauer <eudoxos@xxxxxxxx> <Václav S> a écrit :


Well... there is no reason to avoid division by zero, and even less
reasons to return a null vector instead of (1,0,0) or something like
this.
If a division by zero makes the program crash, so should do the
normalization of a null vector. But this is still not the problem here
: vectors are not null at all, they are just "something small" with
respect to what the developper of wm3 considered "small", arbitrarily. In my understanding of number representations (someone will correct me
perhaps), there is no less precision when computing the norm of
(2e-20, 1e-20, 0) compared to the norm of (2e+20, 1e+20, 0). That is
why this tolerance makes no sense.

Think to it as a matter of units, like in previous Janek mail. If one
wants to define the simulation with lengths in gigakilometers, and get
coordinates in the range 10e-30 - 10e-32, no "tolerance" should
prevent it.
That is true. On the other hand, you want to balance the inherent
numerical imprecision from limited number of binary positions for the
number representation. The proper way is to define a "characteristic
length" for your simulation, by which you always scale some _relative_
tolerance. (Obviously adds some multiplications, but not much.)

Wm3 was conceived for graphics and games, therefore it can rightfully
suppose that 1e-8 (or 1e-20, which is value I changed it to about half
year ago) is probably close enough to zero.

If we just remove any tolerance checks, we would get a few infinities,
but that shouldn't hurt. In some cases, however, this is not desirable,
like computing Quaternion from (0,0,1) to (0,0,-1), IIRC.

Vaclav


_______________________________________________
Mailing list: https://launchpad.net/~yade-users
Post to     : yade-users@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~yade-users
More help   : https://help.launchpad.net/ListHelp







Follow ups