Recall the integration by parts formula:
∫ | u(x)v′(x)dx = u(x)v(x)− | ∫ | v(x)u′(x)dx. |
If you want to integrate a function f(x) by parts, you need to specify how to write f(x) as u(x)v′(x), which you can do by either specifying u(x) or v(x). The result will be in the form F(x) + ∫g(x)dx, where F(x)=u(x)v(x) and g(x)=−v(x)u′(x).
In some cases, to finish an integral you need to integrate by parts more than once. After one integrating by parts once and getting F(x) + ∫g(x)dx, you may have to integrate ∫g(x) dx by parts and add F(x) to the result.
Xcas has two commands for integrating by parts: ibpdv (where you specify v(x)) and ibpu (where you specify u(x)), both of which return the result as a list [F(x),g(x)]. Both of these commands allow you to keep track of the function F(x) you may need to add to the result of a subsequent integration by parts.
The ibpdv command is used to search the primitive of an expression written as u(x)v′(x) by specifying v(x).
Hence, ibpdv returns the terms computed in an integration by parts,
with the possibility of doing several ibpdvs successively.
When the answer of ibpdv(u(x)*v’(x),v(x)) is computed, to obtain a
primitive of u(x) v′(x), it remains to
compute the integral of the second term of this answer and then to sum this
integral with the first term of this answer: to do this, just use
ibpdv command with the answer as first argument and
a new v(x) (or 0 to terminate the integration) as second argument.
Example.
Input:
Output:
⎡ ⎣ | x lnx,−1 | ⎤ ⎦ |
then:
or:
Output:
−x+x lnx |
Remark.
When the first argument of ibpdv is a list of two elements,
ibpdv works only on the last element of this list and adds
the integrated term to the first element of this list. (therefore it
is possible to do several ibpdvs successively).
Example.
To evaluate ∫(ln(x))2dx:
Input:
Output:
⎡ ⎣ | x ln2x,−2 lnx | ⎤ ⎦ |
It remains to integrate -(2*ln(x)):
Input:
or:
Output:
⎡ ⎣ | x ln2x−2 x lnx,2 | ⎤ ⎦ |
And now it remains to integrate 2:
Input:
or:
Output:
x ln2x−2 x lnx+2 x |
The ibpu command is used to search the primitive of an expression written as u(x)v′(x) by specifying u(x).
Hence, ibpu returns the terms computed in an integration by parts,
with the possibility of doing several ibpus successively.
When the answer of ibpu(u(x)*v’(x),u(x)) is computed, to obtain a
primitive of u(x) v′(x), it remains to
compute the integral of the second term of this answer and then to sum this
integral with the first term of this answer: to do this, just use the
ibpu command with the answer as first argument and
a new u(x) (or 0 to terminate the integration) as second argument.
Example.
Input:
Output:
⎡ ⎣ | x lnx,−1 | ⎤ ⎦ |
then:
or:
Output:
−x+x lnx |
Remark.
When the first argument of ibpu is a list of two elements,
ibpu works only on the last element of this list and adds the
integrated term to the first element of this list. Therefore it is
possible to do several ibpus successively, similarly to how
you can do several ibpdvs successively.
Example.
To evaluate ∫(ln(x))2dx:
Input:
Output:
⎡ ⎣ | x ln2x,−2 lnx | ⎤ ⎦ |
It remains to integrate -(2*ln(x)):
Input:
or:
Output:
⎡ ⎣ | x ln2x−2 x lnx,2 | ⎤ ⎦ |
Finally, it remains to integrate 2: Input:
or:
Output:
x ln2x−2 x lnx+2 x |