leg

From DavinciWiki
Jump to: navigation, search

Description

Pythagorean theorem - given lengths of hypotenuse and one leg of a right triangle, return length of other leg.

Arguments and Return Values

Arguments: Two numeric arrays corresponding to the hypotenuse length and length of one leg of a right triangle (not required to be positive, as this function has applications beyond simple trigonometry). Note that the hypotenuse length (the greater value) must be the first input.

Return Value: An array of numbers whose value corresponds to the length of the triangle's other leg; output is double if input is double, float otherwise

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

Usage

Syntax: leg(x)

'x' - a numeric array (any format)

Examples

dv> leg()

Pythagorean theorem - given hypotenuse and leg, find other leg
leg(c,a) returns sqrt(c^2-a^2)
Works for arrays
S.Marshall 12-06-2007

0
dv> leg(5,4)
3.00000
dv> leg(4,5)
nan
dv> leg(5,4//3)
2x1x1 array of float, bsq format [8 bytes]
3.00000 4.00000

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