Others view: welcome ♦ Welcome ♦ Morse code ♦ Depth first search ♦ 2D Fast Fourier Transform ♦ Dijkstra algorithm ♦

**Complex integral** (also *line integral, path integral, contour integral* or *curve integral*) evaluates the function to be integrated along the curve. The result is the sum of all values at all points on the curve, weighted by the function on the curve. It is not the same as calculating the arc length with the help of the ordinary integral. Such integrals can also be computed by summing the values of the complex residues inside the contour^{[1]}.

This article contains interactive demonstration and some thoughts of the complex integral (currently does not provide full overview of complex integration).

The applet integrates the function *f(z)* along your curve. For instance, if *f(z) = z* and you drag the mouse from *1* to *2i* on the left side, the pointer on the right side will be at the value of the integral of *z* from *1* to *2i*. The value of the integral starts at 0.

The applet code^{[2]} using rectangle rule, sufficient for demonstration purposes. It maintains a complex number *w* that is the current value of the integral. In the beginning of the integration (mouse down) *w* is set to zero.

Each time the mouse has been dragged, the applet integrates the following way:

- Converts the mouse coordinates in pixels into complex value, scaling and shifting as required. X coordinate is converted into real part and Y coordinate into imaginary part.
- Computes the change of the mouse position from the previous location, as a complex number (
*dz*). The "previous location" is the location of the previous mouse drag or (at the beginning) click. - Computes the function value for the current mouse location (
*fz*). - Multiplies
*dz*by*fz*and adds the current integral value,*w*, to the result. Multiplication and addition is done following the rules of complex arithmetic. - Plots
*w*.

The code also contains some extras to draw explanatory markings.

When you draw (integrate f on) a closed loop, under frequent conditions the integral curve may also make a closed loop and land to the origin where the integration started. However this depends on what f is, and what the loop is:

- If f has an anti-derivative on the loop, then the integral is guaranteed to be 0 by the fundamental theorem of calculus.
- If f is analytic on the loop
*and inside the loop*, then Cauchy's theorem guarantees that the integral is 0.

In all other cases the integral is unlikely to be zero (the curve may but most likely will not return to the origin).

- The function
*f(z) = 1/z*is not analytic at the origin. As a result, the closed loop leads to the zero integral as long as this loop does not contain the origin. However circling around the origin will not lead to the zero integral. - The function
*f(z) = zbar*does not satisfy the conditions either, so its integral is almost never zero.

*f(z) = 1*is a simple case that, if integrating from*a*to*b*, should return*b-a*. Closed loop anywhere in the plane causes integral function to return back to the origin after your loop closes.*f(z) = z*is the case when the effect of extending the curve by*dz*depends on the current location*z*. Nevertheless, the integral of a closed loop remains zero.*f(z) = 1+i*is a case when the integral changes in the different direction than the original function. However this function satisfies the zero integral requirements and the integral curve returns to the origin after the function completes a closed loop.