Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Math.hypot()

2 tags 1 category

The Math.hypot() static method returns the square root of the sum of squares of its arguments. That is,

𝙼𝚊𝚝𝚑.𝚑𝚢𝚙𝚘𝚝(v1,v2,…,vn)=∑i=1nvi2=v12+v22+…+vn2mathtt{operatorname{Math.hypot}(v_1, v_2, dots, v_n)} = sqrt{sum_{i=1}^n v_i^2} = sqrt{v_1^2 + v_2^2 + dots + v_n^2}

Calculating the hypotenuse of a right triangle, or the magnitude of a complex number, uses the formula Math.sqrt(v1*v1 + v2*v2), where v1 and v2 are the lengths of the triangle’s legs, or the complex number’s real and complex components. The corresponding distance in 2 or more dimensions can be calculated by adding more squares under the square root: Math.sqrt(v1*v1 + v2*v2 + v3*v3 + v4*v4).

Syntax example: Math.hypot()

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…