Previous Page Next Page Contents

rewrite -- rewrite an expression

Introduction

rewrite(f, target) transforms an expression f to a mathematically equivalent form, trying to express f in terms of the specified target function.

Call(s)

rewrite(f, target)

Parameters

f - an arithmetical expression
target - the target function to be used in the representation: one of cot, coth, diff, exp, fact, gamma, heaviside, ln, piecewise, sign, sincos, sinhcosh, tan, or tanh

Returns

an arithmetical expression.

Overloadable:

f

Further Documentation

Chapter ``Manipulating Expressions'' of the Tutorial.

Related Functions

collect, combine, expand, factor, normal, partfrac, rationalize, rectform, simplify

Details

Example 1

This examples demonstrates the use of rewrite:

>> rewrite(D(D(y))(x), diff)
                             diff(y(x), x, x)
>> rewrite(fact(n), gamma), rewrite(gamma(n), fact);
                         gamma(n + 1), fact(n - 1)
>> rewrite(sign(x), heaviside), rewrite(heaviside(x), sign);
                                         sign(x)
                     2 heaviside(x) - 1, ------- + 1/2
                                            2
>> rewrite(heaviside(x), piecewise)
         piecewise(1 if 0 < x, heaviside(0) if x = 0, -1 if x < 0)

Example 2

Trigonometric functions can be rewritten in terms of exp, sin, cos etc.:

>> rewrite(tan(x), exp), rewrite(cot(x), sincos),
   rewrite(sin(x), tan)
                                                  / x \
                             2               2 tan| - |
                   I exp(I x)  - I  cos(x)        \ 2 /
                 - ---------------, ------, -------------
                            2       sin(x)     / x \2
                    exp(I x)  + 1           tan| - |  + 1
                                               \ 2 /
>> rewrite(arcsinh(x), ln)
                                     2     1/2
                            ln(x + (x  + 1)   )

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000