pythag | R Documentation |
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.
pythag(x)
x |
a vector of two numbers or a matrix of pairs of numbers |
a single number or a vector depending on input
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.