# MySQL ATAN() function

## ATAN() function

MySQL ATAN() returns the arc tangent of a number. It's a mathematical function that finds the angle whose tangent is the specified number.

This function is useful in -

• It's used to find angles in right triangles and is widely applied in fields like physics, engineering, and astronomy.
• It complements the TAN() function, which finds the tangent of an angle.
• While TAN() takes an angle and returns its tangent, ATAN() takes a tangent value and returns the angle.
• In geometry and applications dealing with coordinates and vectors, ATAN() is used to calculate angles between vectors or lines.
• In control systems, ATAN() is used to design controllers for dynamic systems. It helps in tasks like stability analysis and controller tuning.
• In computer graphics and animation, ATAN() is used to determine the angles for smooth transitions between orientations of 2D and 3D objects.
• In computer graphics and animation, ATAN() is used to determine the angles for smooth transitions between orientations of 2D and 3D objects.

Syntax:

```ATAN(N);
```

Argument:

Name Description
N A number whose arc tangent value is to be retrieved.

Alternate Syntax:

```ATAN(N2,N1);
```

Argument:

Argument Description
N1 A number.
N2 A number.

Note: ATAN(N1,N2) is similar to calculating the arc tangent of N2 / N1,

Syntax Diagram:

MySQL Version: 8.0

Example:

Code:

``````SELECT ATAN(4);
```
```

Explanation:

The above MySQL statement will return the arc tangent value of the number specified as an argument.

Sample Output:

```mysql> SELECT ATAN(4);
+------------------+
| ATAN(4)          |
+------------------+
| 1.32581766366803 |
+------------------+
1 row in set (0.02 sec)
```

Example : ATAN() function using negative value

Code:

``````SELECT ATAN(-4);
```
```

Explanation:

This statement above will return the arc tangent value of the number defined as an argument.

Output:

```mysql> SELECT ATAN(-4);
+-------------------+
| ATAN(-4)          |
+-------------------+
| -1.32581766366803 |
+-------------------+
1 row in set (0.00 sec)
```

Example : ATAN() function using a division

Code:

``````SELECT ATAN(3,2);
```
```

Explanation:

This statement above will return the arc tangent value of the numbers (i.e. 3 and 2) defined as arguments. Since two arguments are passed, it is similar to calculate the arc tangent of 3 / 2.

Output:

```mysql> SELECT ATAN(3,2);
+-------------------+
| ATAN(3,2)         |
+-------------------+
| 0.982793723247329 |
+-------------------+
1 row in set (0.00 sec)
```

All Mathematical Functions

Previous: ATAN2()
Next: CEIL()

﻿