# Programs

## Mathematics Programs

### Complex Zeroes

#### Summary

Programs:

ZQUADPLT

Version:

3.0, 5 May 2002

Description:

This program creates a chart of the quadrants of the complex plane of a complex function value of a single complex variable.

Compatibility:

 CFX-9850G Compatible with CFX-9850G FX-7400G Compatible with FX-7400G

Other programs
required:

VRPRE

#### Detailed Description

A well-known result of complex function analysis is that a closed path about a zero of an analytic function generates function values that trace a closed path around zero. Indeed, the number of times the path goes around zero is the order of the zero of the function. This means that a chart constructed by projecting the function value into a four-valued space, where each value indicates the quadrant of the complex plane in which the function value lies, has all four quadrants meeting at a single point for a simple zero; all four quadrants meeting twice at a single point for a double zero; and so forth. The program ZQUADPLT charts the quadrants of a complex function result on the complex plane of the argument. Zeroes of the complex function are shown where the four quadrants meet.

For example, the chart to the right of this paragraph shows the chart of quadrants of the function (z-(2+i))×(z-(-3-2i))2. The single zero at 2+i is clear from the four quadrants meeting there; the double zero at -3-2i is similarly clear from the eight quadrants meeting there. Quadrant I is shown in white; quadrant II is shown in blue; quadrant III is shown in orange; and quadrant IV is shown in green. The drawn axes are not overwritten by the quadrant indicator, as otherwise there would be no indication as to where the zeroes are. However, when the axes fall into a quadrant IV area, the axes are redrawn in orange so they can be seen.

The portion of the complex plane taken as arguments to the function is determined by the graphing view window. The X range (Xmin through Xmax) is taken to be the range of real values of the complex argument. The Y range (Ymin through Ymax) is taken to be the range of imaginary values of the complex argument.

In order to use ZQUADPLT, the user must supply an implementation of the function whose values are to be charted. This implementation must be placed in program F0, accept its argument in variable A, and return its result in variable B.

#### Usage

Load the programs ZQUADPLT and VRPRE. Program the function to be charted in program F0. Set the graphics view window to be the region of the complex plane of interest. Run the program ZQUADPLT.

The full chart takes roughly an hour to produce.

#### Program Source

The programs are available as a text file with .CAT contents, or may be entered as shown below. A semicolon (“;”) marks the beginning of a comment, which is not to be entered into the calculator. Remember that these programs are copyrighted; see the copyright issues page for limitations on redistribution.

Program ZQUADPLT (217 bytes):

```; Program ZQUADPLT
;
; Description:
;   Evaluates a complex-valued function of a single complex variable
;   on a rectangular region of the complex plane. Graphs the quadrant
;   into which the result falls using the color display.
;
; Variables:
;   A,B: communication with subprograms
;   C-E: unused
;   F: Index of imaginary-axis position on grid of values
;   G: Index of real-axis position on grid of values
;
; Calling sequence:
;   None; main program.
;
; Implicit inputs:
;   The graphing viewport: used to discover real and imaginary axis
;     limits
;
; Implicit outputs:
;   List 6: the variable save stack.
;   Z: the stack pointer for the variable save stack.
;
; Side effects:
;   None.
;
; Symbols used:
;   -> is assignment arrow
;   / is division operator
;   {i} is imaginary component operator

Prog "VRPRE"       ; Set up variable save stack
Cls                ; Clear graphics
AxesOn             ; Ensure the axes are on
For 1->F To 63     ; Loop through Y values
For 1->G To 127    ;   Loop through X values
Xmin+(G-1)(Xmax-Xmin)/126+(Ymax+(F-1)(Ymin-Ymax)/62){i}->A
;     Compute complex argument value into A
Prog "F0"          ;     Compute complex function value into B
If ReP B<0         ;     Test if quadrants II, III
Then PxlTest F,G   ;       Test state of pixel (part of axis?)
If Ans=0           ;       See if pixel is off
Then If ImP B<0    ;         If off, see if quadrant III
Then Orange PxlOn F,G ;        If quadrant III, use orange
Else PxlOn F,G     ;           Otherwise quadrant II, use blue
IfEnd              ;         [End of quadrant test]
IfEnd              ;       [End of pixel off test]
Else If ImP B<0    ;       Otherwise see if quadrant IV
Then PxlTest F,G   ;         Test state of pixel (part of axis?)
If Ans=0           ;         See if pixel is off
Then Green PxlOn F,G ;         If off, make green
Else Orange PxlOn F,G ;        If on, make orange instead
IfEnd              ;         [End of test if pixel is off]
IfEnd              ;       [End of test if quadrant IV]
IfEnd              ;     [End of test if quadrants II or III]
Next               ;   [End of loop through X values]
Next               ; [End of loop through Y values]
```

Sample program F0 (42 bytes):

```; Program F0
;
; Description:
;   ***SAMPLE***
;   Function encoding a complex-valued function of a single complex
;   variable for which a zero is to be found. The function is
;   (x-(-3-2i))^2 (x-(2+i))
;
; Variables:
;   A is the value at which the function is to be evaluated [input]
;   B is the function value [output]
;
; Calling sequence:
;   {x value}->A
;   Prog "F0"
;   B->{function value}
;
; Implicit inputs:
;   List 6: the variable save stack.
;   Z: the stack pointer for the variable save stack.
;   [These are available for functions that need them.]
;
; Implicit outputs:
;   List 6: the variable save stack.
;   Z: the stack pointer for the variable save stack.
;   [These are available for functions that need them.]
;
; Side effects:
;   None.
;
; Symbols used:
;   {i} is the imaginary portion operator
;   x^2 is the square operator
;   -> is assignment arrow

(A-(-3-2{i}))x^2(A-(2+{i}))->B
```

Copyright © 2001 Brian Hetrick
Page last updated 5 May 2002.

# Brian’s Casio Calculator Corner

Home

Programs

Index

Linkage Conventions

Mathematics

Index

Factorization

Bisection

Newton’s Method

Complex Zeroes

Best Fraction Approximation

Pseudorandom Numbers

Romberg Integration

First Degree ODE

Rounding

Permutations

Finance

Physics

Utility

Tutorial

Puzzles

Site Information