All published worksheets from http://sagenb.org
Image: ubuntu2004
Integration Techniques
This worksheet shows how to use Sage to compute definite and indefinite integrals (i.e., with or without bounds). In addition, at the bottom there is code for helping you compute area under curves, using either vertical or horizontal slices.
Using the Integrate command
We need to use the integrate command for all the problems in this unit. The three examples below illustrate
- How to compute an indefinite integral .
- How to compute a definite integral .
- How to compute an improper integral where the function may have an asymptote at or , or one of the bounds in infinity. Note that if the integral does not converge, Sage will tell you it is divergent.
To find the area between two curves, you first have to find where the curves intersect. Then you can setup multiple integrals to compute the area as needed. To use the code below:
- Enter you two functions (I called them blue and red)
- Determine where they intersect.
- Change the bounds on the plot to include all the intersection points.
- Integrate between consecutive intersection points, making sure you integrate (top-bottom), which is simply red - blue or blue -red.
If you are given the functions in terns of , and need to solve, just repeat the above by switching the and values. The code below repeats the code above, just in terms of . Now when you setup your integral, make sure you integrate left to right.
Absolute values can be difficult to work with in Sage, unless you use a numerical integration technique. For this reason, I would avoid right now trying to set up code to automatically compute the area between any two curves without any user input.