now it takes a little while to get used to this kind, kind of syntax, but not

that much. and I think again most people will find

it easy to look at the code and do simple things with it.

and so that's fine, so we can write programs that compute with complex

numbers. I just want to mention there's a design

choice here, and that is that we treat complex numbers as mutable.

that is, every complex number that we wind up computing with is different.

in computers nowadays that just seems to be a reasonable the way to go.

It's the same approach that with programming languages like Java use for

strings. and what's the point of all this is not

just to write code. what's the interesting and why, and why I

want to do it is that it's also pretty easy to plot complex functions.

Then, we're going to do a particular kind of plot where we do an image.

And all an image is, is a square array of pixels like everything you see on the

screen is an image. And we're just going to take a 512x512

square of pixels. Now, we're going to give, that's points

in the plane. Then, we're going to give, for a quart,

for a particular complex function, we're going to give every pixel a grayscale

value according to the magnitude of the value of the function.

If the function has got a high value, it's going to be black.

If it's got a low value, it's going to be white.

And the gray says how big it is. So that's what this [COUGH] code in here

is doing. so it's going to give an x and y which

are scaled the x-y coordinates in the image.

It's going to create a new complex number.

And then it's going to evaluate a function, a given function at that

complex number, compute the absolute value, and actually, we multiply by ten

to really emphasize the growth. That's an arbitrary factor.

and then we're going to convert that to a number between 0 and 255 to get the

grayscale, and then we'll set the color of the pixel.

And we'll do that for every one of the 200 and 512x512 pixels or whatever size

that we set it to. but that's the key, every point has a

color, which is black if the function is high and white, if it's low.

And this is it's a really simple code any program would have no trouble trouble

with this. and if you're not a programmer go to our

book sites for introductory courses and you can work with this code and it's,

it's not difficult. so, then what we can do is so this an

example where we implement 1 over 1 plus z cubed.

and all we have to do is call this function.

a new version of that function 1 over 1 plus z cubed and we get a plot like this.

this is for 1 over 1 plus z cubed. now our convention is we'll always draw a

2.5x2.5 square. so that's minus 1 over there.

and this is square over 3 over 2 and so forth.

So, the darkness of the pixel is proportional to absolute value of 1 over

1 minus 1 plus z cubed. So, most of the time it's pretty small.

It, unless you get close to a [COUGH] something who's cube is minus 1 like

minus 1 or these are whats called the roots of unity.

and that's a wonderful part of the lore of complex numbers that I haven't talked

about much, you know, just for the purpose of

[UNKNOWN].

But those are the numbers that if you cube them, you get a minus 1.

So that's what that plot looks like anyway.

so very easy to get a visual representation of a complex function.

And what we're really interested in is that this visual representation shows us

the singularities that is the points where it blows up and you can't represent

it with the power series. The points where it's not analytical the,

where the function goes to infinity. so there's all kinds of functions these

are just some examples. So, this is what 1 plus z plus z to the

5th looks like. and this is a little bit bigger square.

If we're not going to be showing the 2.5x2.5 square we'll show that one in the

white, because sometimes interesting things happen outside of that square.

Now, in a surprising amount of time, interesting stuff happens right within

that square. this is what e to the z plus z squared

over 2 looks like. So when z gets positive it starts to get

big. When z gets negative at a certain point,

it starts to get big, otherwise, it's small, that's kind of what these things

are saying. but those values are those functions are

analytic everywhere that they're going to infinity, but at a reasonable rate.

so, let's look at the rational functions we've looked at.

So, 1 over 1 minus z has a pole at 1. 1 over 1 plus z squared has poles at plus

and minus i. 1 over 1 minus z to the 5th, those are

the 5th roots of unity. this is what the generating function for

the number of binary strings with no occurrences of four zeros in a row, looks

like. it's got four poles, they're kind of

spread out like that. and so, we, we get a feeling for, at

least, how big the function is from these kinds of plots.

and then, this is that, that other one for set partitions.

And we'll, we'll look at the properties of these later on.

So, the ideas that we can with these plots, we can characterize the functions.

And we'll, we'll be doing that for a purpose later on.

but now, let's talk about complex integration.

and this is another very fascinating part of complex analysis.

and it's a simple idea. You just want to define a line in the

plane and you want to integrate along that line.

and so like a straight line it's pretty easy.

You just change variables to convert to real integrals, like if you're, integrate

along that line at x equals 2 and then you can pull the 2 out and just do y as

it changes, change to x plus iy. And another i comes out.

so the 2 comes out with, with an i because of, we're changing along the

y-axis. and then y squared over 2 from 3 to minus

the 1, because we're going down. so that's a complex number that's the

value of that integral. so that's a, a natural starting point.

now there's, but we can add to that an integral that goes in a different

direction and make a close contour. we can do around a circle.

we have a lot of variability in terms of trying to define an integral.

and some amazing facts is that if you have an analytic function in a region and

you have any path of integration that's a loop the integral is going to be 0.

and not only that relevant for analytic combinatorics, you can get the

coefficients of a complex function by complex integration.

So, that's what we're going to look at next.

this is due to Cauchy. and it, you know, these facts are, are

again, part of the foundation of a deep and beautiful theory that we're going to

take advantage of. so for analytic combinatorics what we're

going to use this for is to get exponential growth for this bigger set of

generating functions then, then a rational called meromorphic.

but let's look in more detail at some examples of integration.

So, let's say, we want to integrate f of z equals z on a rectangle.

So, we'll just integrate along the four lines just as I did before.

so if you're inte, integrating on x then you can just leave the y part alone and

just integrate. In this case, it's minus 6 plus 3i.

this next one is the one I did before, which is 2i plus 4.

this next one goes the other way. it it happens to be at i, so it's 6 minus

i. and this, this other one goes up the

other way. It turns out to be 4i minus 4.

So, if we want the integral all the way around that rectangle, we just to add

those four things up together. and so just add those, these four.

And what's amazing is that we get 0. we had lots of different values, they

just you can check my arithmetic, they all add up to 0.

here's another example. we're going to integrate f of z equals z

on a circle centered at 0. So now, we're going to hold the radius

fixed, and we're going to change theta. So, we write our complex numbers in a

polar coordinate, z equals re to the i theta, so then dz equals ir e to i theta

d theta. we plug that in, then we have zdz so we

have ir squared. We get e to the 2i theta e theta.