Find the volume of the following "stadium". The inner wall is part of a sphere of radius 2 and the outer wall is a cylinder of radius 4.

 

$$ \int_{\pi/2}^{2\pi} \int_{\pi/4}^{\pi/2} \int_2^{4/\sin\phi} \rho^2 \sin\phi \,d\rho\,d\phi\,d\theta $$


```python
from sympy import *
```


```python
rh,ph,th = var("rho phi theta")
```


```python
vol = integrate(rh**2*sin(ph),(rh,2,4/sin(ph)),(ph,pi/4,pi/2),(th,pi/2,2*pi))
simplify(vol)
```




$\displaystyle 2 \pi \left(16 - \sqrt{2}\right)$




```python
vol.evalf()
```




$\displaystyle 91.6451990385567$




```python
import numpy as np
from scipy.integrate import tplquad
```


```python
tplquad(lambda r,p,t: r**2*np.sin(p),np.pi/2,2*np.pi,np.pi/4,np.pi/2,2,lambda t,p: 4/np.sin(p))
```




    (91.64519903855667, 1.0174661006896088e-12)



4112db9978eb05594220d579d9e467c0020c2f05
ipynb
Jupyter Notebook
extras/stadium-solution.ipynb
drewyoungren/mvc
f5217ae7888050d722c66de95756586f662841d2
MIT
extras/stadium-solution.ipynb
drewyoungren/mvc
f5217ae7888050d722c66de95756586f662841d2
MIT
extras/stadium-solution.ipynb
drewyoungren/mvc
f5217ae7888050d722c66de95756586f662841d2
MIT
Qwen/Qwen-72B
1. YES
2. YES