Skip to content

magnitude

Subhajit Sahu edited this page Aug 8, 2022 · 2 revisions

Calculate the magnitude (length) of a vector.

Alternatives: magnitude.
Similar: magnitude.


function magnitude(xs)
// xs: vector ([x, y, z, ...])

const xmath = require('extra-math');


xmath.magnitude([5, 9]);
// → 10.295630140987

xmath.magnitude([10, 2, -1]);
// → 10.246950765959598


References

Clone this wiki locally