```python
import sympy as sm
```


```python
# nonlinear limb-darkening coefficients
c1, c2, c3, c4, r, z, p = sm.symbols(['c1', 'c2', 'c3', 'c4', 'r', 'z', 'p'], real=True, positive=True)
```


```python
# intensity function 
mu = sm.sqrt(1 - r**2)
Ir = 1 - c1 * (1 - mu ** sm.Rational(1/2)) - c2 * (1 - mu) - c3 * (1 - mu ** sm.Rational(3/2)) - c4 * (1 - mu ** 2)
```


```python
# integral when the planet is entirely occulting the star
inside = sm.integrate(Ir * 2 * r, (r, z-p, z+p))
```


```python
# simplify and make some substitutions
result = sm.simplify(sm.collect(sm.collect(sm.simplify(sm.expand(inside)), -p**2 - 2 * p * z - z**2 + 1),-p**2 + 2 * p * z - z**2 + 1))
alpha, beta = sm.symbols(['alpha', 'beta'], real=True)
result = result.subs(-p**2 - 2 * p * z - z**2 + 1, alpha).subs(-p**2 + 2 * p * z - z**2 + 1, beta)
result
```




$\displaystyle - \frac{4 \alpha^{\frac{7}{4}} c_{3}}{7} - \frac{4 \alpha^{\frac{5}{4}} c_{1}}{5} - \frac{2 \alpha^{\frac{3}{2}} c_{2}}{3} + \frac{4 \beta^{\frac{7}{4}} c_{3}}{7} + \frac{4 \beta^{\frac{5}{4}} c_{1}}{5} + \frac{2 \beta^{\frac{3}{2}} c_{2}}{3} - 4 c_{1} p z - 4 c_{2} p z - 4 c_{3} p z - 4 c_{4} p^{3} z - 4 c_{4} p z^{3} + 4 p z$




```python
# integral when the planet is only partially occulting the star
edge = sm.integrate(Ir * 2 * r, (r, z-p, 1))
```


```python
# simplify
result = sm.simplify(sm.collect(sm.collect(sm.simplify(sm.expand(edge)), -p**2 - 2 * p * z - z**2 + 1),-p**2 + 2 * p * z - z**2 + 1))
result = result.subs(-p**2 - 2 * p * z - z**2 + 1, alpha).subs(-p**2 + 2 * p * z - z**2 + 1, beta)
```


```python
result
```




$\displaystyle \frac{4 \beta^{\frac{7}{4}} c_{3}}{7} + \frac{4 \beta^{\frac{5}{4}} c_{1}}{5} + \frac{2 \beta^{\frac{3}{2}} c_{2}}{3} + \beta + c_{1} p^{2} - 2 c_{1} p z + c_{1} z^{2} - c_{1} + c_{2} p^{2} - 2 c_{2} p z + c_{2} z^{2} - c_{2} + c_{3} p^{2} - 2 c_{3} p z + c_{3} z^{2} - c_{3} + \frac{c_{4} p^{4}}{2} - 2 c_{4} p^{3} z + 3 c_{4} p^{2} z^{2} - 2 c_{4} p z^{3} + \frac{c_{4} z^{4}}{2} - \frac{c_{4}}{2}$




```python

```

a6a7c270165dc17708ffeddd5e24e7e481a5d2fb
ipynb
Jupyter Notebook
dynamoon/analytic_integrals.ipynb
tagordon/dynamoon
b3ef4d13f2d8771c4d1440d96a38cb240a25811a
MIT
2021-11-25T21:39:22.000Z
2021-11-25T21:39:22.000Z
dynamoon/analytic_integrals.ipynb
tagordon/dynamoon
b3ef4d13f2d8771c4d1440d96a38cb240a25811a
MIT
dynamoon/analytic_integrals.ipynb
tagordon/dynamoon
b3ef4d13f2d8771c4d1440d96a38cb240a25811a
MIT
Qwen/Qwen-72B
1. YES
2. YES