# Recipe7.5.Using Trigonometry Functions

### Recipe 7.5. Using Trigonometry Functions

#### Problem

You need to become familiar with Excel's support for trigonometric functions .

#### Solution

Explore the trigonometric functions summarized in Table 7-5.

##### Table 7-5. Trigonometric functions

Function

Syntax

Description

SIN

=SIN(angle)

Returns the sine of the given angle, where angle is in radians.

COS

=COS(angle)

Returns the cosine of the given angle, where angle is in radians.

TAN

=TAN(angle)

Returns the tangent of the given angle, where angle is in radians.

ASIN

=ASIN(n)

Returns the inverse sine of the given number, n, where n must be within the range -1 to 1. The returned angle is in radians and within the range -p/2 to p/2.

ACOS

=ACOS(n)

Returns the inverse cosine of the given number, n, where n must be within the range -1 to 1. The returned angle is in radians and within the range 0 to p.

ATAN

=ATAN(n)

Returns the inverse tangent of the given number, n. The returned angle is in radians and within the range -p/2 to p/2.

 Excel's function PI( ) returns the value of p (i.e., 3.14159265358979...), which you might find useful in some calculations.

#### Discussion

The trigonometric functions take or return angles in radians. However, often degrees are more convenient to work with. Excel provides two functions making conversions between radians and degrees easy: RADIANS and DEGREES. Use RADIANS(angle) to convert an angle from degrees to radians. Use DEGREES(angle) to convert an angle from radians to degrees. For example, =COS(RADIANS(45)) returns the cosine of the angle 45 degrees.

### Recipe 7.6. Seeing Signs

#### Problem

You want to capture only the sign of an expression, not its value. Or you want to take the absolute value of an expression.

#### Solution

Use the SIGN function in the former case and the ABS function in the latter case.

#### Discussion

Situations often arise in scientific calculations when you're more interested in the sign of an expression than in the resulting value. For example, the formula

```=\$F3-\$E\$8/(ABS(G\$2/\$F\$2))*ABS(G\$2/\$F\$2)^0.1*SIGN(G2-F2)
```

uses the SIGN function to compute the algebraic sign of the expression (G2-F2) and multiplies the rest of the formula by that sign (as a unit value). If (G2-F2) evaluates to a negative value, then the formula is multiplied by -1; if (G2-F2) evaluates to a positive number, then it is multiplied by +1 instead.

In this particular case, the expression (G2-F2) represents some change in value of a dimensional parameter and the direction of that change (i.e., positive or negative) is used as a scale factor to scale some other parameter from a baseline using an empirical formula. In other examples, you may be interested in whether some value is greater or less than zero, which you can determine by checking the sign of the value. The SIGN function allows you to perform such a check very easily and use the result in other computations or logical functions like the IF function.

You'll notice that in the example formula discussed a moment ago, I also used the absolute value function, ABS. The syntax for this function is =ABS(value or expression), where you can supply a value, cell reference, or some mathematical expression.