Next Previous Contents

5. Exponential and Logarithmic Commands

5.1 The exp command

This command returns e raised to its argument.

Examples:

> 1 exp
[ 1]          2.71828182845905
> 3.7 exp
[ 2]          2.71828182845905
[ 1]          40.4473043600674
> pi (0, 1) * exp
[ 3]          2.71828182845905
[ 2]          40.4473043600674
[ 1] (-1,1.22460635382238e-16)

5.2 The ln command

This command returns the natural logarithm (base e) of its argument.

Examples:

> 4
[ 1]                         4
> ln
[ 1]          1.38629436111989
> (3 2)
[ 2]          1.38629436111989
[ 1]                     (3,2)
> ln
[ 2]          1.38629436111989
[ 1] (1.28247467873077,
     0.588002603547568)

5.3 The ^ command

This command raises y (level two) to x (level one).

Examples:

> 2 10 ^
[ 1]                      1024
> 3.75 2.48 ^
[ 2]                      1024
[ 1]           26.521467069654
> (2 3) (1 -1)
[ 4]                      1024
[ 3]           26.521467069654
[ 2]                     (2,3)
[ 1]                    (1,-1)
> ^
[ 3]                      1024
[ 2]           26.521467069654
[ 1] (9.20434248861135,
     -2.84401950837022)

5.4 The xroot command

This command returns the nth (level one) root of x (level two).

Examples:

> 2472806570256 4 xroot
[ 1]                      1254

5.5 The sq command

This command squares its argument.

Examples:

> 16 sq
[ 1]                       256
> (2 1)
[ 2]                       256
[ 1]                     (2,1)
> sq
[ 2]                       256
[ 1]                     (3,4)

5.6 The sqrt command

This command returns the square root of its argument.

Examples:

> 32041 sqrt
[ 1]                       179
> (14229, -37620) sqrt
[ 2]                       179
[ 1]                (165,-114)
> -100 sqrt
[ 3]                       179
[ 2]                (165,-114)
[ 1] (6.12303176911189e-16,10)

5.7 The expm1 command

This command returns exp(x) - 1. It is more accurate than exp when x is close to zero.

Examples:

> 3.5 expm1
[ 1]          32.1154519586923
> -4.2 expm1
[ 2]          32.1154519586923
[ 1]        -0.985004423179522

5.8 The lnp1 command

This command returns ln(1 + x). It is more accurate than ln when x is close to zero.

Examples:

> 45 lnp1
[ 1]           3.8286413964891
> 72.5 lnp1
[ 2]           3.8286413964891
[ 1]          4.29728540621879

5.9 The log command

This command returns the decimal (base 10) logarithm of its argument.

Examples:

> 1e20 log
[ 1]                        20
> 1724.3123 log
[ 2]                        20
[ 1]          3.23661592615434

5.10 The alog command

This command raises 10 to its argument.

Examples:

> 21 alog
[ 1]                     1e+21
> 7.1524
[ 2]                     1e+21
[ 1]                    7.1524
> alog
[ 2]                     1e+21
[ 1]          14203651.2404801


Next Previous Contents