# The $\eta$ function


```python
import numpy as np
import matplotlib.pyplot as pl
%matplotlib notebook
from IPython.display import display, Math
import sympy
from sympy import *

# Initialize the session
init_session(quiet=True)

# Let's report what version of sympy this is
print("Using sympy version", sympy.__version__)
```

    
    Using sympy version 1.3



```python
eta, r, b, k0, k1, A, k2 = symbols("\eta r b kappa_0 kappa_1 A, k^2")
```


```python
k2 = (1 - r ** 2 - b ** 2 + 2 * b * r) / (4 * b * r)
A = Rational(1, 2) * sqrt((1 + (r + b)) * (b - (1 - r)) * (b + (1 - r)) * (1 + (r - b)))
k0 = atan2(2 * A, (r - 1) * (r + 1) + b ** 2)
k1 = atan2(2 * A, (1 - r) * (1 + r) + b ** 2)
```

The $\eta$ function in the paper is identical to $\eta_1$ (for $k^2 \le 1$) and $\eta_2$ (for $k^2 > 1$) in Equation (7) of Mandel & Agol (2002). Below we compute its derivatives with respect to $b$ and $r$.

## $k^2 \le$ 1


```python
eta = 1 / (2 * pi) * (k1 + r ** 2 * (r ** 2 + 2 * b ** 2) * k0 - Rational(1, 2) * (1 + 5 * r ** 2 + b ** 2) * A)
```

This is the derivative according to the paper:


```python
detadr_paper = (2 * r / pi) * ((r ** 2 + b ** 2) * k0 - 2 * A)
```

Is it correct?


```python
simplify(diff(eta, r) - detadr_paper) == 0
```




    True



**QED**

This is the derivative according to the paper:


```python
detadb_paper = (1 / (2 * pi * b)) * (4 * r ** 2 * b ** 2 * k0 - 2 * (1 + b ** 2 + r ** 2) * A)
```

Is it correct?


```python
simplify(diff(eta, b) - detadb_paper) == 0
```




    True



**QED**

## $k^2$ > 1


```python
eta = r ** 2 / 2 * (r ** 2 + 2 * b ** 2)
```


```python
simplify(diff(eta, r))
```

**QED**


```python
simplify(diff(eta, b))
```

**QED**

ddab79a32aad35c3f069ee19f2a6a96171ba8344
ipynb
Jupyter Notebook
proofs/Eta.ipynb
langfzac/Limbdark.jl
a6a30c52e14686a9a01d7b4437f4f171c9c53a24
MIT
2019-05-08T09:03:56.000Z
2021-02-14T20:53:23.000Z
proofs/Eta.ipynb
langfzac/Limbdark.jl
a6a30c52e14686a9a01d7b4437f4f171c9c53a24
MIT
2018-04-23T20:41:25.000Z
2019-05-02T01:50:19.000Z
proofs/Eta.ipynb
langfzac/Limbdark.jl
a6a30c52e14686a9a01d7b4437f4f171c9c53a24
MIT
2019-05-15T08:06:04.000Z
2020-02-24T19:11:47.000Z
Qwen/Qwen-72B
1. YES
2. YES