Domain Coloring of Complex Functions

Domain Coloring of Complex Functions

Domain Coloring of Complex Functions Konstantin Poelke and Konrad Polthier 1 Introduction 2 What is a Function? Let us briefly recap the definition of a Visualizing functions is an omnipresent function to fix terminology. A function f task in many sciences and almost every day consists of three parts: first, a set D of in- we are confronted with diagrams in news- put values, which is called the domain of the papers and magazines showing functions of function, second, a set Y called the range of all possible flavours. Usually such func- f and third, for every input value x ∈ D, tions are visualized by plotting their func- a unique value y ∈ Y , called the function tion graph inside an appropriate coordinate value of f at x, denoted f(x). The set Γ(f) system, with the probably most prominent of all pairs (a, f(a)), a ∈ D, is a subset of choice being the cartesian coordinate sys- the product set D × Y and called the func- tem. This allows us to get an overall im- tion graph of f. pression of the function’s behaviour as well One particular type of functions that are as to detect certain distinctive features such widely used in engineering and physics are as minimal or maximal points or points complex functions, i.e. functions f : D ⊆ where the direction of curvature changes. C → Y ⊆ C whose domain and range In particular, we can “see” the dependence are subsets of the complex numbers, and between input and output. However, this we will focus on complex functions in the technique is limited to three dimensions, following. We will identify C with the Eu- 2 simply because we do not know how to clidean plane R by the bijective assignment draw higher-dimensional cartesian coordi- x + yi 7→ (x,y), justifying the term complex nate systems. plane. Note that the function graph Γ(f) of a complex function lives inside the product space C × C ∼= R4. This article gives a short overview about the method of domain coloring for com- 3 Domain Coloring plex functions, which have four-dimensional In contrast to function graph plotting in- function graphs and therefore cannot be vi- side Euclidean two or three space, the tech- sualized traditionally. We discuss several nique of domain coloring does not need ad- color schemes focussing on various aspects ditional spatial dimensions for the range of complex functions, and provide Java-like but rather uses color dimensions to encode pseudocode examples explaining the cru- the function values. More precisely, given a cial ideas of the coloring algorithms to al- complex function f : D → Y , one defines low for easy reproduction. For a thorough a color scheme as a function col : Y → treatment of domain colorings from a more HSB, which assigns to every value y ∈ Y mathematical point of view see [1]. a color col(y), specified in HSB color space 1 for instance. In practice D is usually a rect- reducing the problem to the flat case in R2. 2 angular region of R . Then an initially cho- 4 Color Schemes sen resolution divides D into a discretized 4.1 Color Wheels domain Dh of pixels corresponding to small Every non-zero point z =(u,v) in the Eu- rectangles of fixed width and height. Ev- clidean plane has a unique representation in ery pixel i is identified with a point zi in D terms of polar coordinates as z = r·exp(iϕ), where the function is evaluated, for example if one requires the angle ϕ to lie in the in- the midpoint or a corner. Then one evalu- tervall [−π,π). ϕ is called the argument ates the pull-back function f ∗col := col◦f of z, denoted arg z, and r is the modu- at every point zi ∈ D and assigns the re- ∗ lus or absolute value |z|. The advantage sulting color value f col(zi) to the pixel i, of this representation is that the argument leading to a coloring of the whole domain can be directly identified with a hue value, Dh. This procedure is shown in Figure 1, which is usually given as an absolute an- Listing 1 gives an easy implementation. gle value between 0 and 360 or as a rela- z1 f col tive value between 0 and 1. We will make steady use of the function HSBColor(float hue, z3 float sat, float bri) which constructs an inte- z2 ger color representation from the specified Dh Y hue, saturation and brightness values, each Figure 1: Every pixel i in the discretized domain of them lying in the interval [0, 1]. Such Dh corresponds to a value zi ∈ D and is colored functions are usually contained in the stan- ∗col with the color f (zi). dard libraries of modern programming lan- Listing 1: Plotting procedure. The domain D is a guages, e.g. java.awt.Color.HSBtoRGB in Java or rectangular region specified by its lower left and up- colorsys.hsv_to_rgb in Python. per right corner, whose (x,y)-coordinates are given This leads to a first color scheme as shown in the array double[] dom of size 4. The resolution in Figure 2, using the argument arg z as its parameters determine the number of pixels of the only parameter. Listing 2 gives its imple- resulting image. mentation. Image plot(double[] dom, Fun f, Fun col, int xRes, int yRes){ // create new image object of size xRes*yRes Image im = new Image(xRes,yRes); // Increments in width and height direction double xInc = (dom[2]-dom[0])/xRes; double yInc = (dom[3]-dom[1])/yRes; for(y=0; y<yRes; y++){ for(x=0; x<xRes; x++){ // midpoint where f is evaluated z = (dom[0]+(x+0.5)*xInc, dom[1]+(y+0.5)*yInc); // assign computed color to pixel im.setColor(x,y,col(f(z))); }} return im; Figure 2: Hue-based color wheel and resulting do- } main coloring for z 7→ z2. The function duplicates We just mention for completeness that the argument of every point in the plane. As a re- this idea can easily be transferred to sur- sult the upper half plane is mapped to the whole faces D embedded in R3 by using local co- plane, as every color already appears on the upper half. ordinate charts and texture mappings and 2 Listing 2: A hue based color wheel using the argu- ment arg z as its only input parameter. int col(Point z){ //arg only defined for non-zero value if (z==0) return black; // h between 0 and 1 h = (arg(z)+π)/2π; return HSBColor(h, 1,1); } In case the argument is undefined, i.e. if z = 0, the function returns black. We will Figure 3: The discrete color wheel divides the plane neglect this form of easy exception handling into its quadrants. The image on the right shows a plot of the Joukowski function (z+1/z)/2. Inside a as well as the conversion of arg z into the circle of radius 1 the plane appears mirrored along relative parameter h ∈ [0, 1] in the follow- the horizontal real axis. ing. Instead of using the hue value as a contin- scheme to functions of a type particularly uous parameter, a discretized version of the important in algebra and complex geome- color wheel divides the plane into n equally- try. sized cells, where in each cell the color is constant. A natural choice is n = 4, divid- ing the Euclidean plane into its four quad- rants. This makes it easy to detect which points are mapped into which quadrant, see Figure 3 and Listing 3. Listing 3: A discretized color wheel implementation dividing the plane into four quadrants. int col(Point z){ // array holding colors for cells Figure 4: A simple gradient color scheme. The Color[] colors = {blue,red,yellow,green}; left picture shows the function f(z) = z5 − 1, // compute cell index whose zeros are exactly the fifth roots of unity. int i = floor(h*4) % 4; return colors[i]; The five endpoints are the zeros whereas the other } endpoints all meet at infinity, where f has a pole of order five. The horse-shoe-shaped image Alternatively one can use the argument on the right displays the meromorphic function 2 2 as a parameter for interpolating between fm(z)=(z − 1)(z + 1) /((z + i)(z − i) ). The two two or more colors leading to color gradi- endpoints are of order one and correspond to the ents wrapped around the origin. A sim- terms (z − 1) and (z + i). The two points where ple gradient color scheme between white black and white interchange are of order two, de- and black, discontinuous along the nega- termined by the remaining terms. tive real axis, is then given by a function Although the preceding color schemes blend(black,white, h) which accepts two colors only used the argument of a point and uses the relative hue value h as a weight z = r exp(iϕ), they already gave fairly good for a linear interpolation between the col- representations for complex functions. By ors’ RGB values such that blend(black,white,0) taking the modulus into account we can en- returns black and blend(black,white,1) returns rich these color schemes with several addi- white. Figure 4 shows an application of this tional features. As an example, Listing 4 3 marks zeros and poles as black and white this phenomenom, it is helpful to imple- spots to make it easy to detect these distin- ment grid-like color schemes such as rect- guished points of a complex function, im- angular grids or polar grids.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us