# 积分（Integral，integrate）

表达式的原函数，或它在某个区间上的定积分。

使用这个函数时，求解器只要找到步骤就会展示。

## 怎么写

### integrate(f, x)

不定积分：一个原函数。

**f**

要处理的表达式或函数。接受一个表达式。

**x**

积分变量。接受一个变量。

### integrate(f, x = a..b)

在区间上的定积分。

**f**

要处理的表达式或函数。接受一个表达式。

**x = a..b**

变量及其上下限；上下限可以是 inf。接受带范围的变量。

### integrate(f, x = a..b, y = a..b)

在两个区间上的累次积分。

**f**

要处理的表达式或函数。接受一个表达式。

**x = a..b**

第一个变量及其上下限。接受带范围的变量。

**y = a..b**

第二个变量及其上下限。接受带范围的变量。

## 示例

- $\displaystyle \int x^{2} \, dx = \frac{x^{3}}{3} + C$

  `integrate(x^2, x)`

  在求解器中，`integrate(x^2, x)` 的结果是 `x^3/3`。

  [在求解器中打开](https://zh.hilberon.com/?q=integrate%28x%5E2%2C%20x%29)
- $\displaystyle \int x \sin(x) \, dx = \sin(x)-x \cos(x) + C$

  `integrate(x*sin(x), x)`

  在求解器中，`integrate(x*sin(x), x)` 的结果是 `sin(x) - x*cos(x)`。

  [在求解器中打开](https://zh.hilberon.com/?q=integrate%28x*sin%28x%29%2C%20x%29)
- $\displaystyle \int_{0}^{1} x^{2} \, dx = \frac{1}{3}$

  `integrate(x^2, x = 0..1)`

  在求解器中，`integrate(x^2, x = 0..1)` 的结果是 `1/3`。

  [在求解器中打开](https://zh.hilberon.com/?q=integrate%28x%5E2%2C%20x%20%3D%200..1%29)
- $\displaystyle \int_{-\infty}^{\infty} e^{-x^{2}} \, dx = \sqrt{\pi}$

  `integrate(exp(-x^2), x = -inf..inf)`

  在求解器中，`integrate(exp(-x^2), x = -inf..inf)` 的结果是 `sqrt(pi)`。

  [在求解器中打开](https://zh.hilberon.com/?q=integrate%28exp%28-x%5E2%29%2C%20x%20%3D%20-inf..inf%29)
- $\displaystyle \int_{0}^{1} \int_{0}^{1} (x^{2}+y) \, dy \, dx = \frac{5}{6}$

  `integrate(x^2 + y, x = 0..1, y = 0..1)`

  在求解器中，`integrate(x^2 + y, x = 0..1, y = 0..1)` 的结果是 `5/6`。

  [在求解器中打开](https://zh.hilberon.com/?q=integrate%28x%5E2%20%2B%20y%2C%20x%20%3D%200..1%2C%20y%20%3D%200..1%29)

## 示例中用到的函数

- [sin](https://zh.hilberon.com/library/sin)

  角度的正弦，角度以弧度计。
- [exp](https://zh.hilberon.com/library/exp)

  指数函数；exp(x) 就是 e^x 这个幂。

## 相关函数

- [numeric_integrate](https://zh.hilberon.com/library/numeric_integrate)

  用数值方法近似计算定积分。
- [jacobian](https://zh.hilberon.com/library/jacobian)

  一列表达式的 Jacobi 矩阵：它们的偏导数。
- [hessian](https://zh.hilberon.com/library/hessian)

  表达式的 Hessian 矩阵：其二阶偏导数。
- [laplacian](https://zh.hilberon.com/library/laplacian)

  表达式的 Laplace 算子：它各二阶偏导数之和。
- [grad](https://zh.hilberon.com/library/grad)

  表达式的梯度：其偏导数组成的列表。
- [limit](https://zh.hilberon.com/library/limit)

  当变量趋近于某一点时表达式的极限。

---
Source: https://zh.hilberon.com/library/integrate
