# refine function

Simplify an expression using an assumption.

## How to write it

### refine(expr, p)

**expr**

Any expression: a number, a formula, a list or a matrix. Takes an expression.

**p**

What to assume, such as x > 0. Takes a condition, true or false.

## Examples

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

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

  In the solver, `refine(sqrt(x^2), x > 0)` gives `x`.

  [Open in the solver](https://hilberon.com/?q=refine%28sqrt%28x%5E2%29%2C%20x%20%3E%200%29)

## Functions its examples use

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

  Square root; sqrt(x) is the power x^(1/2).

## Related functions

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

  Evaluate a body under local assumptions.
- [assume](https://hilberon.com/library/assume)

  Add an assumption about the variables.

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