Description Usage Arguments Value Note References See Also Examples

Calculate the (Pythagorean) hypotenuse of two numeric vectors using the obvious algorithm.

1 | ```
hypotenuse(x, y)
``` |

`x` |
A numeric vector. |

`y` |
A numeric vector. |

A numeric vector of the hyptenuse of the inputs.

This algorithm fails when the inputs are very large of very small, making it unsuitable for real-world use.

Cleve Moler (MATLAB creator and discoverer of the Moler-Morrison algorithm for calculating hypotenuses) discusses the pro and cons of several algorithms here. http://blogs.mathworks.com/cleve/2012/07/30/pythagorean-addition

1 2 3 | ```
hypotenuse(5, 12) #okay
hypotenuse(1e-300, 1e-300) #fails
hypotenuse(1e300, 1e300) #fails
``` |

```
[1] 13
[1] 0
[1] Inf
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.