The Assume Command And Integrals


To evaluate some integrals, sage will require additional information. If we try to evaluate the integral

\begin{align} \int_{1}^{x}\frac{t^3 - 30}{t}dt \end{align}

as we normally would, sage throws a large error due to 0 potentially being in the domain, where the function being integrated has an asymptote due to dividing by 0.
To avoid this, we will use sage's assume command to tell sage to assume x > 1.

Sage Cell

Note that the assume command is rarely needed; if it is, you'll see an error such as

ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(x-1>0)', see `assume?` for more details)
Is x-1 positive, negative or zero?

when attempting to evaluate an integral needing an assumption without setting one.


t = var('t')
assume(x > 1)
integrate((t^3 - 30)/t, t, 1, x)


Primary Tags:

Secondary Tags:

A list of possible tags can be found at The WeBWorK Open Problem Library. For linear algebra tags see the Curated Courses Project.


Any related cells go here. Provide a link to the page containing the information about the cell.

Related Cells


Author: Gregory V. Bard. Sage for Undergraduates. American Mathematical Society, Providence, RI, 2015. Available at


Date: 27 Feb 2019 00:34

Submitted by: Zane Corbiere

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License