text:
# Contour integration

In the mathematical field of complex analysis, contour integration is a method of evaluating certain integrals along paths in the complex plane.[1][2][3]

Contour integration is closely related to the calculus of residues,[4] a method of complex analysis.

One use for contour integrals is the evaluation of integrals along the real line that are not readily found by using only real variable methods.[5]

Contour integration methods include

One method can be used, or a combination of these methods, or various limiting processes, for the purpose of finding these integrals or sums.

## Curves in the complex plane

In complex analysis a contour is a type of curve in the complex plane. In contour integration, contours provide a precise definition of the curves on which an integral may be suitably defined. A curve in the complex plane is defined as a continuous function from a closed interval of the real line to the complex plane: z : [a, b] → C.

This definition of a curve coincides with the intuitive notion of a curve, but includes a parametrization by a continuous function from a closed interval. This more precise definition allows us to consider what properties a curve must have for it to be useful for integration. In the following subsections we narrow down the set of curves that we can integrate to include only those that can be built up out of a finite number of continuous curves that can be given a direction. Moreover, we will restrict the "pieces" from crossing over themselves, and we require that each piece have a finite (non-vanishing) continuous derivative. These requirements correspond to requiring that we consider only curves that can be traced, such as by a pen, in a sequence of even, steady strokes, which only stop to start a new piece of the curve, all without picking up the pen.[6]

### Directed smooth curves

Contours are often defined in terms of directed smooth curves.[6] These provide a precise definition of a "piece" of a smooth curve, of which a contour is made.

A smooth curve is a curve z : [a, b] → C with a non-vanishing, continuous derivative such that each point is traversed only once (z is one-to-one), with the possible exception of a curve such that the endpoints match (z(a) = z(b)). In the case where the endpoints match the curve is called closed, and the function is required to be one-to-one everywhere else and the derivative must be continuous at the identified point (z′(a) = z′(b)). A smooth curve that is not closed is often referred to as a smooth arc.[6]

The parametrization of a curve provides a natural ordering of points on the curve: z(x) comes before z(y) if x < y. This leads to the notion of a directed smooth curve. It is most useful to consider curves independent of the specific parametrization. This can be done by considering equivalence classes of smooth curves with the same direction. A directed smooth curve can then be defined as an ordered set of points in the complex plane that is the image of some smooth curve in their natural order (according to the parametrization). Note that not all orderings of the points are the natural ordering of a smooth curve. In fact, a given smooth curve has only two such orderings. Also, a single closed curve can have any point as its endpoint, while a smooth arc has only two choices for its endpoints.

### Contours

Contours are the class of curves on which we define contour integration. A contour is a directed curve which is made up of a finite sequence of directed smooth curves whose endpoints are matched to give a single direction. This requires that the sequence of curves γ1,…,γn be such that the terminal point of γi coincides with the initial point of γi+1, i, 1 ≤ i < n. This includes all directed smooth curves. Also, a single point in the complex plane is considered a contour. The symbol + is often used to denote the piecing of curves together to form a new curve. Thus we could write a contour Γ that is made up of n curves as

${\displaystyle \Gamma =\gamma _{1}+\gamma _{2}+\cdots +\gamma _{n}.}$

## Contour integrals

The contour integral of a complex function f : CC is a generalization of the integral for real-valued functions. For continuous functions in the complex plane, the contour integral can be defined in analogy to the line integral by first defining the integral along a directed smooth curve in terms of an integral over a real valued parameter. A more general definition can be given in terms of partitions of the contour in analogy with the partition of an interval and the Riemann integral. In both cases the integral over a contour is defined as the sum of the integrals over the directed smooth curves that make up the contour.

### For continuous functions

To define the contour integral in this way one must first consider the integral, over a real variable, of a complex-valued function. Let f : RC be a complex-valued function of a real variable, t. The real and imaginary parts of f are often denoted as u(t) and v(t), respectively, so that

${\displaystyle f(t)=u(t)+iv(t).}$

Then the integral of the complex-valued function f over the interval [a, b] is given by

{\displaystyle {\begin{aligned}\int _{a}^{b}f(t)\,dt&=\int _{a}^{b}{\big (}u(t)+iv(t){\big )}\,dt\\&=\int _{a}^{b}u(t)\,dt+i\int _{a}^{b}v(t)\,dt.\end{aligned}}}

Let f : CC be a continuous function on the directed smooth curve γ. Let z : RC be any parametrization of γ that is consistent with its order (direction). Then the integral along γ is denoted

${\displaystyle \int _{\gamma }f(z)\,dz\,}$

and is given by[6]

