Combine terms of same algebraic structure
This functionality does not run in MATLAB.
f, <IgnoreAnalyticConstraints>) combine(
target, <IgnoreAnalyticConstraints>) combine(
[target1, target2, …], <IgnoreAnalyticConstraints>)
combine(f) rewrites products of powers in
f as a single power.
combine(f, target) combines several calls
to the target function(s) in the expression
a single call.
combine(f) applies these rewriting rules
to products of powers occurring as subexpressions in an arithmetical expression
The last two rules are only valid under certain additional restrictions,
such as when b is
an integer. Except for the third rule, this behavior of
the inverse functionality of
See Example 1.
In certain cases, the MuPAD® internal simplifier automatically
applies these rules in the reverse direction, and
combine(f, target) applies rewriting rules
applicable to the target function(s) to an arithmetical expression
Some of the rules are only valid under certain additional restrictions.
For most of the rules,
combine implements the inverse
This list shows the rewriting rules for the targets.
target = arctan:
y, such that |x y|
target = exp (see Example 4):
where valid, reacting to properties.
target = int (see Example 5):
target = gamma (see Example 6):
for positive integers
target = ln (see Example 7):
The rules do not hold for arbitrary complex values of
Specify appropriate properties for
enable these rewriting rules. These rules are only applied to natural logarithms.
target = sincos (see Example 3):
where similar rules apply to sin(x) cos(y) and cos(x) cos(y):
target = sinhcosh:
where similar rules apply to sinh(x) cosh(y) and cosh(x) cosh(y).
These rules apply recursively to powers of sinh and cosh with positive integral exponents.
combine works recursively on the subexpressions
If the second argument is a list of targets, then
f subsequently for each of the targets
in the list. See Example 10.
f is an array,
a list, or a set,
applied to all entries of
f. See Example 11. If
a polynomial or
a series expansion, of type
applied to each coefficient. See Example 12.
combine reacts to properties of identifiers
appearing in the input.
Combine powers of the same base using
combine(sin(x) + x*y*x^(exp(1)))
combine also combines powers with the same
exponent in certain cases:
In most cases, however,
combine does not
combine powers with the same exponent:
Rewrite products of sines and cosines as a sum of sines and
cosines by setting the second argument to
combine(sin(a)*cos(b) + sin(b)^2, sincos)
Rewrite sums of sines and cosines by setting the second argument
combine(cos(a) + sin(a), sincos)
Powers of sines or cosines with negative integer exponents are not rewritten:
Combine terms with the exponential function by specifying the
second argument as
Rewrite integrals by setting the second argument to
combine combines a constant term with the
combine combines integrals with the same
Combine calls to
gamma by specifying the
simplifies quotients of gammas to rational expressions.
combine(gamma(n+3)*gamma(n+4/3) / gamma(n+1) / gamma(n+10/3), gamma)
This example shows the application of rules for the logarithm, and their dependence on properties of the identifiers appearing in the input. In the complex plane, the logarithm of a product does not always equal the sum of the logarithms of its factors. For real positive numbers, however, this rule can apply.
Try to combine terms with calls to
specifying the target as
combine(ln(a) + ln(b), ln)
combine does not combine the terms. Set the
appropriate assumptions to combine the terms.
assume(a > 0): assume(b > 0): combine(ln(a) + ln(b), ln)
If a and b are
integer or rational numbers and b is
If b is
greater than or equal to
You can change the limit on the number b by
For example, when you use the default value
N = 1000,
the following result for this logarithm:
If you set the value of
this logarithm in its original form:
Pref::autoExpansionLimit(10): combine(12*ln(12), ln)
For further computations, restore the default value of
IgnoreAnalyticConstraints option applies
a set of purely algebraic simplifications including the equality of
sum of logarithms and a logarithm of a product. Using the
you get a simpler result, but one that might be incorrect for some
of the values of
Combine logarithms using the
combine(ln(a^5) - ln(a^4), ln, IgnoreAnalyticConstraints)
Without using this option, you get a mathematically correct, but long result:
combine(ln(a^5) - ln(a^4), ln)
The second argument also can be a list of targets. Then the rewriting rules for each of the targets in the list are applied.
in the expression.
combine(ln(2) + ln(3) + sin(a)*cos(a), [ln, sincos])
combine maps to sets:
combine maps to the coefficients of polynomials:
combine(poly(sin(x)*cos(x)*y, [y]), sincos)
However, it does not touch the polynomial's indeterminates:
One of the identifiers:
Apply purely algebraic simplifications to an expression. For
more information see the options for the
Object of the same type as the input object
Advanced users can extend the functionality of
implementing additional rewriting rules for other target functions.
To extend functionality, define a new slot
To define a new slot, you need to first unprotect the identifier
combine using unprotect. Afterwards, the command
target) leads to the call
the corresponding slot routine.
combine handles a subexpression
calling itself recursively for the operands
etc. Users can change this behavior for their own mathematical function
given by a function environment
combine slot of
To handle the subexpression
calls the slot routine
g::combine with the argument