# Re: Magnitude of a 3d vector

*From*: illywhacker <illywacker@xxxxxxxxx>*Date*: Tue, 29 Mar 2011 10:11:48 -0700 (PDT)

On Mar 29, 5:54 pm, Clay <c...@xxxxxxxxxxxxxxx> wrote:

On Mar 27, 9:52 am, Vladimir Vassilevsky <nos...@xxxxxxxxxxx> wrote:

There was a need for quick and dirty approximation of the magnitude of

the 3-dimensional vector (x,y,z). This is what worked best:

Let x = max(x,y,z)

Then magnitude ~ x + 0.25*(y+z)

Accuracy ~ 13%

Interestingly, this provides for better accuracy then the sequential use

of the two 2d approximations (see Lyons's "Root of all evils").

Vladimir Vassilevsky

DSP and Mixed Signal Design Consultanthttp://www.abvolt.com

Hey Vlad,

I wrote some Monte Carlo test code and I get:

|r| = 0.90 x + 0.38 (y+z) with avg err=0 and standard deviation

(relative length) of 0.029

where x is the max of the absolute values of x,y,z and y+z is the sum

of the remaining two absolute values.

These coefs are close to minimizing the variance of the relative

error.

You are using the uniform distribution on the unit sphere, are you?

illywhacker;

.

**Follow-Ups**:**Re: Magnitude of a 3d vector***From:*Clay

**References**:**Magnitude of a 3d vector***From:*Vladimir Vassilevsky

**Re: Magnitude of a 3d vector***From:*Clay

- Prev by Date:
**Re: Magnitude of a 3d vector** - Next by Date:
**Re: Time scale modification?** - Previous by thread:
**Re: Magnitude of a 3d vector** - Next by thread:
**Re: Magnitude of a 3d vector** - Index(es):