# refine 函数

在某个假设下化简表达式。

## 怎么写

### refine(expr, p)

**expr**

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

**p**

假设的内容，如 x > 0。接受一个条件，真或假。

## 示例

- $\displaystyle \operatorname{refine}(\sqrt{x^{2}}, x > 0) = x$

  `refine(sqrt(x^2), x > 0)`

  在求解器中，`refine(sqrt(x^2), x > 0)` 的结果是 `x`。

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

## 示例中用到的函数

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

  平方根；sqrt(x) 即幂 x^(1/2)。

## 相关函数

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

  在局部假设下对一个主体求值。
- [assume](https://zh.hilberon.com/library/assume)

  添加关于变量的假设。

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