Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

with_assumptions function

Evaluate a body under local assumptions.

How to write it

with_assumptions(condition, body)

condition
A condition that is true or false, such as x > 0. Takes a condition, true or false.
body
The expression to evaluate. Takes an expression.

Examples

  • with_assumptions⁡(x>0,simplify⁡(x2))=x\displaystyle \operatorname{with\_assumptions}(x > 0, \operatorname{simplify}(\sqrt{x^{2}})) = x
    with_assumptions(x > 0, simplify(sqrt(x^2)))

    In the solver, with_assumptions(x > 0, simplify(sqrt(x^2))) gives x.

    Open in the solver

Functions its examples use

  • simplify

    Simplify an expression, optionally under assumptions.

  • sqrt

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

  • assume

    Add an assumption about the variables.

  • refine

    Simplify an expression using an assumption.