LawofSines: Law of Sines

View source: R/LawofSines.R

LawofSinesR Documentation

Law of Sines

Description

Use of the ancient law of sines to determine the angle opposite one side of a triangle, given the length of the opposite side as well as the angle opposite another side whose length is also known. Alternatively, one can find the length of the side opposite a given angle.

Usage

LawofSines(sides, angles, findAngle)

Arguments

sides

a numeric vector of length 1 or 2, containing the side lengths.

angles

a numeric vector of length 1 or 2, containing the angles (in degrees).

findAngle

a logical constant

Details

If findAngle is TRUE, sides should be of length 2 and the function will compute angle opposite the side with length given by the second element of sides. Otherwise, angles should be of length 2, and the function will calculate the length of the side opposite the angle corresponding to the second element of angles.

Value

a numeric constant giving the angle opposite the given side, if findAngle is TRUE, or giving the length of the side opposite the given angle, if findAngle is FALSE.

Examples

LawofSines(c(3, 4), 50)  # find angle opposite the side of length 4.
LawofSines(3, c(70, 50), findAngle = FALSE) # find length of side opposite the 50 degree angle

MiscMath documentation built on April 13, 2025, 9:07 a.m.