Previous Page Next Page Contents

numeric::complexRound -- round a complex number towards the real or imaginary axis

Introduction

numeric::complexRound(z, ..) discards small real or imaginary parts of complex floating point numbers z.

Call(s)

numeric::complexRound(z <, eps>)

Parameters

z - an arbitrary MuPAD object

Options

eps - a real number >= 10^(-DIGITS).

Returns

If z is a complex floating point number, then a real or complex floating point number is returned. For all other types z is returned unchanged.

Side Effects

The function is sensitive to the environment variable DIGITS.

Related Functions

ceil, floor, frac, round, trunc

Details

Option: eps

Example 1

Exact numbers are not changed:

>> numeric::complexRound(2 + I/10^20)
                       2 + 1/100000000000000000000 I

Also the following number has an exact imaginary part and is not rounded:

>> numeric::complexRound(2.0 + sqrt(2)*I/10^20)
                                              1/2
                   1/100000000000000000000 I 2    + 2.0

Rounding occurs for complex floats, if this does not change its value significantly:

>> numeric::complexRound(1.0 + 2.0*I/10^10),
   numeric::complexRound(1.0 + 2.0*I/10^11)
                         1.0 + 0.0000000002 I, 1.0

Note that rounding is based on relative precision, i.e., only the ratio of real and imaginary parts is relevant:

>> numeric::complexRound((1.0 + 2.0*I)/10^100)
                          10.0e-101 + 2.0e-100 I
>> numeric::complexRound((1.0 + 1.0/10^11*I)/10^100)
                                 10.0e-101

The relative precision for rounding may be reduced by the optional parameter eps:

>> numeric::complexRound(2.0/10^10 + I),
   numeric::complexRound(2.0/10^10 + I, PI/10^5)
                        0.0000000002 + 1.0 I, 1.0 I

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000