# 展开表达式（Expand an expression，expand）

把乘积和乘方展开成和式。

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

## 怎么写

### expand(expr)

**expr**

任意表达式：一个数、一个公式、一个列表或一个矩阵。接受一个表达式。

## 示例

- $\displaystyle (x+1)^{3} = x^{3}+3 x^{2}+3 x+1$

  `expand((x + 1)^3)`

  在求解器中，`expand((x + 1)^3)` 的结果是 `x^3 + 3x^2 + 3x + 1`。

  [在求解器中打开](https://zh.hilberon.com/?q=expand%28%28x%20%2B%201%29%5E3%29)
- $\displaystyle (x-1) (x+2) = x^{2}+x-2$

  `expand((x - 1)(x + 2))`

  在求解器中，`expand((x - 1)(x + 2))` 的结果是 `x^2 + x - 2`。

  [在求解器中打开](https://zh.hilberon.com/?q=expand%28%28x%20-%201%29%28x%20%2B%202%29%29)

## 相关函数

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

  把带平移自变量的特殊函数改写为更简单的函数。
- [complex_expand](https://zh.hilberon.com/library/complex_expand)

  在假定变量为实数的前提下展开表达式。
- [power_expand](https://zh.hilberon.com/library/power_expand)

  展开乘积与幂的幂和对数。
- [factor](https://zh.hilberon.com/library/factor)

  把多项式分解为不可约因式。
- [discriminant](https://zh.hilberon.com/library/discriminant)

  多项式关于某个变量的判别式。
- [full_simplify](https://zh.hilberon.com/library/full_simplify)

  在给定假设下，比 simplify 更努力地寻找更简单的形式。

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