# 4.8 重积分

## 4.8.1 重积分的计算

在Integrate()函数中嵌套多层Integrate()函数可以对重积分进行计算。

例：计算积分$$\int\_{0}^{2} dx \int\_{x}^{2} e^{-y^2} dy$$的值。

```python
[]:integrate(integrate(exp(-y\*\*2), (y, x, 2)), (x, 0, 2)).simplify()
```

\[]:![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-0129ef8233b4a66d29dfac0f6dd9707c4e8029a9%2Fa72a0415c477146d1e4571d484d5c41f.png?alt=media)

例：计算三重积分$$\iiint \limits\_{\Omega} z dxdydz$$其中为平面与三个坐标面，，围成的闭区域。（）

```python
[]:plot3d(1 - x - y, (x, 0, 1), (y, 0, 1), aspect_ratio=(1, 1, 1))
```

![C:\Users\Johan\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\E18883DA.tmp](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-58b36b107a97e444332bdfa3262b466badacfdc5%2Fde1daf9cac3636ef5f72539cfc6ff85c.png?alt=media)

```python
[]:<sympy.plotting.plot.Plot at 0x12701ba8\>

[]:integrate(integrate(integrate(z, (z, 0, 1-x-y)), (y, 0, 1-x)), (x, 0, 1))
```

![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-77ee981c95f131aa3e3b74f9c7c2b9e57f74a540%2Ff465a7e3a9ea5cbbd168b2b71e124b0e.png?alt=media)\[]:

## 4.8.2 重积分的应用

### 求曲面间围成的面积

例：求曲面$$z=x^2+y^2$$和$$z=2-x^2-y^2$$围成的体积

首先使用plot3d绘制出曲面图形:

```python
[]:plot3d((x\*\*2+y\*\*2), (2-x\*\*2-y\*\*2))
```

![C:\Users\Johan\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\8B72AC8.tmp](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-3ffb1a68be3606e3194f03404da3a90ee5f6c2aa%2Fadc35c7f3c9466552aeed4bc3b4f9e36.png?alt=media)

```python
[]:\<sympy.plotting.plot.Plot at 0x141fc6d8\>

[]:integrate(integrate(integrate(1,(z, r\*\*2, 2-r\*\*2)), (r, 0, 1)), (theta,
0, 2\*pi))
```

\[]:![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-ae0f35686a9209a9aa5de65a3af45063fe127b18%2F6a7fd950ff83c3ad5ef520c561e8065b.png?alt=media)

例：计算曲面$$z=x^2+2y^2$$和$$z=6-2x^2-y^2$$ 所围成体积

```python
[]:plot3d(x\*\*2+2\*y\*\*2,3-2\*\*2-y\*\*2)
```

由图像可知，所求体积$$V=\int \limits\_D (3-2x^2-y^2-(x^2+2y^2) d\sigma$$，其中积分区域$$D={(x, y)|x^2+y^2<2}$$。使用极坐标计算此积分，$$V=\int\_{0}^{2\pi}d\theta \int\_{0}^{\sqrt{2}} (6r - 3r3) dr$$

```python
integrate(integrate(integrate(6\*r-r\*r\*\*3, (r, 0, sqrt(2)), (theta, 0,
2\*pi))
```

例：求$$\iint \limits\_{D} \left ( x^2+y \right ) dxdy$$, 其中$$D$$是由抛物线$$y=x^2$$和$$x=y^2$$所围平面闭区域。

```python
[]:integrate(integrate(x\*\*2+y, (y, x\*\*2, sqrt(x))), (x,0,1))
```

\[]:![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-f2e7e61cec4ebbb3d24e93bdb185262401e8ffa0%2F946ba3024d82c4d181c853198b09d42c.png?alt=media)

### 曲线积分

例：设L为$$\begin{cases} x & = e^t + 1\ y & = e^t - 1 \end{cases}$$ 从t=0到$$\log 2$$的一段弧，求曲线面积$$\int \limits\_L xdx + ydy$$

```python
[]:from sympy import Curve, line_integrate, E, ln

from sympy.abc import x, y, t

*[]:C = Curve([E\*\*t + 1, E\*\*t - 1], (t, 0, ln(2)))*

*line_integrate(x + y, C, [x, y])*
```

\[]: ![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-02d81461a9c9d772f6658d649b146df28b67f8db%2F8a773398109992002c18b98933f65972.png?alt=media)

### 曲面积分

例：计算$$\iint \limits\_{\Sigma} x^2dydz + y^2 dzdx + zdxdy$$，其中$$\Sigma$$是旋转抛物面$$z=1-x^2-y^2(z\ge 0$$的上侧。

接下来，我们二重积分化为三重积分。首先需要补面：$$\Sigma': x^2+y^2\le1, z=0$$,与$$\Sigma$$围成封闭区域$$\Sigma$$。然后，使用Gauss公式进行计算。原积分 $$=\iint\_{\sigma'+\sigma} - \iint^{'}*{\Sigma}= \iiint*{\Omega} - \iint^{'}\_{\Sigma'}$$,

其中,$$\int\_{\Omega} \left ( \frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y} + \frac{\partial R}{\partial z} \right ) dxdydz =\iiint\_{\Omega} \left ( 2x+2y+1 \right ) dxdydz$$, $$\iint^{'}\_{\Sigma} x^2dydz + y^2 dzdx + zdxdy = 0$$ 化三重积分为三次积分：

$$
\iiint\_{\Omega} \left ( 2x+2y+1 \right ) dxdydz = \int\_{0}^{2\pi} \int\_{0}^{1} r dr \int\_{0}^{1-r^2} (2r \cos \theta + 2r \sin \theta + 1) dz
$$

在Jupyter Lab中对该积分进行计算：

```python
*[]:integrate(integrate(integrate((2\*r\*cos(theta)+2\*r\*sin(theta)+1)\*r*

*, (z3,0, 1-r\*\*2)), (r, 0, 1)), (theta, 0, 2\*pi))*

```

\[]: ![](https://3607972777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mjx-9CYfSlrNPw45CMh%2Fuploads%2Fgit-blob-d8460ad111d2ebf2ad9c9c42d80f502601aa6c0f%2Fc7130ba351a79f9287ab1e013ced87c5.png?alt=media)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://johannesliu.gitbook.io/learning-advanced-mathematics-with-python/4.0-calculus/4.8-multiple_integral.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
