# Conditioning of evaluating tan()


```python
import numpy as np
import matplotlib.pyplot as pt
```

Let us estimate the sensitivity of evaluating the $\tan$ function:


```python
x = np.linspace(-5, 5, 1000)
pt.ylim([-10, 10])
pt.plot(x, np.tan(x))
```


```python
x = np.pi/2 - 0.0001
#x = 0.1
x
```


```python
np.tan(x)
```


```python
dx = 0.00005
np.tan(x+dx)
```

## Condition number estimates

### From evaluation data



```python

```

### Using the derivative estimate


```python
import sympy as sp

xsym = sp.Symbol("x")

f = sp.tan(xsym)
df = f.diff(xsym)
df
```

Evaluate the derivative estimate. Use `.subs(xsym, x)` to substitute in the value of `x`.


```python

```


```python

```

b22522da1a6e761f47883d4e0ea162e927a6af92
ipynb
Jupyter Notebook
cleared-demos/error_and_fp/Conditioning of Evaluating tan.ipynb
xywei/numerics-notes
70e67e17d855b7bb06a0de7e3570d40ad50f941b
Unlicense
2021-01-24T21:12:30.000Z
2022-03-02T19:58:25.000Z
cleared-demos/error_and_fp/Conditioning of Evaluating tan.ipynb
xywei/numerics-notes
70e67e17d855b7bb06a0de7e3570d40ad50f941b
Unlicense
2021-08-24T17:48:50.000Z
2021-10-14T21:22:02.000Z
cleared-demos/error_and_fp/Conditioning of Evaluating tan.ipynb
xywei/numerics-notes
70e67e17d855b7bb06a0de7e3570d40ad50f941b
Unlicense
2020-11-23T09:56:26.000Z
2021-12-24T17:30:26.000Z
Qwen/Qwen-72B
1. YES
2. YES