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 denotes any matheatical expression. Note that the two common notations, ln and log, both refer to the natural logarithm
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
Alternatively, we could write
The % refers to the results of the last computation. The
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.
Suppose we input Do we obtain what we know is true: Similarly, does yield The answer is NO! Typically we get
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.
1/2 ln(2) + 1/2
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 denotes any mathematical expression. This is typical, and expected when you are fully aware of the exactness-paradigm of Maple.
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);
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.
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:
The latter is true no matter what is, of course.
What happens if we try to compute
The basic trig functions are
where is any mathematical expression in the units of radians. Examples:
Here we use a special symbol, Pi, which represents the exact As you might expect, Maple knows all the expansion formulae for the trig functions. Example,
Remember, Maple will not expand expressions unless instructed to do so.
The inverse trigonometric functions use notation consistent with mathematics generally. For example,
The definition of the functions is to place an "arc" infront of the corresponding trigonometric function. We have
where is any mathematical expression in the units of radians. Pay attention to the domain, Maple does. A special example:
As you know "I" means the complex number Here you will note that while is not in the domain of the inverse cosine function as we teach it with domain on the real line (in fact with domain ), 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.