### 5.20.2 Combine terms of the same type : combine

combine takes two arguments : an expression and the name of a function or class of functions exp,log,ln, sin,cos,trig.
Whenever possible, combine put together subexpressions corresponding to the second argument:

- combine(expr,ln) or combine(expr,log) gives the same result as lncollect(expr)
- combine(expr,trig) or combine(expr,sin) or combine(expr,cos) gives the same result as tcollect(expr).

Input :

combine(exp(x)*exp(y)+sin(x)*cos(x)+ln(x)+ln(y),exp)

Output :

exp(x+y)+sin(x)*cos(x)+ln(x)+ln(y)

Input :

combine(exp(x)*exp(y)+sin(x)*cos(x)+ln(x)+ln(y),trig)

or

combine(exp(x)*exp(y)+sin(x)*cos(x)+ln(x)+ln(y),sin)

or

combine(exp(x)*exp(y)+sin(x)*cos(x)+ln(x)+ln(y),cos)

Output :

exp(y)*exp(x)+(sin(2*x))/2+ln(x)+ln(y)

Input :

combine(exp(x)*exp(y)+sin(x)*cos(x)+ln(x)+ln(y),ln)

or

combine(exp(x)*exp(y)+sin(x)*cos(x)+ln(x)+ln(y),log)

Output :

exp(x)*exp(y)+sin(x)*cos(x)+ln(x*y)