${\displaystyle \int _{\gamma }f(z)\,dz=\int _{a}^{b}f{\big (}\gamma (t){\big )}\gamma '(t)\,dt.}$

This definition is well defined. That is, the result is independent of the parametrization chosen.[6] In the case where the real integral on the right side does not exist the integral along γ is said not to exist.

### As a generalization of the Riemann integral

The generalization of the Riemann integral to functions of a complex variable is done in complete analogy to its definition for functions from the real numbers. The partition of a directed smooth curve γ is defined as a finite, ordered set of points on γ. The integral over the curve is the limit of finite sums of function values, taken at the points on the partition, in the limit that the maximum distance between any two successive points on the partition (in the two-dimensional complex plane), also known as the mesh, goes to zero.

## Direct methods

Direct methods involve the calculation of the integral by means of methods similar to those in calculating line integrals in several-variable calculus. This means that we use the following method:

• parametrizing the contour
The contour is parametrized by a differentiable complex-valued function of real variables, or the contour is broken up into pieces and parametrized separately.
• substitution of the parametrization into the integrand
Substituting the parametrization into the integrand transforms the integral into an integral of one real variable.
• direct evaluation
The integral is evaluated in a method akin to a real-variable integral.

### Example

A fundamental result in complex analysis is that the contour integral of 1/z is i, where the path of the contour is taken to be the unit circle traversed counterclockwise (or any positively oriented Jordan curve about 0). In the case of the unit circle there is a direct method to evaluate the integral

${\displaystyle \oint _{C}{\frac {1}{z}}\,dz.}$

In evaluating this integral, use the unit circle |z| = 1 as a contour, parametrized by z(t) = eit, with t ∈ [0, 2π], then dz/dt = ieit and

${\displaystyle \oint _{C}{\frac {1}{z}}\,dz=\int _{0}^{2\pi }{\frac {1}{e^{it}}}ie^{it}\,dt=i\int _{0}^{2\pi }1\,dt={\Big [}\;t\;{\Big ]}_{0}^{2\pi }i=(2\pi -0)i=2\pi i.}$

which is the value of the integral.

## Applications of integral theorems

Applications of integral theorems are also often used to evaluate the contour integral along a contour, which means that the real-valued integral is calculated simultaneously along with calculating the contour integral.

Integral theorems such as the Cauchy integral formula or residue theorem are generally used in the following method:

• a specific contour is chosen:
The contour is chosen so that the contour follows the part of the complex plane that describes the real-valued integral, and also encloses singularities of the integrand so application of the Cauchy integral formula or residue theorem is possible
• application of Cauchy's integral theorem
The integral is reduced to only an integration around a small circle about each pole.
• application of the Cauchy integral formula or residue theorem
Application of these integral formulae gives us a value for the integral around the whole of the contour.
• division of the contour into a contour along the real part and imaginary part
The whole of the contour can be divided into the contour that follows the part of the complex plane that describes the real-valued integral as chosen before (call it R), and the integral that crosses the complex plane (call it I). The integral over the whole of the contour is the sum of the integral over each of these contours.
• demonstration that the integral that crosses the complex plane plays no part in the sum
If the integral I can be shown to be zero, or if the real-valued integral that is sought is improper, then if we demonstrate that the integral I as described above tends to 0, the integral along R will tend to the integral around the contour R + I.
• conclusion
If we can show the above step, then we can directly calculate R, the real-valued integral.

### Example 1

Consider the integral

${\displaystyle \int _{-\infty }^{\infty }{\frac {1}{\left(x^{2}+1\right)^{2}}}\,dx,}$

To evaluate this integral, we look at the complex-valued function

${\displaystyle f(z)={\frac {1}{\left(z^{2}+1\right)^{2}}}}$

which has singularities at i and i. We choose a contour that will enclose the real-valued integral, here a semicircle with boundary diameter on the real line (going from, say, a to a) will be convenient. Call this contour C.

There are two ways of proceeding, using the Cauchy integral formula or by the method of residues:

#### Using the Cauchy integral formula

Note that:

${\displaystyle \oint _{C}f(z)\,dz=\int _{-a}^{a}f(z)\,dz+\int _{\text{Arc}}f(z)\,dz}$

thus

${\displaystyle \int _{-a}^{a}f(z)\,dz=\oint _{C}f(z)\,dz-\int _{\text{Arc}}f(z)\,dz}$

Furthermore, observe that

${\displaystyle f(z)={\frac {1}{\left(z^{2}+1\right)^{2}}}={\frac {1}{(z+i)^{2}(z-i)^{2}}}.}$

Since the only singularity in the contour is the one at i, then we can write

${\displaystyle f(z)={\frac {\frac {1}{(z+i)^{2}}}{(z-i)^{2}}},}$

which puts the function in the form for direct application of the formula. Then, by using Cauchy's integral formula,

${\displaystyle \oint _{C}f(z)\,dz=\oint _{C}{\frac {\frac {1}{(z+i)^{2}}}{(z-i)^{2}}}\,dz=2\pi i{\frac {d}{dz}}\left({\frac {1}{(z+i)^{2}}}\right){\Bigg |}_{z=i}=2\pi i\left({\frac {-2}{(z+i)^{3}}}\right){\Bigg |}_{z=i}={\frac {\pi }{2}}}$

We take the first derivative, in the above steps, because the pole is a second-order pole. That is, (zi) is taken to the second power, so we employ the first derivative of f(z). If it were (zi) taken to the third power, we would use the second derivative and divide by 2!, etc. The case of (zi) to the first power corresponds to a zero order derivative—just f(z) itself.

We need to show that the integral over the arc of the semicircle tends to zero as a → ∞, using the estimation lemma

${\displaystyle \left|\int _{\text{Arc}}f(z)\,dz\right|\leq ML}$

where M is an upper bound on |f(z)| along the arc and L the length of the arc. Now,

${\displaystyle \left|\int _{\text{Arc}}f(z)\,dz\right|\leq {\frac {a\pi }{\left(a^{2}-1\right)^{2}}}\rightarrow 0{\mbox{ as }}a\rightarrow \infty .}$

So

${\displaystyle \int _{-\infty }^{\infty }{\frac {1}{\left(x^{2}+1\right)^{2}}}\,dx=\int _{-\infty }^{\infty }f(z)\,dz=\lim _{a\to +\infty }\int _{-a}^{a}f(z)\,dz={\frac {\pi }{2}}.\quad \square }$

#### Using the method of residues

Consider the Laurent series of f(z) about i, the only singularity we need to consider. We then have

${\displaystyle f(z)={\frac {-1}{4(z-i)^{2}}}+{\frac {-i}{4(z-i)}}+{\frac {3}{16}}+{\frac {i}{8}}(z-i)+{\frac {-5}{64}}(z-i)^{2}+\cdots }$

(See the sample Laurent calculation from Laurent series for the derivation of this series.)

It is clear by inspection that the residue is i/4, so, by the residue theorem, we have

${\displaystyle \oint _{C}f(z)\,dz=\oint _{C}{\frac {1}{\left(z^{2}+1\right)^{2}}}\,dz=2\pi i\,\operatorname {Res} _{z=i}f(z)=2\pi i\left(-{\frac {i}{4}}\right)={\frac {\pi }{2}}\quad \square }$

Thus we get the same result as before.

#### Contour note

As an aside, a question can arise whether we do not take the semicircle to include the other singularity, enclosing i. To have the integral along the real axis moving in the correct direction, the contour must travel clockwise, i.e., in a negative direction, reversing the sign of the integral overall.

This does not affect the use of the method of residues by series.

### Example 2 – Cauchy distribution

The integral

${\displaystyle \int _{-\infty }^{\infty }{\frac {e^{itx}}{x^{2}+1}}\,dx}$

(which arises in probability theory as a scalar multiple of the characteristic function of the Cauchy distribution) resists the techniques of elementary calculus. We will evaluate it by expressing it as a limit of contour integrals along the contour C that goes along the real line from a to a and then counterclockwise along a semicircle centered at 0 from a to a. Take a to be greater than 1, so that the imaginary unit i is enclosed within the curve. The contour integral is

${\displaystyle \int _{C}{\frac {e^{itz}}{z^{2}+1}}\,dz.}$

Since eitz is an entire function (having no singularities at any point in the complex plane), this function has singularities only where the denominator z2 + 1 is zero. Since z2 + 1 = (z + i)(zi), that happens only where z = i or z = −i. Only one of those points is in the region bounded by this contour. The residue of f(z) at z = i is

${\displaystyle \lim _{z\to i}(z-i)f(z)=\lim _{z\to i}(z-i){\frac {e^{itz}}{z^{2}+1}}=\lim _{z\to i}(z-i){\frac {e^{itz}}{(z-i)(z+i)}}=\lim _{z\to i}{\frac {e^{itz}}{z+i}}={\frac {e^{-t}}{2i}}.}$

According to the residue theorem, then, we have

${\displaystyle \int _{C}f(z)\,dz=2\pi i\operatorname {Res} _{z=i}f(z)=2\pi i{\frac {e^{-t}}{2i}}=\pi e^{-t}.}$

The contour C may be split into a "straight" part and a curved arc, so that

${\displaystyle \int _{\text{straight}}+\int _{\text{arc}}=\pi e^{-t},}$

and thus

${\displaystyle \int _{-a}^{a}=\pi e^{-t}-\int _{\text{arc}}.}$

It can be shown that if t > 0 then

${\displaystyle \int _{\text{arc}}{\frac {e^{itz}}{z^{2}+1}}\,dz\rightarrow 0{\mbox{ as }}a\rightarrow \infty .}$

Therefore, if t > 0 then

${\displaystyle \int _{-\infty }^{\infty }{\frac {e^{itx}}{x^{2}+1}}\,dx=\pi e^{-t}.}$

A similar argument with an arc that winds around i rather than i shows that if t < 0 then

${\displaystyle \int _{-\infty }^{\infty }{\frac {e^{itx}}{x^{2}+1}}\,dx=\pi e^{t},}$

and finally we have this:

${\displaystyle \int _{-\infty }^{\infty }{\frac {e^{itx}}{x^{2}+1}}\,dx=\pi e^{-|t|}.\quad \square }$

(If t = 0 then the integral yields immediately to real-valued calculus methods and its value is π.)

### Example 3 – trigonometric integrals

Certain substitutions can be made to integrals involving trigonometric functions, so the integral is transformed into a rational function of a complex variable and then the above methods can be used in order to evaluate the integral.

As an example, consider

${\displaystyle \int _{-\pi }^{\pi }{\frac {1}{1+3(\cos t)^{2}}}\,dt.}$

We seek to make a substitution of z = eit. Now, recall

${\displaystyle \cos t={\frac {1}{2}}\left(e^{it}+e^{-it}\right)={\frac {1}{2}}\left(z+{\frac {1}{z}}\right)}$

and

${\displaystyle {\frac {dz}{dt}}=iz,\ dt={\frac {dz}{iz}}.}$

Taking C to be the unit circle, we substitute to get:

{\displaystyle {\begin{aligned}\oint _{C}{\frac {1}{1+3\left({\frac {1}{2}}\left(z+{\frac {1}{z}}\right)\right)^{2}}}\,{\frac {dz}{iz}}&=\oint _{C}{\frac {1}{1+{\frac {3}{4}}\left(z+{\frac {1}{z}}\right)^{2}}}{\frac {1}{iz}}\,dz\\&=\oint _{C}{\frac {-i}{z+{\frac {3}{4}}z\left(z+{\frac {1}{z}}\right)^{2}}}\,dz\\&=-i\oint _{C}{\frac {1}{z+{\frac {3}{4}}z\left(z^{2}+2+{\frac {1}{z^{2}}}\right)}}\,dz\\&=-i\oint _{C}{\frac {1}{z+{\frac {3}{4}}\left(z^{3}+2z+{\frac {1}{z}}\right)}}\,dz\\&=-i\oint _{C}{\frac {1}{{\frac {3}{4}}z^{3}+{\frac {5}{2}}z+{\frac {3}{4z}}}}\,dz\\&=-i\oint _{C}{\frac {4}{3z^{3}+10z+{\frac {3}{z}}}}\,dz\\&=-4i\oint _{C}{\frac {1}{3z^{3}+10z+{\frac {3}{z}}}}\,dz\\&=-4i\oint _{C}{\frac {z}{3z^{4}+10z^{2}+3}}\,dz\\&=-4i\oint _{C}{\frac {z}{3\left(z+{\sqrt {3}}i\right)\left(z-{\sqrt {3}}i\right)\left(z+{\frac {i}{\sqrt {3}}}\right)\left(z-{\frac {i}{\sqrt {3}}}\right)}}\,dz\\&=-{\frac {4i}{3}}\oint _{C}{\frac {z}{\left(z+{\sqrt {3}}i\right)\left(z-{\sqrt {3}}i\right)\left(z+{\frac {i}{\sqrt {3}}}\right)\left(z-{\frac {i}{\sqrt {3}}}\right)}}\,dz.\end{aligned}}}

The singularities to be considered are at ${\displaystyle {\tfrac {\pm i}{\sqrt {3}}}.}$ Let C1 be a small circle about ${\displaystyle {\tfrac {i}{\sqrt {3}}},}$ and C2 be a small circle about ${\displaystyle {\tfrac {-i}{\sqrt {3}}}.}$ Then we arrive at the following:

{\displaystyle {\begin{aligned}-{\frac {4i}{3}}&\left[\oint _{C_{1}}{\frac {\frac {z}{\left(z+{\sqrt {3}}i\right)\left(z-{\sqrt {3}}i\right)\left(z+{\frac {i}{\sqrt {3}}}\right)}}{z-{\frac {i}{\sqrt {3}}}}}\,dz+\oint _{C_{2}}{\frac {\frac {z}{\left(z+{\sqrt {3}}i\right)\left(z-{\sqrt {3}}i\right)\left(z-{\frac {i}{\sqrt {3}}}\right)}}{z+{\frac {i}{\sqrt {3}}}}}\,dz\right]\\&=-{\frac {4i}{3}}\left[2\pi i\left.\left({\frac {z}{\left(z+{\sqrt {3}}i\right)\left(z-{\sqrt {3}}i\right)\left(z+{\frac {i}{\sqrt {3}}}\right)}}\right)\right|_{z={\frac {i}{\sqrt {3}}}}+2\pi i\left.\left({\frac {z}{\left(z+{\sqrt {3}}i\right)\left(z-{\sqrt {3}}i\right)\left(z-{\frac {i}{\sqrt {3}}}\right)}}\right)\right|_{z=-{\frac {i}{\sqrt {3}}}}\right]\\&={\frac {8\pi }{3}}\left[{\frac {\frac {i}{\sqrt {3}}}{\left({\frac {i}{\sqrt {3}}}+{\sqrt {3}}i\right)\left({\frac {i}{\sqrt {3}}}-{\sqrt {3}}i\right)\left({\frac {i}{\sqrt {3}}}+{\frac {i}{\sqrt {3}}}\right)}}+{\frac {-{\frac {i}{\sqrt {3}}}}{\left(-{\frac {i}{\sqrt {3}}}+{\sqrt {3}}i\right)\left(-{\frac {i}{\sqrt {3}}}-{\sqrt {3}}i\right)\left(-{\frac {i}{\sqrt {3}}}-{\frac {i}{\sqrt {3}}}\right)}}\right]\\&={\frac {8\pi }{3}}\left[{\frac {\frac {i}{\sqrt {3}}}{\left({\frac {4}{\sqrt {3}}}i\right)\left(-{\frac {2}{i{\sqrt {3}}}}\right)\left({\frac {2}{{\sqrt {3}}i}}\right)}}+{\frac {-{\frac {i}{\sqrt {3}}}}{\left({\frac {2}{\sqrt {3}}}i\right)\left(-{\frac {4}{\sqrt {3}}}i\right)\left(-{\frac {2}{\sqrt {3}}}i\right)}}\right]\\&={\frac {8\pi }{3}}\left[{\frac {\frac {i}{\sqrt {3}}}{i\left({\frac {4}{\sqrt {3}}}\right)\left({\frac {2}{\sqrt {3}}}\right)\left({\frac {2}{\sqrt {3}}}\right)}}+{\frac {-{\frac {i}{\sqrt {3}}}}{-i\left({\frac {2}{\sqrt {3}}}\right)\left({\frac {4}{\sqrt {3}}}\right)\left({\frac {2}{\sqrt {3}}}\right)}}\right]\\&={\frac {8\pi }{3}}\left[{\frac {\frac {1}{\sqrt {3}}}{\left({\frac {4}{\sqrt {3}}}\right)\left({\frac {2}{\sqrt {3}}}\right)\left({\frac {2}{\sqrt {3}}}\right)}}+{\frac {\frac {1}{\sqrt {3}}}{\left({\frac {2}{\sqrt {3}}}\right)\left({\frac {4}{\sqrt {3}}}\right)\left({\frac {2}{\sqrt {3}}}\right)}}\right]\\&={\frac {8\pi }{3}}\left[{\frac {\frac {1}{\sqrt {3}}}{\frac {16}{3{\sqrt {3}}}}}+{\frac {\frac {1}{\sqrt {3}}}{\frac {16}{3{\sqrt {3}}}}}\right]\\&={\frac {8\pi }{3}}\left[{\frac {3}{16}}+{\frac {3}{16}}\right]\\&=\pi .\end{aligned}}}

### Example 3a – trigonometric integrals, the general procedure

The above method may be applied to all integrals of the type

${\displaystyle \int _{0}^{2\pi }{\frac {P{\big (}\sin(t),\sin(2t),\ldots ,\cos(t),\cos(2t),\ldots {\big )}}{Q{\big (}\sin(t),\sin(2t),\ldots ,\cos(t),\cos(2t),\ldots {\big )}}}\,dt}$

where P and Q are polynomials, i.e. a rational function in trigonometric terms is being integrated. Note that the bounds of integration may as well be π and −π, as in the previous example, or any other pair of endpoints 2π apart.

The trick is to use the substitution z = eit where dz = ieit dt and hence

${\displaystyle {\frac {1}{iz}}\,dz=dt.}$

This substitution maps the interval [0, 2π] to the unit circle. Furthermore,

${\displaystyle \sin(kt)={\frac {e^{ikt}-e^{-ikt}}{2i}}={\frac {z^{k}-z^{-k}}{2i}}}$

and

${\displaystyle \cos(kt)={\frac {e^{ikt}+e^{-ikt}}{2}}={\frac {z^{k}+z^{-k}}{2}}}$

so that a rational function f(z) in z results from the substitution, and the integral becomes

${\displaystyle \oint _{|z|=1}f(z){\frac {1}{iz}}\,dz}$

which is in turn computed by summing the residues of f(z)1/iz inside the unit circle.

The image at right illustrates this for

${\displaystyle I=\int _{0}^{\frac {\pi }{2}}{\frac {1}{1+(\sin t)^{2}}}\,dt,}$

which we now compute. The first step is to recognize that

${\displaystyle I={\frac {1}{4}}\int _{0}^{2\pi }{\frac {1}{1+(\sin t)^{2}}}\,dt.}$

The substitution yields

${\displaystyle {\frac {1}{4}}\oint _{|z|=1}{\frac {4iz}{z^{4}-6z^{2}+1}}\,dz=\oint _{|z|=1}{\frac {iz}{z^{4}-6z^{2}+1}}\,dz.}$

The poles of this function are at 1 ± 2 and −1 ± 2. Of these, 1 + 2 and −1 − 2 are outside the unit circle (shown in red, not to scale), whereas 1 − 2 and −1 + 2 are inside the unit circle (shown in blue). The corresponding residues are both equal to i2/16, so that the value of the integral is

${\displaystyle I=2\pi i\;2\left(-{\frac {\sqrt {2}}{16}}i\right)=\pi {\frac {\sqrt {2}}{4}}.}$

### Example 4 – branch cuts

Consider the real integral

${\displaystyle \int _{0}^{\infty }{\frac {\sqrt {x}}{x^{2}+6x+8}}\,dx.}$

We can begin by formulating the complex integral

${\displaystyle \int _{C}{\frac {\sqrt {z}}{z^{2}+6z+8}}\,dz=I.}$

We can use the Cauchy integral formula or residue theorem again to obtain the relevant residues. However, the important thing to note is that z12 = e12Log z, so z12 has a branch cut. This affects our choice of the contour C. Normally the logarithm branch cut is defined as the negative real axis, however, this makes the calculation of the integral slightly more complicated, so we define it to be the positive real axis.

Then, we use the so-called keyhole contour, which consists of a small circle about the origin of radius ε say, extending to a line segment parallel and close to the positive real axis but not touching it, to an almost full circle, returning to a line segment parallel, close, and below the positive real axis in the negative sense, returning to the small circle in the middle.

Note that z = −2 and z = −4 are inside the big circle. These are the two remaining poles, derivable by factoring the denominator of the integrand. The branch point at z = 0 was avoided by detouring around the origin.

Let γ be the small circle of radius ε, Γ the larger, with radius R, then

${\displaystyle \int _{C}=\int _{\varepsilon }^{R}+\int _{\Gamma }+\int _{R}^{\varepsilon }+\int _{\gamma }.}$

It can be shown that the integrals over Γ and γ both tend to zero as ε → 0 and R → ∞, by an estimation argument above, that leaves two terms. Now since z12 = e12Log z, on the contour outside the branch cut, we have gained 2π in argument along γ. (By Euler's identity, eiπ represents the unit vector, which therefore has π as its log. This π is what is meant by the argument of z. The coefficient of 1/2 forces us to use 2π.) So

{\displaystyle {\begin{aligned}\int _{R}^{\varepsilon }{\frac {\sqrt {z}}{z^{2}+6z+8}}\,dz&=\int _{R}^{\varepsilon }{\frac {e^{{\frac {1}{2}}\operatorname {Log} z}}{z^{2}+6z+8}}\,dz\\&=\int _{R}^{\varepsilon }{\frac {e^{{\frac {1}{2}}(\log |z|+i\arg {z})}}{z^{2}+6z+8}}\,dz\\&=\int _{R}^{\varepsilon }{\frac {e^{{\frac {1}{2}}\log |z|}e^{{\frac {1}{2}}(2\pi i)}}{z^{2}+6z+8}}\,dz\\&=\int _{R}^{\varepsilon }{\frac {e^{{\frac {1}{2}}\log |z|}e^{\pi i}}{z^{2}+6z+8}}\,dz\\&=\int _{R}^{\varepsilon }{\frac {-{\sqrt {z}}}{z^{2}+6z+8}}\,dz\\&=\int _{\varepsilon }^{R}{\frac {\sqrt {z}}{z^{2}+6z+8}}\,dz.\end{aligned}}}

Therefore:

${\displaystyle \int _{C}{\frac {\sqrt {z}}{z^{2}+6z+8}}\,dz=2\int _{0}^{\infty }{\frac {\sqrt {x}}{x^{2}+6x+8}}\,dx.}$

By using the residue theorem or the Cauchy integral formula (first employing the partial fractions method to derive a sum of two simple contour integrals) one obtains

${\displaystyle \pi i\left({\frac {i}{\sqrt {2}}}-i\right)=\int _{0}^{\infty }{\frac {\sqrt {x}}{x^{2}+6x+8}}\,dx=\pi \left(1-{\frac {1}{\sqrt {2}}}\right).\quad \square }$

### Example 5 – the square of the logarithm

This section treats a type of integral of which

${\displaystyle \int _{0}^{\infty }{\frac {\log x}{\left(1+x^{2}\right)^{2}}}\,dx}$

is an example.

To calculate this integral, one uses the function

${\displaystyle f(z)=\left({\frac {\log z}{1+z^{2}}}\right)^{2}}$

and the branch of the logarithm corresponding to −π < arg z ≤ π.

We will calculate the integral of f(z) along the keyhole contour shown at right. As it turns out this integral is a multiple of the initial integral that we wish to calculate and by the Cauchy residue theorem we have

{\displaystyle {\begin{aligned}\left(\int _{R}+\int _{M}+\int _{N}+\int _{r}\right)f(z)\,dz&=2\pi i{\big (}\operatorname {Res} _{z=i}f(z)+\operatorname {Res} _{z=-i}f(z){\big )}\\&=2\pi i\left(-{\frac {\pi }{4}}+{\frac {1}{16}}i\pi ^{2}-{\frac {\pi }{4}}-{\frac {1}{16}}i\pi ^{2}\right)\\&=-i\pi ^{2}.\end{aligned}}}

Let R be the radius of the large circle, and r the radius of the small one. We will denote the upper line by M, and the lower line by N. As before we take the limit when R → ∞ and r → 0. The contributions from the two circles vanish. For example, one has the following upper bound with the ML lemma:

${\displaystyle \left|\int _{R}f(z)\,dz\right|\leq 2\pi R{\frac {(\log R)^{2}+\pi ^{2}}{\left(R^{2}-1\right)^{2}}}\to 0.}$

In order to compute the contributions of M and N we set z = −x + on M and z = −x on N, with 0 < x < ∞:

{\displaystyle {\begin{aligned}-i\pi ^{2}&=\left(\int _{R}+\int _{M}+\int _{N}+\int _{r}\right)f(z)\,dz\\&=\left(\int _{M}+\int _{N}\right)f(z)\,dz&&\int _{R},\int _{r}{\mbox{ vanish}}\\&=-\int _{\infty }^{0}\left({\frac {\log(-x+i\varepsilon )}{1+(-x+i\varepsilon )^{2}}}\right)^{2}\,dx-\int _{0}^{\infty }\left({\frac {\log(-x-i\varepsilon )}{1+(-x-i\varepsilon )^{2}}}\right)^{2}\,dx\\&=\int _{0}^{\infty }\left({\frac {\log(-x+i\varepsilon )}{1+(-x+i\varepsilon )^{2}}}\right)^{2}\,dx-\int _{0}^{\infty }\left({\frac {\log(-x-i\varepsilon )}{1+(-x-i\varepsilon )^{2}}}\right)^{2}\,dx\\&=\int _{0}^{\infty }\left({\frac {\log x+i\pi }{1+x^{2}}}\right)^{2}\,dx-\int _{0}^{\infty }\left({\frac {\log x-i\pi }{1+x^{2}}}\right)^{2}\,dx&&\varepsilon \to 0\\&=\int _{0}^{\infty }{\frac {(\log x+i\pi )^{2}-(\log x-i\pi )^{2}}{\left(1+x^{2}\right)^{2}}}\,dx\\&=\int _{0}^{\infty }{\frac {4\pi i\log x}{\left(1+x^{2}\right)^{2}}}\,dx\\&=4\pi i\int _{0}^{\infty }{\frac {\log x}{\left(1+x^{2}\right)^{2}}}\,dx\end{aligned}}}

which gives

${\displaystyle \int _{0}^{\infty }{\frac {\log x}{\left(1+x^{2}\right)^{2}}}\,dx=-{\frac {\pi }{4}}.}$

### Example 6 – logarithms and the residue at infinity

We seek to evaluate

${\displaystyle I=\int _{0}^{3}{\frac {x^{\frac {3}{4}}(3-x)^{\frac {1}{4}}}{5-x}}\,dx.}$

This requires a close study of

${\displaystyle f(z)=z^{\frac {3}{4}}(3-z)^{\frac {1}{4}}.}$

We will construct f(z) so that it has a branch cut on [0, 3], shown in red in the diagram. To do this, we choose two branches of the logarithm, setting

${\displaystyle z^{\frac {3}{4}}=\exp \left({\frac {3}{4}}\log z\right)\quad {\mbox{where }}-\pi \leq \arg z<\pi }$

and

${\displaystyle (3-z)^{\frac {1}{4}}=\exp \left({\frac {1}{4}}\log(3-z)\right)\quad {\mbox{where }}0\leq \arg(3-z)<2\pi .}$

The cut of z34 is therefore (−∞, 0] and the cut of (3 − z)14 is (−∞, 3]. It is easy to see that the cut of the product of the two, i.e. f(z), is [0, 3], because f(z) is actually continuous across (−∞, 0). This is because when z = −r < 0 and we approach the cut from above, f(z) has the value

${\displaystyle r^{\frac {3}{4}}e^{{\frac {3}{4}}\pi i}(3+r)^{\frac {1}{4}}e^{{\frac {2}{4}}\pi i}=r^{\frac {3}{4}}(3+r)^{\frac {1}{4}}e^{{\frac {5}{4}}\pi i}.}$

When we approach from below, f(z) has the value

${\displaystyle r^{\frac {3}{4}}e^{-{\frac {3}{4}}\pi i}(3+r)^{\frac {1}{4}}e^{{\frac {0}{4}}\pi i}=r^{\frac {3}{4}}(3+r)^{\frac {1}{4}}e^{-{\frac {3}{4}}\pi i}.}$

But

${\displaystyle e^{-{\frac {3}{4}}\pi i}=e^{{\frac {5}{4}}\pi i},}$

so that we have continuity across the cut. This is illustrated in the diagram, where the two black oriented circles are labelled with the corresponding value of the argument of the logarithm used in z34 and (3 − z)14.

We will use the contour shown in green in the diagram. To do this we must compute the value of f(z) along the line segments just above and just below the cut.

Let z = r (in the limit, i.e. as the two green circles shrink to radius zero), where 0 ≤ r ≤ 3. Along the upper segment, we find that f(z) has the value

${\displaystyle r^{\frac {3}{4}}e^{{\frac {0}{4}}\pi i}(3-r)^{\frac {1}{4}}e^{{\frac {2}{4}}\pi i}=ir^{\frac {3}{4}}(3-r)^{\frac {1}{4}}}$

and along the lower segment,

${\displaystyle r^{\frac {3}{4}}e^{{\frac {0}{4}}\pi i}(3-r)^{\frac {1}{4}}e^{{\frac {0}{4}}\pi i}=r^{\frac {3}{4}}(3-r)^{\frac {1}{4}}.}$

It follows that the integral of f(z)/5 − z along the upper segment is iI in the limit, and along the lower segment, I.

If we can show that the integrals along the two green circles vanish in the limit, then we also have the value of I, by the Cauchy residue theorem. Let the radius of the green circles be ρ, where ρ < 0.001 and ρ → 0, and apply the ML inequality. For the circle CL on the left, we find

${\displaystyle \left|\int _{C_{\mathrm {L} }}{\frac {f(z)}{5-z}}dz\right|\leq 2\pi \rho {\frac {\rho ^{\frac {3}{4}}3.001^{\frac {1}{4}}}{4.999}}\in {\mathcal {O}}\left(\rho ^{\frac {7}{4}}\right)\to 0.}$

Similarly, for the circle CR on the right, we have

${\displaystyle \left|\int _{C_{\mathrm {R} }}{\frac {f(z)}{5-z}}dz\right|\leq 2\pi \rho {\frac {3.001^{\frac {3}{4}}\rho ^{\frac {1}{4}}}{1.999}}\in {\mathcal {O}}\left(\rho ^{\frac {5}{4}}\right)\to 0.}$

Now using the Cauchy residue theorem, we have

${\displaystyle (-i+1)I=-2\pi i\left(\operatorname {Res} _{z=5}{\frac {f(z)}{5-z}}+\operatorname {Res} _{z=\infty }{\frac {f(z)}{5-z}}\right).}$

where the minus sign is due to the clockwise direction around the residues. Using the branch of the logarithm from before, clearly

${\displaystyle \operatorname {Res} _{z=5}{\frac {f(z)}{5-z}}=-5^{\frac {3}{4}}e^{{\frac {1}{4}}\log(-2)}.}$

The pole is shown in blue in the diagram. The value simplifies to

${\displaystyle -5^{\frac {3}{4}}e^{{\frac {1}{4}}(\log 2+\pi i)}=-e^{{\frac {1}{4}}\pi i}5^{\frac {3}{4}}2^{\frac {1}{4}}.}$

We use the following formula for the residue at infinity:

${\displaystyle \operatorname {Res} _{z=\infty }h(z)=\operatorname {Res} _{z=0}\left(-{\frac {1}{z^{2}}}h\left({\frac {1}{z}}\right)\right).}$

Substituting, we find

${\displaystyle {\frac {1}{5-{\frac {1}{z}}}}=-z\left(1+5z+5^{2}z^{2}+5^{3}z^{3}+\cdots \right)}$

and

${\displaystyle \left({\frac {1}{z^{3}}}\left(3-{\frac {1}{z}}\right)\right)^{\frac {1}{4}}={\frac {1}{z}}(3z-1)^{\frac {1}{4}}={\frac {1}{z}}e^{{\frac {1}{4}}\pi i}(1-3z)^{\frac {1}{4}},}$

where we have used the fact that −1 = eπi for the second branch of the logarithm. Next we apply the binomial expansion, obtaining

${\displaystyle {\frac {1}{z}}e^{{\frac {1}{4}}\pi i}\left(1-{{\frac {1}{4}} \choose 1}3z+{{\frac {1}{4}} \choose 2}3^{2}z^{2}-{{\frac {1}{4}} \choose 3}3^{3}z^{3}+\cdots \right).}$

The conclusion is that

${\displaystyle \operatorname {Res} _{z=\infty }{\frac {f(z)}{5-z}}=e^{{\frac {1}{4}}\pi i}\left(5-{\frac {3}{4}}\right)=e^{{\frac {1}{4}}\pi i}{\frac {17}{4}}.}$

Finally, it follows that the value of I is

${\displaystyle I=2\pi i{\frac {e^{{\frac {1}{4}}\pi i}}{-1+i}}\left({\frac {17}{4}}-5^{\frac {3}{4}}2^{\frac {1}{4}}\right)=2\pi 2^{-{\frac {1}{2}}}\left({\frac {17}{4}}-5^{\frac {3}{4}}2^{\frac {1}{4}}\right)}$

which yields

${\displaystyle I={\frac {\pi }{2{\sqrt {2}}}}\left(17-5^{\frac {3}{4}}2^{\frac {9}{4}}\right)={\frac {\pi }{2{\sqrt {2}}}}\left(17-40^{\frac {3}{4}}\right).}$

## Evaluation with residue theorem

Using the residue theorem, we can evaluate closed contour integrals. The following are examples on evaluating contour integrals with the residue theorem.

Using the residue theorem, let's evaluate this contour integral.

${\displaystyle \oint _{C}{\frac {e^{z}}{z^{3}}}\,dz}$

As a refresher, the residue theorem states

${\displaystyle \oint _{C}f(z)=2\pi i\cdot \sum \operatorname {Res} (f,a_{k}),}$

where ${\displaystyle \operatorname {Res} }$ is the residue of ${\displaystyle f(z)}$.

${\displaystyle f(z)}$ has only one pole, ${\displaystyle 0}$. From that, we can determine the residue of ${\displaystyle f(z)}$ to be ${\displaystyle {\tfrac {1}{2}}}$

{\displaystyle {\begin{aligned}\oint _{C}f(z)&=\oint _{C}{\frac {e^{z}}{z^{3}}}\\&=2\pi i\cdot \operatorname {Res} _{z=0}f(z)\\&=2\pi i\operatorname {Res} _{z=0}{\frac {e^{z}}{z^{3}}}\\&=2\pi i\cdot {\frac {1}{2}}\\&=\pi i\end{aligned}}}

Thus, using the residue theorem, we can determine:

${\displaystyle \oint _{C}{\frac {e^{z}}{z^{3}}}=\pi i.}$

## Multivariable Contour Integrals

To solve multivariable contour integrals (i.e. surface integrals, complex volume integrals, and higher order integrals), we must use the divergence theorem. For right now, let ${\displaystyle \nabla }$ be interchangeable with ${\displaystyle \operatorname {Div} }$. These will both serve as the divergence of the vector field denoted as ${\displaystyle \mathbf {F} }$. This theorem states:

${\displaystyle \underbrace {\int \cdots \int _{U}} _{n}\operatorname {Div} (\mathbf {F} )\,dV=\underbrace {\oint \cdots \oint _{\partial U}} _{n-1}\mathbf {F} \cdot \mathbf {n} \,dS}$

In addition, we also need to evaluate ${\displaystyle \nabla \cdot \mathbf {F} }$ where ${\displaystyle \nabla \cdot \mathbf {F} }$ is an alternate notation of ${\displaystyle \operatorname {Div} (\mathbf {F} )}$. The Divergence of any dimension can be described as

{\displaystyle {\begin{aligned}\operatorname {Div} (\mathbf {F} )&=\nabla \cdot \mathbf {F} \\&=\left({\frac {\partial }{\partial u}},{\frac {\partial }{\partial x}},{\frac {\partial }{\partial y}},{\frac {\partial }{\partial z}},\cdots \right)\cdot (F_{u},F_{x},F_{y},F_{z}\cdots )\\&=\left({\frac {\partial F_{u}}{\partial u}}+{\frac {\partial F_{x}}{\partial x}}+{\frac {\partial F_{y}}{\partial y}}+{\frac {\partial F_{z}}{\partial z}}\cdots \right)\end{aligned}}}

### Example 1

Let the vector field ${\displaystyle \mathbf {F} =\sin(2x)+\sin(2y)+\sin(2z)}$ and be bounded by the following

${\displaystyle {0\leq x\leq 1}\quad {0\leq y\leq 3\pi }\quad {-1\leq z\leq 4}}$

The corresponding double contour integral would be set up as such:

${\displaystyle {\scriptstyle S}}$ ${\displaystyle \mathbf {F} \cdot \mathbf {n} \,dS}$

We now evaluate ${\displaystyle \nabla \cdot \mathbf {F} }$. While we're at it, let's set up the corresponding triple integral:

{\displaystyle {\begin{aligned}&=\iiint _{V}\left({\frac {\partial F_{x}}{\partial x}}+{\frac {\partial F_{y}}{\partial y}}+{\frac {\partial F_{z}}{\partial z}}\right)\,dV\\&=\iiint _{V}\left({\frac {\partial \sin(2x)}{\partial x}}+{\frac {\partial \sin(2y)}{\partial y}}+{\frac {\partial \sin(2z)}{\partial z}}\right)\,dV\\&=\iiint _{V}2(\cos(2x)+\cos(2y)+\cos(2z))\,dV\\&=\int _{0}^{1}\int _{0}^{3}\int _{-1}^{4}2(\cos(2x)+\cos(2y)+\cos(2z))\,dx\,dy\,dz\\&=\int _{0}^{1}\int _{0}^{3}(10\cos(2y)+\sin(8)+\sin(2)+10\cos(z))\,dy\,dz\\&=\int _{0}^{1}(30\cos(2z)+3\sin(2)+3\sin(8)+5\sin(6))\,dz\\&=18\sin(2)+3\sin(8)+5\sin(6)\end{aligned}}}

### Example 2

For example, let the vector field ${\displaystyle \mathbf {F} =u^{4}+x^{5}+y^{6}+z^{-3}}$, and ${\displaystyle n}$ is the fourth dimension. Let this vector field be bounded by the following:

${\displaystyle {0\leq x\leq 1}\quad {-10\leq y\leq 2\pi }\quad {4\leq z\leq 5}\quad {-1\leq u\leq 3}}$

To evaluate this, we must utilize the divergence theorem as stated before, and we must evaluate ${\displaystyle \nabla \cdot \mathbf {F} }$. For right now, let ${\displaystyle dV=dxdydzdu}$

${\displaystyle {\scriptstyle S}}$ ${\displaystyle \mathbf {F} \cdot \mathbf {n} \,dS}$
{\displaystyle {\begin{aligned}&=\iiiint _{V}\left({\frac {\partial F_{u}}{\partial u}}+{\frac {\partial F_{x}}{\partial x}}+{\frac {\partial F_{y}}{\partial y}}+{\frac {\partial F_{z}}{\partial z}}\right)\,dV\\&=\iiiint _{V}\left({\frac {\partial u^{4}}{\partial u}}+{\frac {\partial x^{5}}{\partial x}}+{\frac {\partial y^{6}}{\partial y}}+{\frac {\partial z^{-3}}{\partial z}}\right)\,dV\\&=\iiiint _{V}{\frac {4u^{3}z^{4}+5x^{4}z^{4}+5y^{4}z^{4}-3}{z^{4}}}\,dV\\&=\iiiint _{V}{\frac {4u^{3}z^{4}+5x^{4}z^{4}+5y^{4}z^{4}-3}{z^{4}}}\,dV\\&=\int _{0}^{1}\int _{-10}^{2\pi }\int _{4}^{5}\int _{-1}^{3}{\frac {4u^{3}z^{4}+5x^{4}z^{4}+5y^{4}z^{4}-3}{z^{4}}}\,dV\\&=\int _{0}^{1}\int _{-10}^{2\pi }\int _{4}^{5}\left({\frac {4(3u^{4}z^{3}+3y^{6}+91z^{3}+3)}{3z^{3}}}\right)\,dy\,dz\,du\\&=\int _{0}^{1}\int _{-10}^{2\pi }\left(4u^{4}+{\frac {743440}{21}}+{\frac {4}{z^{3}}}\right)\,dz\,du\\&=\int _{0}^{1}\left(-{\frac {1}{2\pi ^{2}}}+{\frac {1486880\pi }{21}}+8\pi u^{4}+40u^{4}+{\frac {371720021}{1050}}\right)\,du\\&={\frac {371728421}{1050}}+{\frac {14869136\pi ^{3}-105}{210\pi ^{2}}}\\&\approx {576468.77}\end{aligned}}}

Thus, we can evaluate a contour integral of the fourth dimension.

## Integral representation

An integral representation of a function is an expression of the function involving a contour integral. Various integral representations are known for many special functions. Integral representations can be important for theoretical reasons, e.g. giving analytic continuation or functional equations, or sometimes for numerical evaluations.

For example, the original definition of the Riemann zeta function ζ(s) via a Dirichlet series,

${\displaystyle \zeta (s)=\sum _{n=1}^{\infty }{\frac {1}{n^{s}}},}$

is valid only for Re(s) > 1. But

${\displaystyle \zeta (s)=-{\frac {\Gamma (1-s)}{2\pi i}}\int _{H}{\frac {(-t)^{s-1}}{e^{t}-1}}dt,}$

where the integration is done over the Hankel contour H, is valid for all complex s not equal to 1.


text:
# Proving that being $R$ is a relation in a set $A$ and $R^{-1}$ its inverse, satisfy 5 properties between them.

$R$ is a relation in a set $A$ (from $A$ to $A$) and $R^{-1}$ is the inverse relation of $R$ prove:

(1) $R ∪ R^{-1}$ is symmetric.

(2) If $R$ reflexive ⇒ $R^{-1}$ is reflexive.

(3) If $R$ symmetric ⇒ $R^{-1}$ is symmetric.

(4) If $R$ transitive ⇒ $R^{-1}$ is transitive.

(5) If $R$ antisymmetric ⇒ $R^{-1}$ is antisymmetric.

I did the (5) as follows:

If $R$ antisymmetric ⇒ $R^{-1}$ is antisymmetric. Demonstration: we must prove that $R^{-1}$ is antisymmetric, that is, we must prove that

$xR^{-1}y$ $∧$ $yR^{-1}x$ ⇒ $x = y.$

We see it,

$xR^{-1}y$ ⇒ $yRx$, (I), by definition of inverse relationship.

$yR^{-1}x$ ⇒ $xRy$, (II), by definition of inverse relationship.

(I) ∧ (II) ⇒ $xRy ∧ yRx$

⇒ $x$ = $y$, and then, by hypothesis, $R$ is antisymmetric.

Is this demonstration correct? How should I demonstrate the other 4 properties between $R$ and $R^{-1}$?

For the purpose of this answer I assume that you define $R^{-1} = \{(y,x)\text{ }|\text{ }(x,y)\in R\}$.

Proof. We examine each of the above propositions in turn.

• Notice that $(1)$ and $(2)$ follow immedietly from the definition of $R^{-1}.$

• For $(3)$ you can assume that $R$ is symmetric and let $x,y\in A$ such that $(x,y)\in R^{-1}$ equivalently $(y,x)\in R$ then by symmetry of $R$ we have $(x,y)\in R$ and equivaletly $(y,x)\in R^{-1}$.

• For $(4)$ assume $R$ is transitive then given arbitrary $x,y,z\in A$ such that $xR^{-1}y$ and $yR^{-1}z$ equivalently we have $yRx$ and $zRy$ which in conjunction with the transitivity of $R$ imply $zRx$ equivalently $xR^{-1}z$.

and yes your proof of proposition $(5)$ is very much correct.

Lastly if you would oblige me may i ask which text is this problem from?

• Typo: in (3), "by symmetry of $R$, we have $(x,y)\in R^{-1}$": it's $(x,y) \in R$. – amrsa Jun 11 '18 at 16:06
• Thank you very much for the reply, @Atif Farooq ! I found the exercise in a partial examination of Algebra for Astronomy of the UNLP. – Ayesca Jun 11 '18 at 16:11
• @amrsa Thankyou for you remark – Atif Farooq Jun 11 '18 at 16:30

format: plain


text:
# Greens Theorem

1. May 25, 2010

### mikeyrichster

The Integral I is defined by

I = Integral F . dr Where F = (x-y, xy) << This is a verticle vector, i just didn'nt know how to write it with latex.

And C is a triangle with the vertices (0,0), (1,0) and (1,3) tracked anticlockwise.

Calculate the line integral using greens theorem

Any help would be much appreciated!

Thanks

PS sorry about my lack of LaTeX typesetting

2. May 25, 2010

### vela

Staff Emeritus
You need to make an attempt and show your work before you're going to get any help. A good place to start would be to see what Green's theorem says.

3. May 25, 2010

### Staff: Mentor

Also, this is hardly a Precalculus question. That's what the Calculus & Beyond section is for.

4. May 26, 2010

### vela

Staff Emeritus
You should make an effort to learn how to use LaTeX, particularly for this problem as the typesetting will make the equations much easier to read. Click on the following link for an intro to LaTeX.


text:
Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

# What are class boundaries in statistics?

See explanation.

Class boundaries are true class limits.

Recall: Class limits are end numbers of a class interval.

For instance, we have a class interval 1 - 5. 1 is called the lower limit (LL) and 5 is the upper limit (UL). These numbers define a class. On the other hand, class boundaries were called true class limits. These are boundary points. They tend to bound the class limits.

Here's the definitional formula for class boundaries

• Upper-class boundary (UCB)

"UCB" = "UL" + 1/2 "unit of measurement"

• Lower class boundary (LCB)

"LCB" = "LL" - 1/2 "unit of measurement"

Let's take the class boundaries for the class interval 1 - 5. To do this, you need to determine the unit of measurement.

Since we are counting by "ones", 1, 2, 3, 5, and so on, then the unit of measurement is 1 (a unit). So, we have to multiply 1 by 1/2 then we may now take the class boundaries

"UCB" = 5 + (1/2)(1) = 5.5

"LCB" = 1 - (1/2)(1) = 0.5

Therefore, the class boundaries are 0.5 - 5.5.

Let's try another example. Find the class boundaries for the given class interval: 7.5 - 10.5

Look at the least place value. In this example, we are counting by tenths. 0.1, 0.2, 0.3, 0.4, and so on, meaning that we have to multiply a tenth by 1/2 to compute for the class boundaries.

"UCB" = 10.5 + (1/2)(0.1) = 10.55

"LCB" = 7.5 - (1/2)(0.1) = 7.45

So the required class boundaries are 7.45 - 10.55.

Happy new year! :D


text:
# Preprocessing noisy functional data using factor models

Jammoul, F. (Redner/in)

Aktivität: Vortrag oder PräsentationPosterpräsentationScience to science

## Beschreibung

We consider noisy functional data $Y_t(s_i) = X_t(s_i) + \varepsilon_{ti}$ that has been recorded at a discrete set of observation points. Naturally, the goal is to recover the underlying signal $X_t$. Commonly, this is done by non-parametric smoothing approaches, e.g. kernel smoothing or spline fitting. These methods act function by function and do not take the overall presented information into consideration. We argue that it is often more accurate to take the entire data set into account, which can help recover systematic properties of the underlying signal. Other approaches using functional principal components do just that, but require strong assumptions on the smoothness of the underlying signal. We show that under very mild assumptions, the signal may be viewed as the common components of a factor model. Using this discovery, we develop a PCA driven approach to recover the signal and show consistency. Our theoretical results hold under rather mild conditions, in particular we do not require specific smoothness assumptions for the underlying curves and allow for a certain degree of autocorrelation in the noise. We demonstrate the applicability of our approach with simulation experiments and real life data analysis.
Zeitraum 23 Jun 2021 → 25 Jun 2021 International Workshop on Functional and Operatorial Statistics Konferenz 5 International


text:
Menu Home Action My entries Defined browse Select Select in the list MathematicsPhysics Then Select Select in the list Then Select Select in the list Search

Schwarz inequality

 Definition/Summary the Schwarz inequality (also called Cauchy–Schwarz inequality and Cauchy inequality) has many applications in mathematics and physics. For vectors $a,b$ in an inner product space over $\mathbb C$: $$\|a\|\|b\| \geq |(a,b)|$$ For two complex numbers $a,b$ : $$|a|^2|b|^2 \geq |ab|^2$$ In bra-ket notation, which is commonly used in Quantum Mechanics: $$| \langle a | a \rangle |^2| \langle b | b \rangle |^2 \geq | \langle a | b \rangle |^2$$ For functions $a, b$ which maps a real numbers into complex: $x \in \mathbb{R}$, $a(x), \: b(x) \in \mathbb{C}$: $$\int |a (x)|^2 dx\int |b(x)|^2 dx \geq \left| \int a^*bdx \right|^2 ,$$ if the integrals have finite values.

 Equations The Schwarz inequality may be written in a number of equivalent ways: $$\|a\|\|b\| \geq |(a,b)|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(1)$$ $$|a|^2|b|^2 \geq |ab|^2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(2)$$ $$| \langle a | a \rangle |^2| \langle b | b \rangle |^2 \geq | \langle a | b \rangle |^2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(3)$$ $$\int |a (x)|^2 dx\int |b(x)|^2 dx \geq \left| \int a(x)^*b(x) \, dx \right|^2 ~~~(4)$$

 Scientists Augustin Cauchy (1789-1857) Hermann Amandus Schwarz (1843-1921) Viktor Bunyakovsky (1804-1889)

 Recent forum threads on Schwarz inequality

 Breakdown Mathematics > Calculus/Analysis >> Inequalities

 Extended explanation Theorem: If a and b are vectors in an inner product space X over $$\mathbb C[/itex], then [tex]|(a,b)| \leq \|a\|\|b\|$$where the norm is the standard norm on an inner product space. Proof #1: Let t be an arbitrary complex number. $$0 \leq (a+tb,a+tb)=\|a\|^2+t(a,b)+t^*(b,a)+|t|^2\|b\|^2$$$$=\|a\|^2+2\mbox{ Re}(t(a,b))+|t|^2\|b\|^2$$The inequality is obviously satisfied when the real part of t(a,b) is non-negative, so we can only learn something interesting when it's negative. Let's choose Arg t so that it is $$=\|a\|^2-2|t||(a,b)|+|t|^2\|b\|^2$$Now let's choose |t| so that it minimizes the sum of the last two terms. (This should give us the most interesting result). $s=|t|$, $A=\|b\|^2$, $B=2|(a,b)|$$$f(s)=As^2-Bs$$$$f'(s)=2As-B=0 \implies s=\frac{B}{2A} = \frac{|(a,b)|}{\|b\|^2}$$$$f''(s)=2A>0$$Continuing with this value of |t|... $$=\|a\|^2-2\frac{|(a,b)|}{\|b\|^2}|(a,b)|+\frac{|(a,b)|^2}{\|b\|^4}\|b\|^2$$$$=\|a\|^2-\frac{|(a,b)|^2}{\|b\|^2}$$Thus, $0 \leq \|a\|^2\|b\|^2 - |(a,b)|^2$ Proof #2: A proof for Ineq(3) (the last inequality in the "equations" section) will now be given, but first some basic properties of complex numbers... $$z = \text{Re}z + i \text{Im}z$$ $$z^* = \text{Re}z - i \text{Im}z$$ $$|z|^2 = z^*z \geq 0$$ $$|zy|^2 = (zy)^*zy$$ Now let $c(x) = a(x) + d \, b(x)$, $d \in \mathbb{C}$. $$\int |c(x)|^2 dx \geq 0$$ $$\int |a(x)|^2dx + d^*d \int |b(x)|^2dx + d \int a(x)^*b(x) dx + d^* \int a(x)b(x)^* dx \geq 0$$ if the integrals have finite value, this inequality must hold for all $d$, we can choose: $$d = - \left( \int b(x)^*a(x) dx \right) / \left( \int |b(x)|^2 dx \right)$$ $$\int |a(x)|^2 dx \int |b(x)|^2 dx \geq \int a(x)^*b(x)dx \int a(x)b(x)^*dx = \left| \int a(x)^*b(x)dx \right|^2$$


text:
# American Institute of Mathematical Sciences

March  2022, 15(3): 555-572. doi: 10.3934/dcdss.2021151

## Mathematical modeling of algal blooms due to swine CAFOs in Eastern North Carolina

 1 St. Mary's College of Maryland, Department of Economics, St. Mary's City, MD 20686, USA 2 St. Mary's College of Maryland, Department of Mathematics and Computer Science, St. Mary's City, MD 20686, USA 3 Lafayette College, Department of Mathematics, Easton, PA 18042, USA 4 Centre College, Department of Mathematics, Danville, KY 40422, USA

* Corresponding author: ekose@smcm.edu

Received  January 2020 Revised  August 2021 Published  March 2022 Early access  December 2021

Dramatic strides have been made in treating human waste to remove pathogens and excess nutrients before discharge into the environment, to the benefit of ground and surface water quality. Yet these advances have been undermined by the dramatic growth of Confined Animal Feeding Operations (CAFOs) which produce voluminous quantities of untreated waste. Industrial swine routinely produce waste streams similar to that of a municipality, yet these wastes are held in open-pit "lagoons" which are at risk of rupture or overflow. Eastern North Carolina is a coastal plain with productive estuaries which are imperiled by more than 2000 permitted swine facilities housing over 9 million hogs; the associated 3,500 permitted manure lagoons pose a risk to sensitive estuarine ecosystems, as breaches or overflows send large plumes of nutrient and pathogen-rich waste into surface waters. Understanding the relationship between nutrient pulses and surface water quality in coastal environments is essential to effective CAFO policy formation. In this work, we develop a system of ODEs to model algae growth in a coastal estuary due to a manure lagoon breach and investigate nutrient thresholds above which algal blooms are unresolvable.

Citation: Amy Henderson, Emek Kose, Allison Lewis, Ellen R. Swanson. Mathematical modeling of algal blooms due to swine CAFOs in Eastern North Carolina. Discrete and Continuous Dynamical Systems - S, 2022, 15 (3) : 555-572. doi: 10.3934/dcdss.2021151
##### References:
 [1] D. F. Boesch, D. M. Anderson and R. A. Horner et al., Harmful algal blooms in coastal waters: Options for prevention, control, and mitigation, NOAA Coastal Ocean Program Decision Analysis Series, 10 (1997). [2] J. M. Burkholder et al., Impacts to a coastal river and estuary from rupture of a large swine waste holding lagoon, Journal of Environmental Quality, 26, (1997), 1451–1466. [3] J. Burkholder, B. Libra and P. Weyer et al., Impacts of waste from concentrated animal feeding operations on water quality, Environ. Health Persp., 115, (2007), 308–312. doi: 10.1289/ehp.8839. [4] E. J. Buskey and D. A. Stockwell, Effects of a persistent "brown tide" on zooplankton populations in the Laguna Madre of south Texas, Toxic Phytoplankton Blooms in the Sea, (1993), 659–666. [5] S. J. Du Plooy, N. K. Carrasco and R. Perissinotto, Effects of zooplankton grazing on the bloom-forming Cyanothece sp. in a subtropical estuarine lake, J. Plankton Res., 39 (2017), 826-835.  doi: 10.1093/plankt/fbx039. [6] S. P. Epperly and S. W. Ross, Characterization of the North Carolina Pamlico-Albemarle estuarine complex, Estuarine Ecol., 1986. [7] J. A. Freund, S. Mieruch and B. Scholze et al., Bloom dynamics in a seasonally forced phytoplankton-zooplankton model: Trigger mechanisms and timing effects, Ecol. Complex., 3 (2006), 129-139. doi: 10.1016/j.ecocom.2005.11.001. [8] R. E. Fuhrman, History of water pollution control, J. Water Pollut. Con. F., 56 (1984), 306-313. [9] J. C. Goldman and E. Carpenter, A kinetic approach to the effect of temperature on algal growth, Limnol. Oceanogr., 19 (1974), 756-766. [10] S. M. Z. Hossain, N. Al-Bastaki and A. M. A. Alnoaimi et al., Mathematical modeling of temperature effect on algal growth for biodiesel application, Renewable Energy and Environ. Sustainability, 4 (2019), 517-528. doi: 10.1007/978-3-030-18488-9_41. [11] C. Hribar, Understanding concentrated animal feeding operations and their impact on communities, The National Assoc. of Local Boards of Health, 2010. [12] J. Kravchenko, S. H. Rhew and I. Akushevich et al., Mortality and health outcomes in North Carolina communities located in close proximity to hog concentrated animal feeding operations, NC Med. J., 79 (2018), 278-288. doi: 10.18043/ncm.79.5.278. [13] M. A. Mallin, Impacts of industrial animal production on rivers and estuaries: Animal-waste lagoons and sprayfields near aquatic environments may significantly degrade water quality and endanger health, Am. Sci., 88 (2000), 26-37. [14] S. Marino, I. B. Hogue, C. J. Ray and D. E. Kirschner, A methodology for performing globaluncertainty and sensitivity analysis in systems biology, J. Theor. Biol., 254 (2008), 178-196.  doi: 10.1016/j.jtbi.2008.04.011. [15] D. F. Martin, M. T. Doij and C. B. Stackhouse, Biocontrol of the Florida red tide organism, Gymnodinium breve, through predator organisms, Environ. Lett., 4 (1973), 297-301.  doi: 10.1080/00139307309435500. [16] W. D. McBride and N. Key, US hog production from 1992 to 2009: Technology, restructuring, and productivity growth, USDA Econ. Res. Report, 158 (2013). [17] A. Shirota, Red tide problem and countermeasures, Int. J. Aquaculture and Fisheries Tech., 1 (1989), 195-293. [18] J. B. Shukla, A. K. Misra and P. Chandra, Modeling and analysis of the algal bloom in a lake caused by discharge of nutrients, Appl. Math. Comput., 196 (2008), 782-790.  doi: 10.1016/j.amc.2007.07.010. [19] V. H. Smith, Responses of estuarine and coastal marine phytoplankton to nitrogen and phosphorus enrichment, Limnol. Oceanogr., 51 (2006), 377-384.  doi: 10.4319/lo.2006.51.1_part_2.0377. [20] K. A. Steidinger, A re-evaluation of toxic dinoflagellate biology and ecology, Prog. Phycol. Res., 2 (1983), 147-188. [21] M. Swinker, Human health effects of hog waste, NC Med. J., 59 (1998), 16-18. [22] J. M. Testa, Y. Li and Y. J. Lee et al., Quantifying the effects of nutrient loading on dissolved O2 cycling and hypoxia in Chesapeake Bay using a couple hydrodynamic-biogeochemical model, J. Marine Syst., 139 (2014), 139-158. [23] J. E. Truscott and J. Brindley, Ocean plankton populations as excitable media, Bull. Math. Biol., 56 (1994), 981-998. [24] S. Wing, D. Cole and G. Grant, Environmental injustice in North Carolina's hog industry, Environ. Health Persp., 108 (2000), 225-231.  doi: 10.1289/ehp.00108225. [25] S. Wing, S. Freedman and L. Band, The potential impact of flooding on confined animal feeding operations in eastern north carolina, Environ. Health Persp., 110 (2002), 387-391.  doi: 10.1289/ehp.02110387. [26] J. Zhao and Y. Yan, Dynamics of a seasonally forced phytoplankton-zooplankton model with impulsive biological control, Discrete Dyn. Nat. Soc., 2016 (2016). doi: 10.1155/2016/2560195. [27] What Are Phytoplankton?, Available from: https://oceanservice.noaa.gov/facts/phyto.html. [28] North Carolina Department of Environmental Quality: MajorHydro, Available from: http://data-ncdenr.opendata.arcgis.com/datasets/majorhydro. [29] North Carolina Department of Environmental Quality: List of Permitted Animal Facilities, Available from: https://deq.nc.gov/cafo-map. [30] TIGER/Line Shapefiles, Available from: https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html. [31] Zooplankton Vs. Phytoplankton, Available from: https://sciencing.com/zooplankton-vs-phytoplankton-5432413.html.

show all references

##### References:
 [1] D. F. Boesch, D. M. Anderson and R. A. Horner et al., Harmful algal blooms in coastal waters: Options for prevention, control, and mitigation, NOAA Coastal Ocean Program Decision Analysis Series, 10 (1997). [2] J. M. Burkholder et al., Impacts to a coastal river and estuary from rupture of a large swine waste holding lagoon, Journal of Environmental Quality, 26, (1997), 1451–1466. [3] J. Burkholder, B. Libra and P. Weyer et al., Impacts of waste from concentrated animal feeding operations on water quality, Environ. Health Persp., 115, (2007), 308–312. doi: 10.1289/ehp.8839. [4] E. J. Buskey and D. A. Stockwell, Effects of a persistent "brown tide" on zooplankton populations in the Laguna Madre of south Texas, Toxic Phytoplankton Blooms in the Sea, (1993), 659–666. [5] S. J. Du Plooy, N. K. Carrasco and R. Perissinotto, Effects of zooplankton grazing on the bloom-forming Cyanothece sp. in a subtropical estuarine lake, J. Plankton Res., 39 (2017), 826-835.  doi: 10.1093/plankt/fbx039. [6] S. P. Epperly and S. W. Ross, Characterization of the North Carolina Pamlico-Albemarle estuarine complex, Estuarine Ecol., 1986. [7] J. A. Freund, S. Mieruch and B. Scholze et al., Bloom dynamics in a seasonally forced phytoplankton-zooplankton model: Trigger mechanisms and timing effects, Ecol. Complex., 3 (2006), 129-139. doi: 10.1016/j.ecocom.2005.11.001. [8] R. E. Fuhrman, History of water pollution control, J. Water Pollut. Con. F., 56 (1984), 306-313. [9] J. C. Goldman and E. Carpenter, A kinetic approach to the effect of temperature on algal growth, Limnol. Oceanogr., 19 (1974), 756-766. [10] S. M. Z. Hossain, N. Al-Bastaki and A. M. A. Alnoaimi et al., Mathematical modeling of temperature effect on algal growth for biodiesel application, Renewable Energy and Environ. Sustainability, 4 (2019), 517-528. doi: 10.1007/978-3-030-18488-9_41. [11] C. Hribar, Understanding concentrated animal feeding operations and their impact on communities, The National Assoc. of Local Boards of Health, 2010. [12] J. Kravchenko, S. H. Rhew and I. Akushevich et al., Mortality and health outcomes in North Carolina communities located in close proximity to hog concentrated animal feeding operations, NC Med. J., 79 (2018), 278-288. doi: 10.18043/ncm.79.5.278. [13] M. A. Mallin, Impacts of industrial animal production on rivers and estuaries: Animal-waste lagoons and sprayfields near aquatic environments may significantly degrade water quality and endanger health, Am. Sci., 88 (2000), 26-37. [14] S. Marino, I. B. Hogue, C. J. Ray and D. E. Kirschner, A methodology for performing globaluncertainty and sensitivity analysis in systems biology, J. Theor. Biol., 254 (2008), 178-196.  doi: 10.1016/j.jtbi.2008.04.011. [15] D. F. Martin, M. T. Doij and C. B. Stackhouse, Biocontrol of the Florida red tide organism, Gymnodinium breve, through predator organisms, Environ. Lett., 4 (1973), 297-301.  doi: 10.1080/00139307309435500. [16] W. D. McBride and N. Key, US hog production from 1992 to 2009: Technology, restructuring, and productivity growth, USDA Econ. Res. Report, 158 (2013). [17] A. Shirota, Red tide problem and countermeasures, Int. J. Aquaculture and Fisheries Tech., 1 (1989), 195-293. [18] J. B. Shukla, A. K. Misra and P. Chandra, Modeling and analysis of the algal bloom in a lake caused by discharge of nutrients, Appl. Math. Comput., 196 (2008), 782-790.  doi: 10.1016/j.amc.2007.07.010. [19] V. H. Smith, Responses of estuarine and coastal marine phytoplankton to nitrogen and phosphorus enrichment, Limnol. Oceanogr., 51 (2006), 377-384.  doi: 10.4319/lo.2006.51.1_part_2.0377. [20] K. A. Steidinger, A re-evaluation of toxic dinoflagellate biology and ecology, Prog. Phycol. Res., 2 (1983), 147-188. [21] M. Swinker, Human health effects of hog waste, NC Med. J., 59 (1998), 16-18. [22] J. M. Testa, Y. Li and Y. J. Lee et al., Quantifying the effects of nutrient loading on dissolved O2 cycling and hypoxia in Chesapeake Bay using a couple hydrodynamic-biogeochemical model, J. Marine Syst., 139 (2014), 139-158. [23] J. E. Truscott and J. Brindley, Ocean plankton populations as excitable media, Bull. Math. Biol., 56 (1994), 981-998. [24] S. Wing, D. Cole and G. Grant, Environmental injustice in North Carolina's hog industry, Environ. Health Persp., 108 (2000), 225-231.  doi: 10.1289/ehp.00108225. [25] S. Wing, S. Freedman and L. Band, The potential impact of flooding on confined animal feeding operations in eastern north carolina, Environ. Health Persp., 110 (2002), 387-391.  doi: 10.1289/ehp.02110387. [26] J. Zhao and Y. Yan, Dynamics of a seasonally forced phytoplankton-zooplankton model with impulsive biological control, Discrete Dyn. Nat. Soc., 2016 (2016). doi: 10.1155/2016/2560195. [27] What Are Phytoplankton?, Available from: https://oceanservice.noaa.gov/facts/phyto.html. [28] North Carolina Department of Environmental Quality: MajorHydro, Available from: http://data-ncdenr.opendata.arcgis.com/datasets/majorhydro. [29] North Carolina Department of Environmental Quality: List of Permitted Animal Facilities, Available from: https://deq.nc.gov/cafo-map. [30] TIGER/Line Shapefiles, Available from: https://www.census.gov/geographies/mapping-files/time-series/geo/tiger-line-file.html. [31] Zooplankton Vs. Phytoplankton, Available from: https://sciencing.com/zooplankton-vs-phytoplankton-5432413.html.
North Carolina Major River Systems Map produced using QGIS. Data obtained from the U.S. Census Bureau [30] and the N.C. Department of Environmental Quality [28]
Locations of swine CAFOs (brown dots) relative to major river basins which drain into the Pamlico-Albemarle Sound estuary. Map produced using QGIS. Data obtained from the U.S. Census Bureau [30] and the N.C. Department of Environmental Quality [28,29]
System dynamics of Model 1 with no additional nutrients added over a 30-day time period. With no additional nutrient influx, any current algal presence quickly resolves itself. As the algae dies out, the amount of dissolved oxygen in the system flourishes
System dynamics of Model 2 with no additional nutrients added over a 30-day time period. The presence of zooplankton in the system results in a quicker decline in the algae population (Day 5 comparison: $A$ = 0.6127 $\mu$g/L in Model 2, as opposed to $A$ = 1.642 $\mu$g/L in Model 1 - see Figure 3)
PRCC sensitivity scores for (a) Model 1 and (b) Model 2
Changes in the eigenvalue $\lambda_2$ corresponding to the equilibrium point $(A,O,N) = (200, 1,150.0171)$, depending on $\beta_{N} \text{ and } \mu_{AN}$
Bifurcation diagram of Model 1 relating the steady nitrogen levels to the average temperature at varying values of $K_N$, the half-saturation constant for nutrient uptake
System dynamics of Model 1 with constant nutrient flow at $19.6$ mg/L over a 60-day time period. The algal bloom is resolvable in this case
System dynamics of Model 1 with constant nutrient flow at $19.8$ mg/L over a 60-day time period. The algal bloom is unresolvable in this case and we find that $\lambda = 19.7$ is a bifurcation value for Model 1
System dynamics of Model 2 with constant nutrient flow at $300$ mg/L over a one year time period. The algal bloom is resolvable in this case
Model 1 under variable nutrient flow $\lambda(t) = 20te^{-t/5}$ in a 60-day period
Long-term dynamics of Model 2 with variable nutrient flow term, $\lambda(t) = 20te^{-t/5}$. Note that the dissolved oxygen population does recover from the initial hypoxia when the algal population eventually reaches zero
Long-term dynamics of Model 1 with two breaches, 3 months apart from each other, under variable nutrient flow, $\lambda(t) = 20te^{-t/5}$
Long-term dynamics of Model 2 with two breaches, 3 months apart from each other, under variable nutrient flow, $\lambda(t) = 20te^{-t/5}$
Table of parameter descriptions and values. Where literature values are unavailable, parameters are estimated manually to produce behavior consistent with that which would be expected in model simulations
 Name Description Estimate Units Reference $A_0$ Arrhenius equation constant 5.35$\times 10^9$ days$^{-1}$ [9] $E/R$ Activation energy/universal gas constant 6472 $^{\circ}$K [9] $T$ Average air temperature 305.3722 $^{\circ}$K Estimated $K_N$ Half-saturation constant for nutrient uptake 50.5226 mg/L [10] $\delta_1$ Natural algal death rate 0.5 days$^{-1}$ [18] $\delta_2$ Algal death rate due to overcrowding 0.01 L/$(\mu$g$\cdot$days) Estimated $R_M$ Maximum specific predation rate 0.7 days$^{-1}$ [23] $\alpha$ Governing rate for predation maximum achievement 5.7 $\mu$g$^2$/L$^2$ [23] $q_0$ Constant influx of dissolved oxygen 6 days$^{-1}$ Estimated $\delta_0$ Natural depletion rate of dissolved oxygen 1 days$^{-1}$ [18] $\alpha_0$ Depletion rate of dissolved oxygen due to algae consumption 0.01 mg/$\mu$g Estimated $\lambda(t)$ Nutrient flow due to spill event Variable mg/(L$\cdot$ days) $\beta_N$ Influx rate of nutrients due to death of algae 0.2 mg/$\mu$g Estimated $\mu_{AN}$ Consumption rate of nutrients by algae 0.5 mg/$\mu$g Estimated $\gamma$ Production rate of zooplankton 0.05 Unitless [23] $\delta_Z$ Natural death rate of zooplankton 0.017 days$^{-1}$ [23]
 Name Description Estimate Units Reference $A_0$ Arrhenius equation constant 5.35$\times 10^9$ days$^{-1}$ [9] $E/R$ Activation energy/universal gas constant 6472 $^{\circ}$K [9] $T$ Average air temperature 305.3722 $^{\circ}$K Estimated $K_N$ Half-saturation constant for nutrient uptake 50.5226 mg/L [10] $\delta_1$ Natural algal death rate 0.5 days$^{-1}$ [18] $\delta_2$ Algal death rate due to overcrowding 0.01 L/$(\mu$g$\cdot$days) Estimated $R_M$ Maximum specific predation rate 0.7 days$^{-1}$ [23] $\alpha$ Governing rate for predation maximum achievement 5.7 $\mu$g$^2$/L$^2$ [23] $q_0$ Constant influx of dissolved oxygen 6 days$^{-1}$ Estimated $\delta_0$ Natural depletion rate of dissolved oxygen 1 days$^{-1}$ [18] $\alpha_0$ Depletion rate of dissolved oxygen due to algae consumption 0.01 mg/$\mu$g Estimated $\lambda(t)$ Nutrient flow due to spill event Variable mg/(L$\cdot$ days) $\beta_N$ Influx rate of nutrients due to death of algae 0.2 mg/$\mu$g Estimated $\mu_{AN}$ Consumption rate of nutrients by algae 0.5 mg/$\mu$g Estimated $\gamma$ Production rate of zooplankton 0.05 Unitless [23] $\delta_Z$ Natural death rate of zooplankton 0.017 days$^{-1}$ [23]
 [1] Christopher K.R.T. Jones, Bevin Maultsby. A dynamical approach to phytoplankton blooms. Discrete and Continuous Dynamical Systems, 2017, 37 (2) : 859-878. doi: 10.3934/dcds.2017035 [2] Lorena Rodríguez-Gallego, Antonella Barletta Carolina Cabrera, Carla Kruk, Mariana Nin, Antonio Mauttone. Establishing limits to agriculture and afforestation: A GIS based multi-objective approach to prevent algal blooms in a coastal lagoon. Journal of Dynamics and Games, 2019, 6 (2) : 159-178. doi: 10.3934/jdg.2019012 [3] M. Dambrine, B. Puig, G. Vallet. A mathematical model for marine dinoflagellates blooms. Discrete and Continuous Dynamical Systems - S, 2021, 14 (2) : 615-633. doi: 10.3934/dcdss.2020424 [4] Florian Rupp, Jürgen Scheurle. Analysis of a mathematical model for jellyfish blooms and the cambric fish invasion. Conference Publications, 2013, 2013 (special) : 663-672. doi: 10.3934/proc.2013.2013.663 [5] Laura Gardini, Iryna Sushko. Preface: Special issue on nonlinear dynamical systems in economic modeling. Discrete and Continuous Dynamical Systems - B, 2021, 26 (11) : i-iv. doi: 10.3934/dcdsb.2021241 [6] Loïc Louison, Abdennebi Omrane, Harry Ozier-Lafontaine, Delphine Picart. Modeling plant nutrient uptake: Mathematical analysis and optimal control. Evolution Equations and Control Theory, 2015, 4 (2) : 193-203. doi: 10.3934/eect.2015.4.193 [7] H. W. Broer, Renato Vitolo. Dynamical systems modeling of low-frequency variability in low-order atmospheric models. Discrete and Continuous Dynamical Systems - B, 2008, 10 (2&3, September) : 401-419. doi: 10.3934/dcdsb.2008.10.401 [8] Dorota Bors, Robert Stańczy. Dynamical system modeling fermionic limit. Discrete and Continuous Dynamical Systems - B, 2018, 23 (1) : 45-55. doi: 10.3934/dcdsb.2018004 [9] Jaewook Ahn, Sun-Ho Choi, Minha Yoo. Global wellposedness of nutrient-taxis systems derived by a food metric. Discrete and Continuous Dynamical Systems, 2021, 41 (12) : 6001-6022. doi: 10.3934/dcds.2021104 [10] H. T. Banks, R. A. Everett, Neha Murad, R. D. White, J. E. Banks, Bodil N. Cass, Jay A. Rosenheim. Optimal design for dynamical modeling of pest populations. Mathematical Biosciences & Engineering, 2018, 15 (4) : 993-1010. doi: 10.3934/mbe.2018044 [11] El Houcein El Abdalaoui, Sylvain Bonnot, Ali Messaoudi, Olivier Sester. On the Fibonacci complex dynamical systems. Discrete and Continuous Dynamical Systems, 2016, 36 (5) : 2449-2471. doi: 10.3934/dcds.2016.36.2449 [12] Lianfa He, Hongwen Zheng, Yujun Zhu. Shadowing in random dynamical systems. Discrete and Continuous Dynamical Systems, 2005, 12 (2) : 355-362. doi: 10.3934/dcds.2005.12.355 [13] Mauricio Achigar. Extensions of expansive dynamical systems. Discrete and Continuous Dynamical Systems, 2021, 41 (7) : 3093-3108. doi: 10.3934/dcds.2020399 [14] Fritz Colonius, Marco Spadini. Fundamental semigroups for dynamical systems. Discrete and Continuous Dynamical Systems, 2006, 14 (3) : 447-463. doi: 10.3934/dcds.2006.14.447 [15] John Erik Fornæss. Sustainable dynamical systems. Discrete and Continuous Dynamical Systems, 2003, 9 (6) : 1361-1386. doi: 10.3934/dcds.2003.9.1361 [16] Vieri Benci, C. Bonanno, Stefano Galatolo, G. Menconi, M. Virgilio. Dynamical systems and computable information. Discrete and Continuous Dynamical Systems - B, 2004, 4 (4) : 935-960. doi: 10.3934/dcdsb.2004.4.935 [17] Mădălina Roxana Buneci. Morphisms of discrete dynamical systems. Discrete and Continuous Dynamical Systems, 2011, 29 (1) : 91-107. doi: 10.3934/dcds.2011.29.91 [18] Josiney A. Souza, Tiago A. Pacifico, Hélio V. M. Tozatti. A note on parallelizable dynamical systems. Electronic Research Announcements, 2017, 24: 64-67. doi: 10.3934/era.2017.24.007 [19] Philippe Marie, Jérôme Rousseau. Recurrence for random dynamical systems. Discrete and Continuous Dynamical Systems, 2011, 30 (1) : 1-16. doi: 10.3934/dcds.2011.30.1 [20] Tobias Wichtrey. Harmonic limits of dynamical systems. Conference Publications, 2011, 2011 (Special) : 1432-1439. doi: 10.3934/proc.2011.2011.1432

2021 Impact Factor: 1.865


text:
# The Top Scores for Canabalt, Take 2

### Introduction

As promised on Thursday, here’s my second pass at a statistical analysis of Canabalt scores. There are some useful results I’ll present right at the start, and then there are some results that are more or less worthless, except that working through my own mistakes helped me to think more clearly about statistical modeling in general and about Poisson models for discrete data in particular.

### Rethinking the Problem

First, let’s review the reason why I proposed analyzing the scores in the first place. My goal was to determine whether or not it was reasonable to assume that learned skill really influences your score on Canabalt. If you’ve played for more than ten games in a row, I think it’s intuitively clear that you can warm up and start to do better. Whether or not this holds up to a rigorous analysis is another matter, but I haven’t gotten around to collecting the right data yet.

The mere fact that you can do better with a little bit of practice suggests that the distribution of scores cannot be entirely attributed to chance variation: there’s at least some level of skill that matters. What’s really interesting, though, is how differently different people can perform, regardless of how long they’ve had to warm up.

Originally, I thought that it would be useful to see how well a probabilistic model could explain the distribution of scores. I’ll return to my results fitting probabilistic models in the second part of this post, but I now realize that the basic idea behind this approach was deeply flawed. Even if the distribution of scores looks random, it could easily be the case that it’s the distribution of skill levels that’s random, and that, for any given skill level, your score is more or less deterministic. Though that point doesn’t apply here (where we know that there’s variation in the scores that a single player gets), I think the point in general makes clear that the quality of fit of a probabilistic model to empirical data says nothing about the determinism implicit in the process that generates the data. (Which I should have known already, being a fan of Laplace’s demon.)

Instead, if we want to understand the importance of skill, we should look directly at the difference in average scores between people of seemingly high skill and those of seemingly low skill — that is, we should simply look at the distributions of scores for people with different values of some operationalization of skill level to see how much they differ.

How do we measure skill level? I tried two naïve approaches, and both gave pretty similar results. The first approach is to consider all of the players who have at least one score in the top 10% of scores. The other approach is to consider all of the players whose median score is in the top 10%. I chose the median rather than the mean, because the mean will be biased by a single very high score, which could make these two measures of skill almost identical.

Once you have the two groups defined in your data set using these rules, you can simply perform a t-test to compare the performance of these two groups. Both times, I find that the scores are blatantly different across the two groups. The expert users’ mean score is always above 10,000 under both definitions, while the non-expert users’ mean score is around 3,500. In short, I’d say that there’s no way that you can realistically argue that skill doesn’t play a part in determining the score you get.

NB: The R code for doing all of this is at the bottom of this post.

### Model Fitting

During the original conversation with my fellow graduate students about Canabalt that inspired this post and the one before it, I claimed that the distribution of scores looked like a Poisson distribution based on my (now known to be poor) recollection of the shape of the Poisson distribution. So, when I started my analyses, my first idea was to fit a Poisson distribution to my data using a call to the glm function in R:

 1 glm(scores ~ 1, data = data.set, family = poisson)

To convince myself that this was the correct way to fit a constant Poisson model in R, I derived the maximum likelihood estimator for the mean parameter of a Poisson distribution given a set of sample observations by hand. The math deriving the right parameter estimate is outlined at the bottom of this post and can easily be skipped if that sort of thing is opaque or boring to you.

Once you fit this model, you can simulate data from it and see how much it looks like the original data. To refresh your memory, the original score data looks like this:

The results of a Poisson simulation look like this:

As you can see, this simulation is laughably bad. The Poisson model, lacking a variance parameter, is an absolutely terrible model for the scores from Canabalt. Knowing that I had been basically defeated, I tried a discretized Normal distribution (with a useful independent variance parameter) that was bound to fail because of its symmetry. The results from the Normal distribution look like this:

This is also pretty terrible: there are actually negative results in the data set, no skew at all (which is obviously a given with any parameterization of the Normal distribution) and no outliers. The class of other models I could think of trying beyond these two didn’t seem much more promising, so I didn’t continue on. I hope that’s a reflection of my weak knowledge of probability theory more than anything else.

### A Proper Probabilistic Model?

I’d still be interested in seeing whether there is a canonical probability distribution out there that fits the data qualitatively, but I haven’t had any luck searching through lists of distributions online. The desired distribution should:

1. Be integer valued.
2. Be strictly positive.
3. Have heavy tails.

The third point above makes the Poisson distribution, with its small variance, useless, while the second point makes a discretized Normal, with its problematic symmetry, useless. If you have any solutions, please let me know. (I should note that I’ve considered, but decided against, using an over-dispersed Poisson model because I’m not familiar enough with its analytic properties.)

### Complete Analysis Code and Results for Across Group Comparisons

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 data.set <- read.csv('canabalt_data.csv', header = TRUE, sep = ',')   top.ten.score <- as.numeric(quantile(data.set$score, c(.9))) top.users <- unique(data.set$user[data.set$score > top.ten.score]) top.users.scores <- with(subset(data.set, user %in% top.users), score) bottom.users.scores <- with(subset(data.set, !(user %in% top.users)), score) t.test(bottom.users.scores, top.users.scores) # Welch Two Sample t-test # #data: bottom.users.scores and top.users.scores #t = -16.7087, df = 196.389, p-value < 2.2e-16 #alternative hypothesis: true difference in means is not equal to 0 #95 percent confidence interval: # -7743.866 -6108.843 #sample estimates: #mean of x mean of y # 3443.313 10369.668 alt.top.users <- c() for (user in with(data.set, unique(user))) { median.user.score <- median(data.set$score[data.set\$user == user]) if (median.user.score > top.ten.score) { alt.top.users <- c(alt.top.users, user) } }   alt.top.users.scores <- with(subset(data.set, user %in% alt.top.users), score) alt.bottom.users.scores <- with(subset(data.set, !(user %in% alt.top.users)), score)   t.test(alt.bottom.users.scores, alt.top.users.scores)   # Welch Two Sample t-test # #data: alt.bottom.users.scores and alt.top.users.scores #t = -16.376, df = 139.206, p-value < 2.2e-16 #alternative hypothesis: true difference in means is not equal to 0 #95 percent confidence interval: # -9130.290 -7163.108 #sample estimates: #mean of x mean of y # 3586.801 11733.500


text:
# Historical reasons for adoption of Turing Machine as primary model of computation.

It's my understanding that Turing's model has come to be the "standard" when describing computation. I'm interested to know why this is the case -- that is, why has the TM model become more widely-used than other theoretically equivalent (to my knowledge) models, for instance Kleene's μ-Recursion or the Lambda Calculus (I understand that the former didn't appear until later on and the latter wasn't originally designed specifically as a model of computation, but it shows that alternatives have existed from the start).

All I can think of is that the TM model more closely represents the computers we actually have than its alternatives. Is this the only reason?

-
while they are not directly on the same topic, the questions cstheory.stackexchange.com/questions/625/… and cstheory.stackexchange.com/questions/1117/… explore the relationship between TMs and the $\lambda$-calculus, and have some historical elements. –  Suresh Venkat Dec 8 '10 at 20:23
Yes, I saw those. I understand fairly well the literal histories of the various theories, but I'm more interested in the developments over time that led to the current "preferences" in the field, if you will. –  Evan Dec 8 '10 at 20:31
Actually there are models which are (arguably) closer to real computers, see this question. Generally the best model depends on the needs and they are different from one area to another. –  Kaveh Dec 8 '10 at 23:41

This seems to be true in the context of (some areas of) computer science but not generally.

One reasons has to do with the Church's Thesis. The main reason is that some experts like Godel didn't think that the arguments that previous/other models of computation capture exactly the intuitive concept of computation were convincing. There are various arguments, Church had some, but they did not convince Godel. On the other hand Turing's analysis was convincing for Godel so it was accepted as the model for effective computation. The equivalences between different models is proven later (I think by Kleene).

The second reason is technical and a later development related to the study of complexity theory. Defining the complexity measures like time, space, and nondeterminism seems to be easier using Turing machines than other models like $\lambda$-calculus and $\mu$-recursive functions.

On the other hand, $\mu$-recursive functions were and are still used as the main way of defining computability in logic and computability theory books. They are easier to work with when one only cares about effectiveness and not about complexity. Kleene's book "Metamathematics" was very influential for this development. Also $\lambda$-calculus seems to be more common in CMU/European style computer science like programming languages and type theory. Some authors prefer the RAM and Register Machine models. (It seems to me that for some reason Americans adopted Turing's semantic model and Europeans adopted Church's syntactic model, Chruch was American and Turing was British. This a personal opinion/observation and others have a different view. Also see these papers by Viggo Stoltenberg-Hansen and John V. Tucker I,II.)

### Some resources for further reading:

Robert I. Soare has a number of articles on the history of these developments, I personally like the one in the Handbook of Computability Theory. you can find more by checking the references in that paper.

Another good resource is Neil Immerman's computability article on SEP, see also Church-Turing Thesis article by B. Jack Copeland.

Godel's collected works contains lots of information on his views. Specially introductions to his articles are extremely well-written.

Kleene's "Metamathematics" is a very nice book.

Finally, if you are not still satisfied check the archives of the FOM mailing list, and if you cannot find an answer in the archive post a an email to the mailing list.

-
Please let me know if I have got something wrong. –  Kaveh Dec 8 '10 at 23:37
Wow, this is great info. Thanks for the resources, I'll check them out (I was planning to read Metamathematics -- I'll bump it up the queue). –  Evan Dec 9 '10 at 0:01
You are welcome, hopefully I haven't got it wrong. :) –  Kaveh Dec 9 '10 at 0:15
There was a recent talk by Robert Soare at INI. As I understand it, the main reason for changing to Turing model and computability from recursive functions and recursion theory for him is the following: it is hard to understand and work in recursion theory to the point where no one was understanding what was going on except a few, the change to computability made it much easier to understand and revived the area. –  Kaveh Jun 25 '12 at 2:14

I would like to weaken the claim that TMs are the primary model of computation, or at least point towards another dimension of the question. Clearly TMs are dominant in the more complexity- and algorithmically-oriented parts of computer science, but in programming language theory and practise, they are not particularly dominant. There are various reasons for this, but maybe the most important is that TMs or programs running on TMs (unlike e.g lambda-calculi or process-calculi) are not constructed in an algebraic manner. This makes it difficult to develop type-theories, which have been the mainstay of programming language theory.

-
Also, TM programs aka transition tables are not really humanly readable. –  Raphael Dec 11 '10 at 12:31

One of the nice things about Turing machines is that they work on strings instead of natural numbers or lambda terms, because the input and the output of many problems can be naturally formulated as strings. I do not know if this counts as a “historical” reason or not, though.

-

Beside the fact that Turing machines are a convincing model of pen-and-paper computation (the “intuitive notion of computation”), I think they possess a series of features that are often useful, particularly when proving theorems about them:

• they are easy to describe formally and have simple operational semantics;
• it’s easy to give a concrete definition of their time and space complexity;
• more realistic (and complex) models of electronic computers, such as random access machines, can be simulated by TMs with a polynomial overhead, and vice versa.
-
Sometimes the facility of description seems to hinder the usefulness of TMs, since descriptions can quickly devolve into plain-English explanations if you're not careful (at least, if I'm not careful... Admittedly I'm a novice). –  Evan Dec 9 '10 at 0:03
Your reasons do not exclude register machines, for example. –  Raphael Dec 9 '10 at 9:42
Well, that depends on the precise notion of “register machine” you consider. For instance, those having only increment, decrement and jump operations cannot simulate TMs in polynomial time. –  Antonio E. Porreca Dec 9 '10 at 11:15
I suspect that TMs are more intuitive only because they are presented as machines, rather than as abstract mathematical operations. If $\lambda$-calculus was presented as a "term rewriting" machine, then it would be (more) intuitive. Note the Alligator Eggs childrens' game for teaching them $\lambda$-calculus worrydream.com/AlligatorEggs –  Rob Apr 9 '11 at 8:03


text:
• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# form mailer sending blanks

## Recommended Posts

cza    122
hey guys another problem which i have googled for abotu 2 hours now and found no resolve my problem is this email script is sending blank emails: this info comes from the previous page in which all the feilds in the form are shown to the person who has entered the information , in order to check to see if they are all correct. is this the problem that they are comming from the actual form itself or am i doing somethign wrong. this needs to be finished by tomorrow so im desperate thanks ALOT of any help cza  this is the code from which the info is being sent: http://calebt.recoil.net.nz/others/check2.phps (if it is any help)  [edited by - cza on August 14, 2003 8:11:55 AM] [edited by - cza on August 14, 2003 8:12:18 AM]

##### Share on other sites
LordLethis    122
If your code is in the same order as you posted it, you should move the
$message = "$Q1 $Q2$Q3 $Q4$Q5 $Q6$Q7 $Q8$Q9 $Q10"; under the initialization of the vars$Q1-$Q10. #### Share this post ##### Link to post ##### Share on other sites cza 122 okay sweet will try now i thought that was abit weird but i got it off a tutorial here : http://resma.net/tutorials/php/form_finish.php hmmm still no joy i just tryed it then if i add ',' inbetween the$Q1 etc it send the , mark only

so the problem can only be in them :/

[edited by - cza on August 14, 2003 8:23:48 AM]

##### Share on other sites
LordLethis    122
Well then I guess your var's are empty...
...
Sorry I didn't look at the file you posted
You don't seem to be passing any vars to your email function...
You could pass them as
<input type="hidden" name="Q1" value="<?php echo $Q1; ?>"> and similar... [edited by - LordLethis on August 14, 2003 8:31:45 AM] #### Share this post ##### Link to post ##### Share on other sites cza 122 hmmm thanks should i put that on the sending page or on the check page here is how the site works survey.php (fill ths out , click the continue button) ----takes u to check.php (shows all your answers to make sure they are correct) -----click send button (Which is meant to email the answers) sent.php (just says thank u and all that) so now where do i put the hidden things on ? on the check.php page i would say?? #### Share this post ##### Link to post ##### Share on other sites LordLethis 122 Yeah, I meant to put it in the check.php. #### Share this post ##### Link to post ##### Share on other sites cza 122 thanks ALOT! bro you have potentially saved my life :D i will try now and report back #### Share this post ##### Link to post ##### Share on other sites LordLethis 122 No problem, I like to help if I can I remember me spending some hours about that prob not too long ago #### Share this post ##### Link to post ##### Share on other sites cza 122 OMG!@#! this is frustrating me somewhat (welcome to the world of coding) this is the code on my check page: <input type="hidden" name="Q1" value=""> <input type="hidden" name="Q2" value=""> <input type="hidden" name="Q3" value=""> <input type="hidden" name="Q4" value=""> <input type="hidden" name="Q5" value=""> <input type="hidden" name="Q6" value=""> <input type="hidden" name="Q7" value=""> <input type="hidden" name="Q8" value=""> <input type="hidden" name="Q9" value=""> <input type="hidden" name="Q10" value=""> <form action="sending.php" method="post"> <input type="submit" name="submit" value="Send Survey"> (where is says value=" there is this in there "< ? php echo$Q10 ; ? >)

this is the code on the sending page:

$address = "Tamihere@world-net.co.nz";$subject = "Survey";

$from = "geo_survey";$Q1=$_POST['Q1'];$Q2=$_POST['Q2'];$Q3=$_POST['Q3'];$Q4=$_POST['Q4'];$Q5=$_POST['Q5'];$Q6=$_POST['Q6'];$Q7=$_POST['Q7'];$Q8=$_POST['Q8'];$Q9=$_POST['Q9'];$Q10=$_POST['Q10'];$message = "$Q1,$Q2, $Q3,$Q4, $Q5,$Q6, $Q7,$Q8, $Q9,$Q10";

mail($address,$subject, $message,$from);

?>

and it still doesnt have anythign in the variables

im getting very close to just making the first submit button send the information D:

[edited by - cza on August 14, 2003 8:52:00 AM]

##### Share on other sites
hellz    356
Edit: Bah, it's messed up the PHP tags. I've sort of fixed it, but ignore the space after each < when a ? follows (it does make a difference in PHP), so make sure there's no space there.

Ok, here is what you want to be structuring your code as.

The first page where the user enters their survey answers wants to have a form that uses the POST method, which submits the information to your checking page.

Now, I *think* what you've done, is to just echo out the contents of $Qx on the checking page, not$_POST['Qx']. The difference is that PHP doesn't assume it should be checking the POST collection for the reference of $Qx, so instead of displaying the contents from each of your variables in the POST collection, in the hidden field values for your checking form, it's displaying nothing (another words, null) as a value. To correct this, change your hidden form inputs on your checking page, to the following: <input type="hidden" name="Q1" value="< ?php echo$_POST['Q1']; ?>">
<input type="hidden" name="Q2" value="< ?php echo $_POST['Q2']; ?>"> ... etc. Now there's 2 things I need to point out. Firstly, double check that your form on your first survey page is using POST as it's sending method (same goes for your form on your checking page) and secondly, before outputing the contents of each POST variable, on your second form, you should validate the contents. Example: < ?php /* Assume isFormSafe() is a function you've written to validate the data. */$v_Q1 = isFormSafe($_POST['Q1']); /* Do the same for the other question variables. */ ?> Then on your form, instead of directly accessing the POST collection to output the information on your forms (which is dangerous and very open to exploitation), use the$v_Qx variables instead, as in:

<input type="hidden" name="Q1" value="< ?php echo $v_Q1; ?>"> Incidentally, you can echo out variables in PHP using a shorthand similar to that of ASP; example: <input type="hidden" name="Q1" value="< ?=$_POST['Q1'];?>">

Notice there is no longer the need for "php echo" in that statement.

Hope that helps,

--hellz

[edited by - hellz on August 14, 2003 10:19:30 AM]

[edited by - hellz on August 14, 2003 10:20:47 AM]

##### Share on other sites
capn_midnight    1707
instead of sending all you data as seperate variables, I would send it as one.

There is a function called implode that takes an array and a string. It makes a string that is all of the elements of the array seperated by the string
$arr=array(1,2,3,4,5);$str=implode($arr,''|'');//$str is now "1|2|3|4|5";$arr2=explode(''|'',$str);//$arr2 is now equivalent to$arr

you could do a little javascript before you submit to do the implode.
<FORM NAME="fillForm"><INPUT NAME="ff1" TYPE="text" VALUE="all the stuff for your survey"><INPUT NAME="ff2" TYPE="text" VALUE="all the stuff for your survey"><INPUT TYPE="button" onClick="send()"></FORM><FORM NAME="subForm" ACTION="POST" METHOD="check.php"><INPUT TYPE="hidden" NAME="DATA" VALUE=""></FORM>

   <FORM NAME="hidForm" ACTION="POST" METHOD="send.php"><?phpprint "<INPUT TYPE=''hidden'' NAME=''DATA'' VALUE=''$DATA''>\n";$arr=explode("|",$DATA);foreach($arr as $item){$item
";}?><INPUT TYPE="submit"><INPUT TYPE="button" VALUE="reset" onClick="parent.location=''survey.html''"></FORM>

etc....

In other words, you need to print" " or echo" " these hidden vars with value=''$Q1'' etc.... ALONG WITH your submit button to have the email.php REMEMBER the values. What you were doing is passing blanks to your email.php so no wonder you got blanks in the mail( ) command. I''ve done that myself when I was learning PHP last year. Also the$Q1 = $_POST etc lines are not required, I''ve never used those. You only need to reference the variables themselves and as long as they''re passed you''ll have the values. Phil P #### Share this post ##### Link to post ##### Share on other sites superpig 1825 I believe that in the more recent versions of PHP, you''re meant to use$_REQUEST[] rather than $_POST[].$_REQUEST contains values passed in through both GET and POST.

Sometimes you can access them directly by name (i.e. $Q1 rather than$_REQUEST["Q1"]) but I think that''s turned off by default because it''s a security hazard (''register_globals'' or something).

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4

##### Share on other sites
hellz    356
quote:
Original post by PhilVaz
Also the $Q1 =$_POST etc lines are not required, I've never used those. You only need to reference the variables themselves and as long as they're passed you'll have the values.

Edit: Read my reply after this mate, it'll explain more where I'm getting at.

Incorrect. The reason is that if you don't specify where the values are to be read from, it would be simple to inject information into those variables. For example, if you had a variable $test in your program, which you wanted to retrieve from a form via post, it would be very easy for an attacker to change the variable from the URL string, as in: something.php?test=whatever Whilst this doesn't demonstrate exactly *how* it's dangerous, you should *always* specify where a variable is to be read from, for the safety of your own scripts (and to enforce the principle of least privilege). --hellz [edited by - hellz on August 15, 2003 2:20:59 PM] #### Share this post ##### Link to post ##### Share on other sites hellz 356 quote: Original post by superpig I believe that in the more recent versions of PHP, you're meant to use$_REQUEST[] rather than $_POST[].$_REQUEST contains values passed in through both GET and POST.

Sometimes you can access them directly by name (i.e. $Q1 rather than$_REQUEST["Q1"]) but I think that's turned off by default because it's a security hazard ('register_globals' or something).

Whilst that is true, there's a lot you should be aware of. Firstly, register_globals was switched from ON to OFF in versions PHP 4.2.0 and upwards. Taken from the PHP manual:

"Reliance on this directive was quite common and many people didn't even know it existed and assumed it's just how PHP works. This page will explain how one can write insecure code with this directive but keep in mind that the directive itself isn't insecure but rather it's the misuse of it.

When on, register_globals will inject (poison) your scripts will all sorts of variables, like request variables from html forms. This coupled with the fact that PHP doesn't require variable initialization means writing insecure code is that much easier. It was a difficult decision, but the PHP community decided to disable this directive by default. When on, people use variables yet really don't know for sure where they come from and can only assume. Internal variables that are defined in the script itself get mixed up with request data sent by users and disabling register_globals changes this. Let's demonstrate with an example misuse of register_globals:

Example 15-14. Example misuse with register_globals = on

<  ?php// define $authorized = true only if user is authenticatedif (authenticated_user()) {$authorized = true;}// Because we didn't first initialize $authorized as false, this might be// defined through register_globals, like from GET auth.php?authorized=1 // So, anyone can be seen as authenticated!if ($authorized) {    include "/highly/sensitive/data.php";}?>

When register_globals = on, our logic above may be compromised. When off, $authorized can't be set via request so it'll be fine, although it really is generally a good programming practice to initialize variables first. For example, in our example above we might have first done$authorized = false. Doing this first means our above code would work with register_globals on or off as users by default would be unauthorized."

--hellz

[edited by - hellz on August 15, 2003 2:19:42 PM]


text:
# Kerodon

$\Newextarrow{\xRightarrow}{5,5}{0x21D2}$ $\newcommand\empty{}$

Corollary 4.5.2.25. Suppose we are given a categorical pullback square of $\infty$-categories

$\xymatrix@R =50pt@C=50pt{ \widetilde{\operatorname{\mathcal{C}}} \ar [d]^-{U} \ar [r] & \widetilde{\operatorname{\mathcal{D}}} \ar [d]^{V} \\ \operatorname{\mathcal{C}}\ar [r]^-{F} & \operatorname{\mathcal{D}}, }$

where $U$ and $V$ are isofibrations. Let $C \in \operatorname{\mathcal{C}}$ be an object having image $D = F(C)$. Then the induced map

$\widetilde{\operatorname{\mathcal{C}}}_{C} = \{ C\} \times _{\operatorname{\mathcal{C}}} \widetilde{\operatorname{\mathcal{C}}} \rightarrow \{ D\} \times _{\operatorname{\mathcal{D}}} \widetilde{\operatorname{\mathcal{D}}} = \widetilde{\operatorname{\mathcal{D}}}_{D}$

is an equivalence of $\infty$-categories.

Proof. Apply Corollary 4.5.2.24 in the special case $\operatorname{\mathcal{C}}_1 = \{ C\}$ and $\operatorname{\mathcal{D}}_1 = \{ D\}$. $\square$