hypot

This function computes the hypothenuse of 2 var chosen by the user.

HYPOT

NAME

hypot - This function computes the hypothenuse of 2 var chosen by the user.

SYNOPSIS

hypot(number x,number y)

DESCRIPTION

This mathematical function allows the user to compute the square root of the sum of the squares of x and y. It is equivalent to the longest side of a right-angled triangle with sides of lenght x and y, starting at (0,0).

PARAMETERS

number
Specifies the two numbers (float) used as argument for the hypot function.

RETURN

The hypothenuse of x and y.

EXAMPLES

One can use this function with integers:

test(q(res=<{hypot(3,4);}>.),q(res=5.));

With floats:

test(q(res=<{hypot(2.5,3);}>.),q(res=3.90512.));

One can use this function with another variable:

test(q(res=<{
%include "/includes/extenso.sn";
a=3;
hypot(a,a);
}>.),
q(res=4.24264.));

With a trigonometric function:

test(q(res=<{
%include "/includes/extenso.sn";
a=cos(0);
hypot(a,1);
}>.),
q(res=1.41421.));

With negative numbers :

test(q(res=<{hypot(-2,2);}>.),q(res=2.82843.));

One can also consider the limits:

test(q(res=<{hypot(-INF,INF);}>.),q(res=0.));

With an array, it simply considers its number of elements:

test(q(res=<{hypot(2,[1,2]);}>.),q(res=2.82843.))

SEE ALSO

{{ include("includes/maths.sn") }}

AUTHOR

Written by Caroline Laplante, <claplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.