hyp

From DavinciWiki
Jump to: navigation, search

Description

Pythagorean theorem - given right triangle leg lengths, return length of hypotenuse.

Arguments and Return Values

Arguments: Two numeric arrays corresponding to the leg lengths of right triangles (not required to be positive, as this function has many applications beyond simple trigonometry)

Return Value: An array of numbers whose values correspond to the hypotenuse lengths; output is double if input is double, float otherwise

If no arguments are input, hyp() prints its description, as shown below.

Usage

Syntax: hyp(x)

'x' - a numeric array (any format)

Examples

dv> hyp()

Pythagorean theorem - given legs, find hypotenuse
hyp(a,b) returns sqrt(a^2+b^2)
Works for arrays
S.Marshall 12-06-2007

0
dv> hyp(3,4)
5.00000
dv> hyp(-1,1//2)
2x1x1 array of float, bsq format [8 bytes]
1.41421 2.23607

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Major Sub-Functions

Related Functions

Recent Library Changes

Created On: 12-07-2007
Modified On: 01-17-2008

Personal tools