Previous Up Next

2.20.2  Combine terms of 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:

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)

Previous Up Next