Map and Table Calculation

HYP( ) function

Returns the hypotenuse Ö(a2 + b2), i.e. the positive square root of the sum of Value a square and Value b square.

Syntax

HYP(Value a, Value b)

Input

Value a is a value
Domain type: any Value domain
Value b is a value
Domain type: any Value domain

Output

HYP returns: a real value
Domain: system domain Value
Value range: >=0

Note:

When one of the input parameters is undefined, or when both input parameters are undefined, the output will also be undefined.

Tips:

Usable in

MapCalc, TabCalc, Simple calculators

Examples

Pocket line calculator examples:

? HYP(1,1)

returns 1.4142, i.e. Ö2

? HYP(3,4)

returns 5.0000

MapCalc example:

OutMap = HYP(InMapA,InMapB)

 

MapA

MapB

OutMap

1 2 3
-2 0 ?
? 4 -9
1 2 4
3 1 8
9 6 0
1.4142 2.8284 5.0000
3.6056 1.0000 ?
? 7.2111 9.0000

TabCalc example:

OutCol = HYP(InColA,InColB)

 

InColA

InColB

OutCol

1

1

1.4142

2

2

2.8284

3

4

5.0000

-2

3

3.6056

0

1

1.0000

?

8

?

?

9

?

4

6

7.2111

-9

0

9.0000

Applied example: calculation of slope values in percentages

The exponential HYP function can for instance be used to calculate slope values in percentages, from 2 input maps which contain heigth differences in x-direction (map DX) and in y-direction (map DY).

DX

DY

Slopepct

-8.0 -0.2 9.2
-9.7 1.1 10.8
-8.0 -0.4 13.0
6.3 11.3 3.7
8.3 7.3 8.8
7.7 0.8 18
50.9 56.5 49.6
63.8 36.9 69.7
55.5 4.5 111.02

Slopepct = (HYP(DX,DY)/PIXSIZE(DX)) * 100

PIXSIZE(DX) is a function which retrieves the pixel size of map DX. You can also directly fill out the pixel size of the input maps yourself (in this case 20). The results may exceed 100%, as a slope of 45° is equal to 100%. 

See also: