Julia Hypotenuse Function

Julia Hypotenuse function is used to find the square root of squared sides.

Hypotenuse is the side opposite to the right angle in a right-angled triangle.

In this Julia Tutorial, we will learn how to use the hypotenuse function, hypot(x,y) where x and y are other two sides of the triangle, with examples.

Example 1 – Julia Hypotenuse Function

With Real Sides

julia> x = 3
3

julia> y = 4
4

julia> hypot(x,y)
5.0

With sides having floating point lengths

julia> x = 3
3

julia> y = 4.4
4.4

julia> hypot(x,y)
5.325410782277739

With complex numbers as sides of the triangle

julia> x = 2 + 3im
2 + 3im

julia> y = 4 + 2im
4 + 2im

julia> hypot(x,y)
5.744562646538029

Conclusion

In this Julia Tutorial, we learned about Julia Hypotenuse function and its usage.