Basic Functions


Computing logarithms with Maple is quick and powerful. The basic syntax is:

ln(x) - natural logarithm

log(x) - natural logarithm

log[b](x) - logarithm with base b

log10(x) - logarithm with base10

Here $x$ denotes any matheatical expression. Note that the two common notations, ln and log, both refer to the natural logarithm

> ln(2);


What you might want Maple to do is compute the number. To do this would be to give an approximation to the exact number. Maple's default output is the exact result or there is none, no result. Maple will not give approximate numbers unless requested to do so. Several commands are available for this: The most useful is the evalf() command. The syntax is

evalf(expr) - evaluate the expression

evalf(expr, n) - evaluate the expression using n digits accuracy

evalf[n](expr) - evaluate the expression using n digits accuracy

Here expr means some mathematical expression and n is the number of digits for the computation. For example

> evalf(ln(2));


> evalf(ln(2),35);


Alternatively, we could write




The % refers to the results of the last computation. The evalf(%); command is very useful. It evaluates to floating-point or complex floating-point numbers, expressions (or subexpressions) involving constants such as Pi, exp(1), gamma, and functions such as exp, ln, sin, arctan, cosh, GAMMA, and erf.

Does Maple know the rules of logarithms?

Suppose we input MATH Do we obtain what we know is true: MATH Similarly, does MATHyield $b\ln a~?$ The answer is NO! Typically we get

> ln(a*b);


Even using the expand command doesn't help. The reason for this is that Maple does not know that both numbers are positive. However, if we could tell Maple to assume that the variables are positive, then it uses the rules. Note the following commands.

> assume(a>0); assume(b>0);


ln(a~) + ln(b~)

The expression "a~" indicates that an assumption has been made on the variable. We still use the expand command, for otherwise there is no reason for Maple to expand the expression. However, sometimes Maple will expand the expression without prompting.

However, ... Here is a numerical example, where no assumptions are needed.

> ln(sqrt(2)*sqrt(3));expand(%);

ln(sqrt(2) sqrt(3))

1/2 ln(2) + 1/2 ln(3)

Exercise: If the last statement read ln(sqrt(2)*sqrt(3));expand(%);evalf(%) what would have happened? What was the effective value of expand(%); in the final result of this command sequence.


The exponential function in Maple is given by


where $expr$ denotes any mathematical expression. This is typical, and expected when you are fully aware of the exactness-paradigm of Maple.

> exp(1);


To get the decimal approximation of this number we can use any of the commands: evalf(exp(1)); evalf(exp(1),23); we can even use the following exp(1.0);

> exp(1.0);


When you write 1.0 for the number one, Maple assumes that you are dealing in decimal approximations and it is most happy to "go along" and give you decimals right back.

Does Maple know the rules of exponentials?

As you might expect, Maple does know them, if the conditions are correct. And conditions are always right here.

For example Maple gives the following:

> expand(exp(c+d));expand(exp(c-d));


exp($c$)- exp($d$)

> exp(ln(c));


The latter is true no matter what $c$ is, of course.


What happens if we try to compute MATH

Trigonometric functions

The basic trig functions are

sin $\left( x\right) $

cos $\left( x\right) $

tan $\left( x\right) $

ctn $\left( x\right) $

sec $\left( x\right) $

csc $\left( x\right) $

where $x$ is any mathematical expression in the units of radians. Examples:

> sin(1.2);


> cos(Pi);


Here we use a special symbol, Pi, which represents the exact $\pi .$ As you might expect, Maple knows all the expansion formulae for the trig functions. Example,

> expand(tan(c+d));


Remember, Maple will not expand expressions unless instructed to do so.

Inverse Trig functions

The inverse trigonometric functions use notation consistent with mathematics generally. For example,

> arctan(1);

$\dfrac{1}{4}\pi $

The definition of the functions is to place an "arc" infront of the corresponding trigonometric function. We have

arcsin $\left( x\right) $

arccos $\left( x\right) $

arctan $\left( x\right) $

arcctn $\left( x\right) $

arcsec $\left( x\right) $

arccsc $\left( x\right) $

where $x$ is any mathematical expression in the units of radians. Pay attention to the domain, Maple does. A special example:

> arccos(2);


> evalf(%);

1.316957897 I

As you know "I" means the complex number $\sqrt{-1}.$ Here you will note that while $2$ is not in the domain of the inverse cosine function as we teach it with domain on the real line (in fact with domain MATH), it is fully defined in the complex plane. Students will report such things, and they will want to know why their answer is marked wrong. Little things like this must be thoroughly understood to avoid a number of pitfalls in using Maple, and by the way also with Mathematica and Scientific Notebook.

This document created by Scientific Notebook 4.0.