COMPLEX ANALYSIS -- BASIC MAPLE COMMANDS
Dr. John C. Nardo, Associate Professor
Mathematics & Computer Science
Maple capitalizes the imaginary unit i from Complex Analysis. You will be tempted to use lower-case i; fight this impulse.
Also remember in Maple there is no "implied multiplication." So, if you want to multiply, you must use an asterix.
You "name" objects in Maple using colon and the equal sign.
Maple performs all of our usual arithmetic operations on complex numbers.
Notice that Maple will try to return a complex number in standard a + bi form. If it does not, then you can force this to happen using the evalc command (evaluate complex expression).
Maple can also calculate a complex number's conjugate using the naturally named conjugate command. Again use the evaluate complex expression evalc command to force standard a + bi form when you get unexpected results.
Maple again uses the naturally named commands Re and Im to find the real and imaginary parts, respectively, of a complex number.
Maple calculates the modulus (via the abs command) and Argument of a complex number (via the argument command).
Note that Maple is not being exactly precise with its command names! We know there is a difference between Arg(z) and arg(z). The first is the name for a unique angle in the half-open interval (-Pi, Pi]. The second is the name for the infinity family of all possible angles. Since it is returning the one unique angle, Maple should capitalize its argument command, but unfortunately, it does not. Be mindful of this subtle programming oversight.
For special angles, Maple will try to return an exact angle. For other angles, it will simply return the inverse tangent definition (with a + or - to adjust for reference angles). You can then use the evalf command to force a floating point/decimal number of radians, if needed. Notice the percent sign % can be used to refer to the last calculation that Maple performed.
Using Maple to calculate the modulus and argument of a complex number, you can "manually" find the polar form of a complex number. Maple also has a command to streamline the exhausting task of typing two commands to get an "answer." You can use the convert command.
Maple can easily calculate values of the exponential function for both real and complex numbers using the exp command. You may need the evalc and evalf commands to force Maple to give the output you desire.
Recall how you make functions in Maple via the following syntax:
name of function : = variable(s) -> rule; .
We can use this functional structure in Maple to "automate" the complicated root finding process from class.
Suppose we wish to find the nth root of a complex number. First, we put the complex number in polar form by finding its modulus and Argument. Next, we realize that we have n distinct roots; this reinforces that the index of the root is n. We developed in class the aforementioned formula with inputs r, theta, n, and k.
At this point, the inputs r, theta, and index are truly known; they aren't really variables in the formula any more. The only true variable is k which counts out the various roots: k = 0, 1, 2, ... n - 1. This gives the function below in Maple.
We can take this out for a "test drive" by calculating the four fourth roots of unity, i.e. the four fourth roots of the complex number 1 + 0i.
We easily calculate the polar form in our heads: 1 is on the positive real axis. The distance to the origin is 1; so, the modulus is 1. The angle made between the positive real axis and the ray through the particular complex number is zero radians since they are the same ray. We are told to calculate the fourth root; so, the index is 4. Thus, we conclude: r = 1, theta = 0, and index = 4. This leaves the true variable k, and we count out the four distinct roots with k = 0, 1, 2, 3.
We get the expected results.
The function I have given assumes you know the modulus and Argument of the complex number, i.e. have already put it in polar form. Given what you have already learned in this handout/sheet, you know that Maple can calulate these values easily. So, you could modify this function to calculate these two values on the fly. Then the new/modified complexroots function would only need the a and b (from the a + bi standard form), the index of the root, and the parameter k. You should try it out! Make this new complexroots function with inputs a, b, index, and k!