# Trig: Trigonometric Functions In dual: Automatic Differentiation with Dual Numbers

## Description

These functions give the obvious trigonometric functions. They respectively compute the cosine, sine, tangent, arc-cosine, arc-sine, arc-tangent, and the two-argument arc-tangent.

`cospi(x)`, `sinpi(x)`, and `tanpi(x)`, compute `cos(pi*x)`, `sin(pi*x)`, and `tan(pi*x)`.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35``` ```## S4 method for signature 'dual' cos(x) ## S4 method for signature 'dual' sin(x) ## S4 method for signature 'dual' tan(x) ## S4 method for signature 'dual' acos(x) ## S4 method for signature 'dual' asin(x) ## S4 method for signature 'dual' atan(x) ## S4 method for signature 'dual,numeric' atan2(y, x) ## S4 method for signature 'numeric,dual' atan2(y, x) ## S4 method for signature 'dual,dual' atan2(y, x) ## S4 method for signature 'dual' cospi(x) ## S4 method for signature 'dual' sinpi(x) ## S4 method for signature 'dual' tanpi(x) ```

## Arguments

 `x` dual object or numeric value. `y` dual object or numeric value.

## Value

A dual object containing the transformed values according to the chosen function.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```x <- dual(1, 1:0) y <- dual(1, 0:1) cos(x) sin(x) tan(x) acos(x - 0.5) asin(x - 0.5) atan(x - 0.5) atan2(x, y) atan2(2.4, y) atan2(x, 1.2) cospi(1.2 * x) sinpi(3.4 * x) tanpi(5.6 * x) ```

### Example output

```sh: 1: cannot create /dev/null: Permission denied
Real: 0.540302
Duals: -0.841471 0.000000
Real: 0.841471
Duals: 0.540302 0.000000
Real: 1.557408
Duals: 3.425519 0.000000
Real: 1.047198
Duals: -1.154701 -0.000000
Real: 0.523599
Duals: 1.154701 0.000000
Real: 0.463648
Duals: 0.800000 0.000000
Real: 0.785398
Duals: 0.500000 -0.500000
Real: 1.176005
Duals: -0.000000 -0.355030
Real: 0.694738
Duals: 0.491803 0.000000
Real: -0.809017
Duals: 2.215898 0.000000
Real: -0.951057
Duals: -3.300739 -0.000000
Real: -3.077684
Duals: 184.235438 0.000000
```

dual documentation built on Dec. 18, 2019, 5:08 p.m.