Previous Page Next Page Contents

combine -- combine terms of the same algebraic structure

Introduction

combine(f) tries to rewrite products of powers in the expression f as a single power.

combine(f, target) combines several calls to the target function(s) in the expression f to a single call.

Call(s)

combine(f)
combine(f, target)
combine(f, [target1, target2, ...])

Parameters

f - an arithmetical expression, an array, a list, a polynomial, or a set
target - one of the identifiers arctan, exp, ln, sincos, or sinhcosh

Returns

an object of the same type as the input object f.

Side Effects

combine reacts to properties of identifiers appearing in the input.

Overloadable:

f

Further Documentation

Chapter ``Manipulating Expressions'' of the Tutorial.

Related Functions

denom, expand, factor, normal, numer, radsimp, rectform, rewrite, simplify

Details

Example 1

Without a second argument, combine combines powers of the same base:

>> combine(sin(x) + x*y*x^(exp(1)))
                                      exp(1) + 1
                          sin(x) + y x

Moreover, combine also combines powers with the same exponent in certain cases:

>> combine(sqrt(2)*sqrt(3))
                                    1/2
                                   6

Example 2

In most cases, however, combine does not combine powers with the same exponent:

>> combine(y^5*x^5)
                                    5  5
                                   x  y

Example 3

With the second argument sincos, combine rewrites products of sines and cosines as a sum of sines and cosines with more complicated arguments:

>> combine(sin(a)*cos(b) + sin(b)^2, sincos)
                 sin(a + b)   cos(2 b)   sin(a - b)
                 ---------- - -------- + ---------- + 1/2
                     2           2           2

Note that powers of sines or cosines with negative integer exponents are not rewritten:

>> combine(sin(b)^(-2), sincos)
                                     1
                                  -------
                                        2
                                  sin(b)

Example 4

With the second argument exp, the well-known rules for the exponential function are applied:

>> combine(exp(3)*exp(2), exp)
                                  exp(5)
>> combine(exp(a)^2, exp)
                                 exp(2 a)

Example 5

This example shows the application of rules for the logarithm, and at the same time the dependence on properties of the identifiers appearing in the input. The logarithm of a product does not always equal the sum of the logarithms of its factors; but for positive numbers, this rule may be applied:

>> combine(ln(a)+ln(b), ln)
                               ln(a) + ln(b)
>> assume(a>0): assume(b>0): 
   combine(ln(a)+ln(b), ln)
                                  ln(a b)
>> unassume(a): unassume(b):

Example 6

The second argument may also be a list of targets. Then the rewriting rules for each of the targets in the list are applied:

>> combine(ln(2)+ln(3)+sin(a)*cos(a), [ln, sincos])
                                     sin(2 a)
                             ln(6) + --------
                                        2

Example 7

combine maps to sets:

>> combine({sqrt(2)*sqrt(5), sqrt(2)*sqrt(11)})
                                 1/2    1/2
                              {10   , 22   }

Example 8

combine maps to the coefficients of polynomials:

>> combine(poly(sin(x)*cos(x)*y, [y]), sincos)
                            / / sin(2 x) \        \
                        poly| | -------- | y, [y] |
                            \ \    2     /        /

However, it does not touch the polynomial's indeterminates:

>> combine(poly(sin(x)*cos(x)), sincos)
                   poly(sin(x) cos(x), [sin(x), cos(x)])

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000