pythag: pythag calculates Pythagorus' theorum on a vector of two...

View source: R/rutils.R

pythagR Documentation

pythag calculates Pythagorus' theorum on a vector of two values

Description

pythag Pythagorus' theorum states that the length of the hypotheneuse between two lines at right angels to each other (that is in cartesian coordinates) is the sqrt of the sum of their squares.

Usage

pythag(x)

Arguments

x

a vector of two numbers or a matrix of pairs of numbers

Value

a single number or a vector depending on input

Examples

## Not run: 
 pythag(c(3,4))  # should be 5
 dat <- matrix(c(3,4,5,7),nrow=2,ncol=2,byrow=TRUE)
 print(dat)
 pythag(dat)     # should be 5 and 10

## End(Not run)

haddonm/rutilsMH documentation built on July 21, 2023, 8:46 p.m.