# TAN: Your Angle's Best Friend (and a Bit of a Daredevil)

Need to find the tangent of an angle? Look no further than the `TAN`

command, your angle's best friend (but with a bit of a daredevil streak)! This trigonometric function takes an angle (in radians) and returns its tangent value, a key ingredient in understanding the relationships between angles and sides in right triangles, as well as in modeling slopes and rates of change. Just be careful, because `TAN`

can sometimes get a bit wild with certain angles!

### Syntax

```
TAN(<angle>)
```

Where:
- `<angle>`

: The angle (in radians) for which you want to find the tangent.

### Applications

The `TAN`

command is your go-to tool when:

**Working with right triangles:**Find the ratio of the opposite side to the adjacent side, given an angle.**Calculating slopes and gradients:**Tangents represent the steepness of a line or surface.**Modeling rates of change:**The tangent function is related to derivatives in calculus, used to describe how quantities change over time.**Creating games and simulations:**Calculate trajectories, angles of reflection, and other movements based on angles.

### Code Examples

**1. Simple Tangent Calculation:**

```
10 PI=3.141592653
20 R = PI/4 :rem Angle of 45 degrees in radians
30 T = TAN(R) :rem T stores the tangent of the angle
40 PRINT T :rem Output: 1
```

This example demonstrates how to find the tangent of 45 degrees (which is 1).

**2. Finding Slope:**

```
10 PI=3.141592653
20 INPUT "Enter rise: "; Y
30 INPUT "Enter run: "; X
40 IF X=0 THEN PRINT "Undefined slope!": END :rem Avoid division by zero
50 M=Y/X :rem Slope is rise over run
60 A=ATN(M)*180/PI :rem Calculate the angle in degrees using ATN
70 PRINT "Angle of slope: "; A; " degrees"
```

This code calculates the angle of a slope based on the rise and run.

### TAN in the Wild: The Rollercoaster Engineer

Imagine you're designing a thrilling rollercoaster. The `TAN`

command can help you calculate the steepness of the drops and curves, ensuring a safe yet exhilarating ride for your passengers!

Don't be afraid to embrace the thrill of trigonometry! With `TAN`

by your side, you can conquer angles and ratios, opening up a world of possibilities in mathematics, physics, and beyond. Just remember, `TAN`

can be a bit unpredictable when dealing with certain angles (like 90 degrees), so be sure to handle those special cases with care. Let `TAN`

be your guide to a world of exciting calculations and thrilling applications!

**Key Points to Remember:**

- In Commodore 64 BASIC, angles are measured in radians, not degrees. To convert degrees to radians, multiply by
`PI/180`

. - The
`TAN`

function can return very large or small values, even infinity for certain angles. - Use
`TAN`

responsibly and be prepared for potential`?DIVISION BY ZERO ERROR`

if you try to calculate the tangent of angles like 90 or 270 degrees.