Learn R Programming

MiscMath (version 1.1)

LawofCosines: Law of Cosines

Description

Use of the ancient law of cosines to determine the angle between two sides of a triangle, given lengths of all three sides. This is a generalization of Pythagoras' Theorem.

Usage

LawofCosines(sides)

Value

a numeric constant giving the angle in between the sides corresponding to the first two components in sides. Result is expressed in degrees.

Arguments

sides

a numeric vector of length 3, containing the side lengths.

Examples

Run this code
LawofCosines(c(3, 4, 5))

Run the code above in your browser using DataLab