Antiderivative and definite integral : integrate int Int

### 2.18.1 Antiderivative and definite integral : `integrate int Int`

`integrate` (or `int`) compute the primitive or a definite integral. A difference between the two commands is that, if you input `quest()`, just after the evaluation of `integrate`, the answer is written with the ∫ symbol.

`integrate` (or `int` or `Int`) takes one, two or four arguments.

- with one or two arguments
  an expression or an expression and the name of a variable (by default `x`),
  `integrate` (or `int`) returns a primitive of the expression with respect to the variable given as second argument.
  Input :
  `integrate(x```^```2)`
  Output :
  `x```^```3/3`
  Input :
  `integrate(t```^```2,t)`
  Output :
  `t```^```3/3`
- with four arguments :
  an expression, a name of a variable and the bounds of the definite integral,
  `integrate` (or `int`) returns the exact value of the definite integral if the computation was successfull or an unevaluated integral otherwise.
  Input :
  `integrate(x```^```2,x,1,2)`
  Output :
  `7/3`
  Input :
  `integrate(1/(sin(x)+2),x,0,2*pi)`
  Output after simplification (with the `simplify` command) :
  `2*pi*sqrt(3)/3`

`Int` is the inert form of `integrate`, it prevents evaluation for example to avoid a symbolic computation that might not be successfull if you just want a numeric evaluation.
Input :

`evalf(Int(exp(x```^```2),x,0,1))`

Or :

`evalf(int(exp(x```^```2),x,0,1))`

Output :

`1.46265174591`

Exercise 1
Let

f(x)= |
x
x2−1
| +ln( |
x+1
x−1
| )

Find a primitive of f.
Input :

`int(x/(x```^```2-1)+ln((x+1)/(x-1)))`

Output :

`x*log((x+1)/(x-1))+log(x```^```2-1)+1/2*log(2*x```^```2/2-1)`

Or define the function `f`, input :

`f(x):=x/(x```^```2-1)+ln((x+1)/(x-1))`

then input :

`int(f(x))`

Output of course the same result.
Warning
For `Xcas`, `log` is the natural logarithm (like `ln`), as `log10` is 10-basis logarithm

Exercise 2
Compute :

∫ |
2
x6+2 · x4+x2
| dx

Input :

`int(2/(x```^```6+2*x```^```4+x```^```2))`

Output :

`2*((3*x```^```2+2)/(-(2*(x```^```3+x)))+-3/2*atan(x))`

Exercise 3
Compute :

∫ |
1
sin(x)+sin(2 · x )
| dx

Input :

`integrate(1/(sin(x)+sin(2*x )))`

Output :

`(1/-3*log((tan(x/2))```^```2-3)+1/12*log((tan(x/2))```^```2))*2`